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
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
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.
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.
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.
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.
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!
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...).
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! :)
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.
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...
- 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.