Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-01-21 02:21:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-01-21 02:21:07 +0300
commitb688facc4fad5159bee7bb7717cd5bca5b34c983 (patch)
tree88d20a72de1ddf88cdf41450287ce9092cba9897 /io_scene_fbx
parent04768630761ef536306b831395e354c9d13fa884 (diff)
sort materials so we get predictable output from blender, also add option not to include dates in files.
Diffstat (limited to 'io_scene_fbx')
-rw-r--r--io_scene_fbx/__init__.py1
-rw-r--r--io_scene_fbx/export_fbx.py13
2 files changed, 10 insertions, 4 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index b04289d4..28129b69 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -79,6 +79,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
BATCH_GROUP = BoolProperty(name="Group > File", description="Export each group as an FBX file, if false, export each scene as an FBX file", default=False)
BATCH_OWN_DIR = BoolProperty(name="Own Dir", description="Create a dir for each exported file", default=True)
BATCH_FILE_PREFIX = StringProperty(name="Prefix", description="Prefix each file with this name", maxlen=1024, default="")
+ use_metadata = BoolProperty(name="Use Metadata", default=True, options={'HIDDEN'})
def execute(self, context):
import math
diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py
index 1971d63c..be9cdfef 100644
--- a/io_scene_fbx/export_fbx.py
+++ b/io_scene_fbx/export_fbx.py
@@ -265,7 +265,8 @@ def save(operator, context, filepath="",
BATCH_ENABLE=False,
BATCH_GROUP=True,
BATCH_FILE_PREFIX='',
- BATCH_OWN_DIR=False
+ BATCH_OWN_DIR=False,
+ use_metadata=True,
):
#XXX, missing arg
@@ -557,7 +558,7 @@ def save(operator, context, filepath="",
# ---------------------------- Write the header first
file.write(header_comment)
- if time:
+ if use_metadata:
curtime = time.localtime()[0:6]
else:
curtime = (0, 0, 0, 0, 0, 0)
@@ -2036,6 +2037,10 @@ def save(operator, context, filepath="",
my_mesh.blenMaterialList = mats
my_mesh.blenTextures = list(texture_mapping_local.keys())
+ # sort the name so we get pradictable output, some items may be NULL
+ my_mesh.blenMaterials.sort(key=lambda m: (getattr(m[0], "name", ""), getattr(m[1], "name", "")))
+ my_mesh.blenTextures.sort(key=lambda m: getattr(m, "name", ""))
+
# if only 1 null texture then empty the list
if len(my_mesh.blenTextures) == 1 and my_mesh.blenTextures[0] is None:
my_mesh.blenTextures = []
@@ -2163,8 +2168,8 @@ def save(operator, context, filepath="",
materials = [(sane_matname(mat_tex_pair), mat_tex_pair) for mat_tex_pair in materials.keys()]
textures = [(sane_texname(tex), tex) for tex in textures.keys() if tex]
- materials.sort() # sort by name
- textures.sort()
+ materials.sort(key=lambda m: m[0]) # sort by name
+ textures.sort(key=lambda m: m[0])
camera_count = 8
file.write('''