Commit Graph

104 Commits

Author SHA1 Message Date
5d69d9734b Cleanup: io_scene_obj, unused imports, vars 2019-12-03 08:21:24 +11:00
db2c65d9e7 Fix T70666: OBJ IO: Add support for new Emission option of Principled BSDF. 2019-10-10 17:20:16 +02:00
c047f64604 Fix T68618: OBJ export: error cleaning up (temp) meshes without geometry
Reviewers: mont29

Maniphest Tasks: T68618

Differential Revision: https://developer.blender.org/D5479
2019-08-14 11:41:36 +02:00
901868a4b2 Update for Depsgraph API changes
Addresses new behavior of object.to_mesh().

This is corresponding part for D4875.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D4876
2019-05-16 16:43:14 +02:00
e5c3ae3118 Addons: Adopt for Dependency Graph API changes
Mainly search-and-replace approach.

Tested the enabled-by-default export/import addons. Seems to work with
an exception of X3D which is still referencing Blender Internal material
properties.

Reviewers: brecht

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D4866
2019-05-16 10:34:11 +02:00
05baedacbf OBJ IO: Use Principled BSDF's Alpha new setting.
Much better than using Principled's Transmission setting as we did
before...

Part of T64609.
2019-05-15 21:19:51 +02:00
f541b292ef Fix T60845: Export OBJ: error exporting as obj when file contains collection instances.
Looks like that was skipped somehow when OBJ IO was ported to 2.8...
2019-02-06 21:46:44 +01:00
668b2abbf5 Fix T60282: use keyword argument in obj exporter 2019-01-08 12:37:01 +01:00
6f43027fdd Fix T60238: Error in OBJ exporter if material has a normal map.
Typo, thanks to Aleksi Juvani (@aleksijuvani) for finding it.
2019-01-06 18:21:25 +01:00
1860441ee7 Use collection and instance terminology in Python API
This follows naming convention agreed on in T56648.
2018-11-28 18:23:31 +01:00
87b985c47f Merge branch 'master' into blender2.8 2018-11-01 16:21:22 +11:00
92895af5dd Update for changes to Blender's API 2018-11-01 16:20:27 +11:00
1c75533d9c Merge branch 'master' into blender2.8 2018-10-19 18:13:31 +02:00
d7d3233715 Spelling fixes in comments and descriptions, patch by luzpaz.
Differential Revision: https://developer.blender.org/D3746
2018-10-19 18:12:29 +02:00
0f84063c58 OBJ IO: Change specular IO conversion.
Conversion from phong exponent to Principled BSDF is expected to be
quadratic afaik, not linear.
2018-10-16 16:43:33 +02:00
3c2a3f8a60 Update for node_shader_utils changes. 2018-10-12 15:56:24 +02:00
234cf14fe7 Fixes for tessface removal. 2018-10-12 14:37:10 +02:00
227fafdfcf Update for removal of tessfaces.
This ports the already working addons. The disabled x3d, psk, lwo, 3ds,
raw, dxf addons still need to be converted.
2018-10-10 17:25:48 +02:00
f9c31589f6 OBJ IO: Initial support for modern shaders.
Based on new bpy_extras' node_shader_utils module.

Note that this is still quiet rough on the edges, not all features
previously supported (in 2.7x) are back yet (at least missing
displacement, which should not be too hard to add, and real alpha
handling, which is probably a bit more hairy).

Also, some things like specular or mirror colors, ambient lighting, etc.
do not exists in Principled BSDF shader, tried to work around it but
there likely some room for improvements here too.
2018-09-27 23:33:01 +02:00
4101cb5d5a Initial porting of OBJ (wavefront) IO add-on to 2.8.
As with FBX, major changes are no support for exporting materials
anymore (since all are nodals), and no more texface at all.
2018-09-21 20:02:41 +02:00
ab9c49ad46 Fix OBJ exporter for 2.8
We no longer have per face image nor world ambient color.
In the future it would be nice to support the active texture for each material.
But for now at least the exporter doesn't crash.
2018-05-24 14:25:40 +02:00
ce7685695e Fix T52833: OBJ triangulate doesn't match viewport 2017-09-25 10:52:13 +10:00
473d074b34 Fix T51700: OBJ exporter would have inverted normals in some cases.
Applying a matrix with non-uniform negative scaling to a mesh requires
normals (face winfing) to be inverted back to their original orientation!
2017-06-06 18:49:02 +02:00
57f376e946 Cleanup: trailing space 2017-03-19 12:49:18 +11:00
a746a84f8a Fix T50453: Add option to OBJ export to apply render or preview modifiers. 2017-01-17 12:31:58 +01:00
afde50f681 Fix T49865: export .obj broke UVs.
This reverts rBAc553d7c0eb002a02e7, not actually sure why this change in
precision of actually written value was done.
2016-10-30 12:44:38 +01:00
1fc1a20993 Fix T49338: Export to OBJ add extra space to the texture file name on MTL file 2016-09-13 12:26:18 +02:00
c553d7c0eb Avoid writing redundant zeros
These values are always rounded to 4 decimal places so no need to write 6.
2016-04-05 18:07:04 +10:00
4355471ae8 Fix T47299: Error writing MTL options 2016-02-02 22:01:03 +11:00
c0a273d1e7 Fix T47053: Problem while import/export of obj files.
Missing import of Vector...
2015-12-23 19:58:40 +01:00
f0fe54fcdd Fix T47010: Blender OBJ UV's give issues with some apps
Blender was sharing UV's for all vertices,
while this is correct it was causing issues for Maya, 3ds Max & Unfold3D.
2015-12-22 01:11:41 +11:00
91df04dea5 Remove unused operator argument 2015-11-08 01:29:40 +11:00
ecdc7c03ec OBJ IO: add (limited) support for options of textures in MTL files.
This commit adds IO support for:
* -o (offset texture)
* -s (scale texture)
* -bm (bump multiplier, used a normal factor)

