Age | Commit message (Collapse) | Author |
|
|
|
Silly mistake in recent addition of Cycles basic material import...
|
|
Applying a matrix with non-uniform negative scaling to a mesh requires
normals (face winfing) to be inverted back to their original orientation!
|
|
This code uses same wrapper as FBX importer to generate a basic nodal
shader for Cycles material.
Note that not all MTL features are supported, some might be possible to
add later though.
|
|
|
|
|
|
|
|
This reverts rBAc553d7c0eb002a02e7, not actually sure why this change in
precision of actually written value was done.
|
|
OBJ/MTL does not support spaces in filenames, but... users keep using them - and other exporters
keep failing at being smart for the user here (like, replacing spaces with underscore etc.)...
So now, when last part of a texture line is not giving any valid found image, we try backward
adding more pieces to image filename until we find some existing file (hopefully).
But again: please do not use spaces in filenames for OBJ, **THIS IS NOT SUPPORTED**!
|
|
|
|
These values are always rounded to 4 decimal places so no need to write 6.
|
|
When an MTL made multiple references to the same image,
it would create a new data-block for each reference.
|
|
Actually, think that's not valid OBJ (using '0' index instead of nothing when not assigning data to some face corner).
But since supporting this is easy...
|
|
|
|
Missed this in recent bytes -> string conversion
|
|
Invalid triangles were being detected as faces that looped back on themselves and had their edges dissolved.
Now ignore invalid triangles entirely since they will never end up as faces in Blender.
|
|
Workaround for a bug in Python3.5,
however bytes on win32 are deprecated so better not use them for file access at all.
|
|
Missing import of Vector...
|
|
Blender was sharing UV's for all vertices,
while this is correct it was causing issues for Maya, 3ds Max & Unfold3D.
|
|
|
|
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.
|
|
duplis...
To be backported, should we need an 'a' release.
|
|
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.
|
|
Own stupid mistake with recent refactor of handling of partial missing indices of vnor/uvtex for face.
Also, do not use '0' as special 'missing' value here, this is really brittle.
Now using ellipsis instead, a bit more verbose but should be 100% safe.
And fix one or two glitches from yesterday's changes too.
|
|
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! :)
|
|
'map_Ks' is for specularity color, not secularity intensity
(which seems to have no equivalent in OBJ).
|
|
split-import case.
In case some parts have UVs and others not, when doing split import we have to
avoid creating empty dummy UV layers for meshes that have no 'tex' data in .obj.
Same goes for clnors.
|
|
|
|
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.
|
|
|
|
rBAbfbabc0592b8.
Now using a class factory to allow customization of those defaults axes, still way less
verbose than previous code!
|
|
In fact, it's the OBJ file which is utterly broken (thousands of faces reusing the same vertex...).
I think 'breakage' comes actually from change in bmesh (raising error when trying to get
an edge with same vert in both items of the key), afaiks this is not different from
old code in current importer.
Anyway, working around this is easy and cheap, so...
To be backported in final 2.74.
|
|
|
|
Stupid mistake in own recent work on OBJ...
|
|
Caused by rBc755d8fbb520fbcf2a, can understand we want a 'good' (sigh) naming
before release, but please ensure code already using it is updated then...
|
|
|
|
|
|
Reviewers: mont29
Projects: #import_export
Differential Revision: https://developer.blender.org/D1151
|
|
Issue reported by Daniel Salazar (ZanQdo) through IRC, thanks!
|
|
Makes code nicer, but adds between 10 and 15% to parsing time... Not worth it.
|
|
tessellate/untessellate sometimes.
Issue comes with ngons having holes (i.e. ngons using the same edge more than once).
This is not supported in Blender, so we have to 'work around' it.
However, we can limit this behavior to ngons actually 'blender-invalid', no need to
do that systematically.
So this commit still allows for much better performances with 'usual' ngons.
Those with holes get back to previous performances, more or less.
Many thanks to Campbell for the headup!
|
|
Note I tried to make 'face' tuple a namedtuple, but this makes things significantly
slower here (about ten percents), don't think it's worth it.
|
|
|
|
Not much to say, pretty similar to how FBX custom normals import works...
|
|
This is the main and best way to export complex shading...
|
|
That code was doing some rather crazy things, like:
* tessellating ngons, and un-tesselate them later;
* use up to two bmesh transformations for each imported mesh;
* ...
Now, removed the 'use_ngons' option and all the tesselated mess,
we always only work in polygon context, user can triangulate later if really needed.
Got rid of all bmesh stuff.
Also, some cleanup of 'old' fashioned code, like e.g. converting dict views to list
before iterating on those...
With pure-tessellated .obj, we gain nearly nothing (about 5% quicker - and much nicer code).
With .obj containing a fair amount of ngons, we devide import time by six!
E.g. with a test mesh of 475000 polygons (1100000 triangles), we go from 60 seconds (old code)
to less than 10 seconds with new code!
|
|
Python 3.4.0 deprecated the "imp" module, and replaced it with
"importlib". This changes imp.reload() into implib.reload().
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D1016
|
|
|