[Bf-extensions-cvs] [365f6cfc] blender2.8: FBX IO: cleanup: replace OrderedDict usages by regular py dicts.

Bastien Montagne noreply at git.blender.org
Tue Oct 16 20:01:18 CEST 2018


Commit: 365f6cfc4759dc4ef85392275b92939e0de4d02e
Author: Bastien Montagne
Date:   Tue Oct 16 17:45:01 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBA365f6cfc4759dc4ef85392275b92939e0de4d02e

FBX IO: cleanup: replace OrderedDict usages by regular py dicts.

Python dictionaries are now ordered by definition, so no need to add
extra thingy here anymore to keep our well-ordered FBX structure.

===================================================================

M	io_scene_fbx/__init__.py
M	io_scene_fbx/export_fbx_bin.py
M	io_scene_fbx/fbx_utils.py

===================================================================

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 07d8a3b2..490a2ff6 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (4, 12, 0),
+    "version": (4, 12, 1),
     "blender": (2, 80, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 165befae..b13bc978 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -27,7 +27,6 @@ import math
 import os
 import time
 
-from collections import OrderedDict
 from itertools import zip_longest, chain
 
 if "bpy" in locals():
@@ -112,7 +111,7 @@ convert_rad_to_deg_iter = units_convertor_iter("radian", "degree")
 # TODO: check all those "default" values, they should match Blender's default as much as possible, I guess?
 
 def fbx_template_def_globalsettings(scene, settings, override_defaults=None, nbr_users=0):
-    props = OrderedDict()
+    props = {}
     if override_defaults is not None:
         props.update(override_defaults)
     return FBXTemplate(b"GlobalSettings", b"", props, nbr_users, [False])
@@ -120,91 +119,91 @@ def fbx_template_def_globalsettings(scene, settings, override_defaults=None, nbr
 
 def fbx_template_def_model(scene, settings, override_defaults=None, nbr_users=0):
     gscale = settings.global_scale
-    props = OrderedDict((
-        # Name,                   Value, Type, Animatable
-        (b"QuaternionInterpolate", (0, "p_enum", False)),  # 0 = no quat interpolation.
-        (b"RotationOffset", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"RotationPivot", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"ScalingOffset", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"ScalingPivot", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"TranslationActive", (False, "p_bool", False)),
-        (b"TranslationMin", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"TranslationMax", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"TranslationMinX", (False, "p_bool", False)),
-        (b"TranslationMinY", (False, "p_bool", False)),
-        (b"TranslationMinZ", (False, "p_bool", False)),
-        (b"TranslationMaxX", (False, "p_bool", False)),
-        (b"TranslationMaxY", (False, "p_bool", False)),
-        (b"TranslationMaxZ", (False, "p_bool", False)),
-        (b"RotationOrder", (0, "p_enum", False)),  # we always use 'XYZ' order.
-        (b"RotationSpaceForLimitOnly", (False, "p_bool", False)),
-        (b"RotationStiffnessX", (0.0, "p_double", False)),
-        (b"RotationStiffnessY", (0.0, "p_double", False)),
-        (b"RotationStiffnessZ", (0.0, "p_double", False)),
-        (b"AxisLen", (10.0, "p_double", False)),
-        (b"PreRotation", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"PostRotation", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"RotationActive", (False, "p_bool", False)),
-        (b"RotationMin", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"RotationMax", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"RotationMinX", (False, "p_bool", False)),
-        (b"RotationMinY", (False, "p_bool", False)),
-        (b"RotationMinZ", (False, "p_bool", False)),
-        (b"RotationMaxX", (False, "p_bool", False)),
-        (b"RotationMaxY", (False, "p_bool", False)),
-        (b"RotationMaxZ", (False, "p_bool", False)),
-        (b"InheritType", (0, "p_enum", False)),  # RrSs
-        (b"ScalingActive", (False, "p_bool", False)),
-        (b"ScalingMin", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"ScalingMax", ((1.0, 1.0, 1.0), "p_vector_3d", False)),
-        (b"ScalingMinX", (False, "p_bool", False)),
-        (b"ScalingMinY", (False, "p_bool", False)),
-        (b"ScalingMinZ", (False, "p_bool", False)),
-        (b"ScalingMaxX", (False, "p_bool", False)),
-        (b"ScalingMaxY", (False, "p_bool", False)),
-        (b"ScalingMaxZ", (False, "p_bool", False)),
-        (b"GeometricTranslation", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"GeometricRotation", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"GeometricScaling", ((1.0, 1.0, 1.0), "p_vector_3d", False)),
-        (b"MinDampRangeX", (0.0, "p_double", False)),
-        (b"MinDampRangeY", (0.0, "p_double", False)),
-        (b"MinDampRangeZ", (0.0, "p_double", False)),
-        (b"MaxDampRangeX", (0.0, "p_double", False)),
-        (b"MaxDampRangeY", (0.0, "p_double", False)),
-        (b"MaxDampRangeZ", (0.0, "p_double", False)),
-        (b"MinDampStrengthX", (0.0, "p_double", False)),
-        (b"MinDampStrengthY", (0.0, "p_double", False)),
-        (b"MinDampStrengthZ", (0.0, "p_double", False)),
-        (b"MaxDampStrengthX", (0.0, "p_double", False)),
-        (b"MaxDampStrengthY", (0.0, "p_double", False)),
-        (b"MaxDampStrengthZ", (0.0, "p_double", False)),
-        (b"PreferedAngleX", (0.0, "p_double", False)),
-        (b"PreferedAngleY", (0.0, "p_double", False)),
-        (b"PreferedAngleZ", (0.0, "p_double", False)),
-        (b"LookAtProperty", (None, "p_object", False)),
-        (b"UpVectorProperty", (None, "p_object", False)),
-        (b"Show", (True, "p_bool", False)),
-        (b"NegativePercentShapeSupport", (True, "p_bool", False)),
-        (b"DefaultAttributeIndex", (-1, "p_integer", False)),
-        (b"Freeze", (False, "p_bool", False)),
-        (b"LODBox", (False, "p_bool", False)),
-        (b"Lcl Translation", ((0.0, 0.0, 0.0), "p_lcl_translation", True)),
-        (b"Lcl Rotation", ((0.0, 0.0, 0.0), "p_lcl_rotation", True)),
-        (b"Lcl Scaling", ((1.0, 1.0, 1.0), "p_lcl_scaling", True)),
-        (b"Visibility", (1.0, "p_visibility", True)),
-        (b"Visibility Inheritance", (1, "p_visibility_inheritance", False)),
-    ))
+    props = {
+        # Name,                  Value, Type, Animatable
+        b"QuaternionInterpolate": (0, "p_enum", False),  # 0 = no quat interpolation.
+        b"RotationOffset": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"RotationPivot": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"ScalingOffset": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"ScalingPivot": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"TranslationActive": (False, "p_bool", False),
+        b"TranslationMin": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"TranslationMax": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"TranslationMinX": (False, "p_bool", False),
+        b"TranslationMinY": (False, "p_bool", False),
+        b"TranslationMinZ": (False, "p_bool", False),
+        b"TranslationMaxX": (False, "p_bool", False),
+        b"TranslationMaxY": (False, "p_bool", False),
+        b"TranslationMaxZ": (False, "p_bool", False),
+        b"RotationOrder": (0, "p_enum", False),  # we always use 'XYZ' order.
+        b"RotationSpaceForLimitOnly": (False, "p_bool", False),
+        b"RotationStiffnessX": (0.0, "p_double", False),
+        b"RotationStiffnessY": (0.0, "p_double", False),
+        b"RotationStiffnessZ": (0.0, "p_double", False),
+        b"AxisLen": (10.0, "p_double", False),
+        b"PreRotation": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"PostRotation": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"RotationActive": (False, "p_bool", False),
+        b"RotationMin": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"RotationMax": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"RotationMinX": (False, "p_bool", False),
+        b"RotationMinY": (False, "p_bool", False),
+        b"RotationMinZ": (False, "p_bool", False),
+        b"RotationMaxX": (False, "p_bool", False),
+        b"RotationMaxY": (False, "p_bool", False),
+        b"RotationMaxZ": (False, "p_bool", False),
+        b"InheritType": (0, "p_enum", False),  # RrSs
+        b"ScalingActive": (False, "p_bool", False),
+        b"ScalingMin": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"ScalingMax": ((1.0, 1.0, 1.0), "p_vector_3d", False),
+        b"ScalingMinX": (False, "p_bool", False),
+        b"ScalingMinY": (False, "p_bool", False),
+        b"ScalingMinZ": (False, "p_bool", False),
+        b"ScalingMaxX": (False, "p_bool", False),
+        b"ScalingMaxY": (False, "p_bool", False),
+        b"ScalingMaxZ": (False, "p_bool", False),
+        b"GeometricTranslation": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"GeometricRotation": ((0.0, 0.0, 0.0), "p_vector_3d", False),
+        b"GeometricScaling": ((1.0, 1.0, 1.0), "p_vector_3d", False),
+        b"MinDampRangeX": (0.0, "p_double", False),
+        b"MinDampRangeY": (0.0, "p_double", False),
+        b"MinDampRangeZ": (0.0, "p_double", False),
+        b"MaxDampRangeX": (0.0, "p_double", False),
+        b"MaxDampRangeY": (0.0, "p_double", False),
+        b"MaxDampRangeZ": (0.0, "p_double", False),
+        b"MinDampStrengthX": (0.0, "p_double", False),
+        b"MinDampStrengthY": (0.0, "p_double", False),
+        b"MinDampStrengthZ": (0.0, "p_double", False),
+        b"MaxDampStrengthX": (0.0, "p_double", False),
+        b"MaxDampStrengthY": (0.0, "p_double", False),
+        b"MaxDampStrengthZ": (0.0, "p_double", False),
+        b"PreferedAngleX": (0.0, "p_double", False),
+        b"PreferedAngleY": (0.0, "p_double", False),
+        b"PreferedAngleZ": (0.0, "p_double", False),
+        b"LookAtProperty": (None, "p_object", False),
+        b"UpVectorProperty": (None, "p_object", False),
+        b"Show": (True, "p_bool", False),
+        b"NegativePercentShapeSupport": (True, "p_bool", False),
+        b"DefaultAttributeIndex": (-1, "p_integer", False),
+        b"Freeze": (False, "p_bool", False),
+        b"LODBox": (False, "p_bool", False),
+        b"Lcl Translation": ((0.0, 0.0, 0.0), "p_lcl_translation", True),
+        b"Lcl Rotation": ((0.0, 0.0, 0.0), "p_lcl_rotation", True),
+        b"Lcl Scaling": ((1.0, 1.0, 1.0), "p_lcl_scaling", True),
+        b"Visibility": (1.0, "p_visibility", True),
+        b"Visibility Inheritance": (1, "p_visibility_inheritance", False),
+    }
     

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list