Note that it also fixes T46459.
2015-10-13 12:41:25 +02:00
626d6e8807 Fix T46437: Dupli objects should also export themselves, not only their duplis...
To be backported, should we need an 'a' release.
2015-10-10 17:20:32 +02:00
94c9c4ee33 Fix T45766: Exported OBJ/MTL files do not include emissive lighting parameters.
ke/map_ke are not official .mtl specs, but seem to be rather common extension.
map_ke was added three years ago to exporter only, this commit finishes the work
by adding ke/map_ke to importer, and ke to exporter.

NOTES:
* mtl ke is a color, while in Blender emit is only a factor, using diffuse color.
  this implies there is some loss of data during import here.
* I do not have the slightest idea about the range for ke values, so for now assuming
  a direct matching of Blender's emit value.
2015-08-13 12:04:04 +02:00
3cc970eaf5 OBJ IO: add some progress report for user.
Use new 'progress_report' util module to do both a (basic) report of I/O progression,
together with some logging/timing of main steps.

We could probably go much further, but for now it will do.

Also, using files as context manager, too!
2015-07-11 16:45:54 +02:00
7194d2205e Fix T45403: Error on OBJ export.
Own mistake in recent corrections in regarding material's ambient handling.

Also, took the oportunity to fix a bit how shadings modes are handled (previously
if read early, they could be overwritten by other later settings...).
2015-07-11 00:25:55 +02:00
3430fbc701 Fix T45316: Obj loading/saving brightness inconsistency.
Fixes:
* Wrong (off-by-one) import of specular hardness (aka specular exponent in OBJ).
* Bad usage of world color when exporting ambient color (though it seems to make sense
  on first look, this is bad because impossible to 'undo' on import - merging
  data external to object itself).
* Bad default values for diff/spec intensity in imported materials (OBJ does not
  have those, so we must assume they are 1.0).

Thanks to Luke Brookes (propuke) for finding all those glitches! :)
2015-07-05 17:20:53 +02:00
bd9fa80543 Fix T43487: Wavefront OBJ exporter should export more precise illum value in MTL file.
Was a TODO actually, now we try to match better illum values with current mesh material.
Also, using mirror color as Ka instead of ambient one, when mirror is enabled in blen mat.
2015-04-24 16:06:33 +02:00
0225bffb98 OBJ IO: More cleanup (mostly from pep8). 2015-03-01 10:45:45 +01:00
7af50e62d3 OBJ import/export cleanup.
Reviewers: mont29

Projects: #import_export

Differential Revision: https://developer.blender.org/D1151
2015-03-01 10:27:53 +01:00
887fad6a01 Fix T39879: extra UV seams where meshes overlap.
This is not a bug, in fact, but imho we do not need to compare exactness of values
up to the 6th decimal, 4th decimal should be enough, and will avoid such cases of
"over generation" of data...
2014-05-11 22:01:41 +02:00
fa5cbcd02b Fix T39487: Index Of Refraction when export to obj
Patch by Zer0 (vince), many thanks! :)
2014-03-28 18:11:50 +01:00
7af67ead20 reduce dict lookups for uv and normal export 2013-10-05 03:11:59 +00:00
dff0d9cd6d Fix [#36848] .obj exporter messes objects normals
(Hopefully!) Logic behind normals export indices was indeed wrong when using several objects (at least, not matching vertex/uv ones).
2013-09-29 07:47:11 +00:00
18a9f89287 OBJ export: export split normals when "Include Normals" is checked (help keep sharp edges...). 2013-09-13 12:04:40 +00:00
f0986beef3 Update to OBJ exporter: now you can choose wether to export smooth groups IDs as simple values or as bitflags. 2013-09-02 18:34:31 +00:00
956f1792ec fix [#36432] Exporting obj with normalmap creates opacity map in the mtl file instead
- r3954/patch [#32914], introduced incorrect displacement map name, corrected.
- added support for reading displacement maps.
- remove checks that added alpha support for diffuce images, OBJ has alpha material settings for this.
2013-08-21 08:21:01 +00:00
62e312690a add support for writing smooth groups for OBJ 2013-06-14 10:48:48 +00:00
e7e74d4d63 correct exporing of loose edges, obj spec defines faces as needing at least 3 verts (even though 2 vertex faces are in fact quite common).
now export these as lines.
2013-06-14 05:15:39 +00:00