[Bf-extensions-cvs] [8e6a2be] master: Another Great Breackthrough in FBX Ugliness: properties seem to have complete different signature when they are animatable or not!

Bastien Montagne noreply at git.blender.org
Fri Mar 28 17:43:38 CET 2014


Commit: 8e6a2bec15236351533b392be265d9feb75e873c
Author: Bastien Montagne
Date:   Fri Mar 28 17:40:28 2014 +0100
https://developer.blender.org/rBA8e6a2bec15236351533b392be265d9feb75e873c

Another Great Breackthrough in FBX Ugliness: properties seem to have complete different signature when they are animatable or not!

E.g.: for double properties, non-animatable will be ("double", "Number", ""), while animatable ones will be ("Number", "", "A"). Yep, looks like a good old flag is not enough...

Btw, this still does not fix animation issue (since Lcl Translation & co are not affected by this, they seem to always be animatable...).

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

M	io_scene_fbx/export_fbx_bin.py

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

diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index cdaed18..c122d0c 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -363,17 +363,20 @@ FBX_PROPERTIES_DEFINITIONS = {
     "p_bool": (b"bool", b"", "add_int32"),  # Yes, int32 for a bool (and they do have a core bool type)!!!
     "p_integer": (b"int", b"Integer", "add_int32"),
     "p_ulonglong": (b"ULongLong", b"", "add_int64"),
+    "p_double": (b"double", b"Number", "add_float64"),  # Non-animatable?
+    "p_number": (b"Number", b"", "add_float64"),  # Animatable-only?
     "p_enum": (b"enum", b"", "add_int32"),
-    "p_number": (b"double", b"Number", "add_float64"),
     "p_visibility": (b"Visibility", b"", "add_float64"),
     "p_fov": (b"FieldOfView", b"", "add_float64"),
     "p_fov_x": (b"FieldOfViewX", b"", "add_float64"),
     "p_fov_y": (b"FieldOfViewY", b"", "add_float64"),
-    "p_vector_3d": (b"Vector3D", b"Vector", "add_float64", "add_float64", "add_float64"),
+    "p_vector_3d": (b"Vector3D", b"Vector", "add_float64", "add_float64", "add_float64"),  # Non-animatable?
+    "p_vector": (b"Vector", b"", "add_float64", "add_float64", "add_float64"),  # Animatable-only?
     "p_lcl_translation": (b"Lcl Translation", b"", "add_float64", "add_float64", "add_float64"),
     "p_lcl_rotation": (b"Lcl Rotation", b"", "add_float64", "add_float64", "add_float64"),
     "p_lcl_scaling": (b"Lcl Scaling", b"", "add_float64", "add_float64", "add_float64"),
-    "p_color_rgb": (b"ColorRGB", b"Color", "add_float64", "add_float64", "add_float64"),
+    "p_color_rgb": (b"ColorRGB", b"Color", "add_float64", "add_float64", "add_float64"),  # Non-animatable?
+    "p_color": (b"Color", b"", "add_float64", "add_float64", "add_float64"),  # Animatable-only?
     "p_string": (b"KString", b"", "add_string_unicode"),
     "p_string_url": (b"KString", b"Url", "add_string_unicode"),
     "p_timestamp": (b"KTime", b"Time", "add_int64"),
@@ -503,10 +506,10 @@ def fbx_template_def_model(scene, settings, override_defaults=None, nbr_users=0)
         (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_number", False)),
-        (b"RotationStiffnessY", (0.0, "p_number", False)),
-        (b"RotationStiffnessZ", (0.0, "p_number", False)),
-        (b"AxisLen", (10.0, "p_number", 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)),
@@ -531,21 +534,21 @@ def fbx_template_def_model(scene, settings, override_defaults=None, nbr_users=0)
         (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", (Vector((1.0, 1.0, 1.0)) * gscale, "p_vector_3d", False)),
-        (b"MinDampRangeX", (0.0, "p_number", False)),
-        (b"MinDampRangeY", (0.0, "p_number", False)),
-        (b"MinDampRangeZ", (0.0, "p_number", False)),
-        (b"MaxDampRangeX", (0.0, "p_number", False)),
-        (b"MaxDampRangeY", (0.0, "p_number", False)),
-        (b"MaxDampRangeZ", (0.0, "p_number", False)),
-        (b"MinDampStrengthX", (0.0, "p_number", False)),
-        (b"MinDampStrengthY", (0.0, "p_number", False)),
-        (b"MinDampStrengthZ", (0.0, "p_number", False)),
-        (b"MaxDampStrengthX", (0.0, "p_number", False)),
-        (b"MaxDampStrengthY", (0.0, "p_number", False)),
-        (b"MaxDampStrengthZ", (0.0, "p_number", False)),
-        (b"PreferedAngleX", (0.0, "p_number", False)),
-        (b"PreferedAngleY", (0.0, "p_number", False)),
-        (b"PreferedAngleZ", (0.0, "p_number", 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)),
@@ -571,7 +574,7 @@ def fbx_template_def_light(scene, settings, override_defaults=None, nbr_users=0)
         (b"Color", ((1.0, 1.0, 1.0), "p_color_rgb", True)),
         (b"Intensity", (100.0, "p_number", True)),  # Times 100 compared to Blender values...
         (b"DecayType", (2, "p_enum", False)),  # Quadratic.
-        (b"DecayStart", (30.0 * gscale, "p_number", False)),
+        (b"DecayStart", (30.0 * gscale, "p_double", False)),
         (b"CastShadows", (True, "p_bool", False)),
         (b"ShadowColor", ((0.0, 0.0, 0.0), "p_color_rgb", True)),
         (b"AreaLightShape", (0, "p_enum", False)),  # Rectangle.
@@ -615,29 +618,29 @@ def fbx_template_def_material(scene, settings, override_defaults=None, nbr_users
         (b"ShadingModel", ("phong", "p_string", False)),
         (b"MultiLayer", (False, "p_bool", False)),
         # Lambert-specific.
-        (b"EmissiveColor", ((0.8, 0.8, 0.8), "p_color_rgb", True)),  # Same as diffuse.
+        (b"EmissiveColor", ((0.8, 0.8, 0.8), "p_color", True)),  # Same as diffuse.
         (b"EmissiveFactor", (0.0, "p_number", True)),
-        (b"AmbientColor", ((0.0, 0.0, 0.0), "p_color_rgb", True)),
+        (b"AmbientColor", ((0.0, 0.0, 0.0), "p_color", True)),
         (b"AmbientFactor", (1.0, "p_number", True)),
-        (b"DiffuseColor", ((0.8, 0.8, 0.8), "p_color_rgb", True)),
+        (b"DiffuseColor", ((0.8, 0.8, 0.8), "p_color", True)),
         (b"DiffuseFactor", (0.8, "p_number", True)),
-        (b"TransparentColor", ((0.8, 0.8, 0.8), "p_color_rgb", True)),  # Same as diffuse.
+        (b"TransparentColor", ((0.8, 0.8, 0.8), "p_color", True)),  # Same as diffuse.
         (b"TransparencyFactor", (0.0, "p_number", True)),
         (b"Opacity", (1.0, "p_number", True)),
         (b"NormalMap", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
         (b"Bump", ((0.0, 0.0, 0.0), "p_vector_3d", False)),
-        (b"BumpFactor", (1.0, "p_number", False)),
+        (b"BumpFactor", (1.0, "p_double", False)),
         (b"DisplacementColor", ((0.0, 0.0, 0.0), "p_color_rgb", False)),
-        (b"DisplacementFactor", (0.0, "p_number", False)),
+        (b"DisplacementFactor", (0.0, "p_double", False)),
         # Phong-specific.
-        (b"SpecularColor", ((1.0, 1.0, 1.0), "p_color_rgb", True)),
+        (b"SpecularColor", ((1.0, 1.0, 1.0), "p_color", True)),
         (b"SpecularFactor", (0.5 / 2.0, "p_number", True)),
         # Not sure about the name, importer uses this (but ShininessExponent for tex prop name!)
         # And in fbx exported by sdk, you have one in template, the other in actual material!!! :/
         # For now, using both.
         (b"Shininess", ((50.0 - 1.0) / 5.10, "p_number", True)),
         (b"ShininessExponent", ((50.0 - 1.0) / 5.10, "p_number", True)),
-        (b"ReflectionColor", ((1.0, 1.0, 1.0), "p_color_rgb", True)),
+        (b"ReflectionColor", ((1.0, 1.0, 1.0), "p_color", True)),
         (b"ReflectionFactor", (0.0, "p_number", True)),
     ))
     if override_defaults is not None:
@@ -651,7 +654,7 @@ def fbx_template_def_texture_file(scene, settings, override_defaults=None, nbr_u
     props = OrderedDict((
         (b"TextureTypeUse", (0, "p_enum", False)),  # Standard.
         (b"AlphaSource", (2, "p_enum", False)),  # Black (i.e. texture's alpha), XXX name guessed!.
-        (b"Texture alpha", (1.0, "p_number", False)),
+        (b"Texture alpha", (1.0, "p_double", False)),
         (b"PremultiplyAlpha", (False, "p_bool", False)),
         (b"CurrentTextureBlendMode", (0, "p_enum", False)),  # Translucent, assuming this means "Alpha over"!
         (b"CurrentMappingType", (1, "p_enum", False)),  # Planar.
@@ -684,14 +687,14 @@ def fbx_template_def_video(scene, settings, override_defaults=None, nbr_users=0)
         (b"StartFrame", (0, "p_integer", False)),
         (b"StopFrame", (0, "p_integer", False)),
         (b"Offset", (0, "p_timestamp", False)),
-        (b"PlaySpeed", (1.0, "p_number", False)),
+        (b"PlaySpeed", (1.0, "p_double", False)),
         (b"FreeRunning", (False, "p_bool", False)),
         (b"Loop", (False, "p_bool", False)),
         (b"InterlaceMode", (0, "p_enum", False)),  # None, i.e. progressive.
         # Image sequences.
         (b"ImageSequence", (False, "p_bool", False)),
         (b"ImageSequenceOffset", (0, "p_integer", False)),
-        (b"FrameRate", (scene.render.fps / scene.render.fps_base, "p_number", False)),
+        (b"FrameRate", (scene.render.fps / scene.render.fps_base, "p_double", False)),
         (b"LastFrame", (0, "p_integer", False)),
     ))
     if override_defaults is not None:
@@ -732,7 +735,7 @@ def fbx_template_def_animlayer(scene, settings, override_defaults=None, nbr_user
         (b"Mute", (False, "p_bool", False)),
         (b"Solo", (False, "p_bool", False)),
         (b"Lock", (False, "p_bool", False)),
-        (b"Color", ((0.8, 0.8, 0.8), "p_color_rgb", True)),
+        (b"Color", ((0.8, 0.8, 0.8), "p_color_rgb", False)),
         (b"BlendMode", (0, "p_enum", False)),
         (b"RotationAccumulationMode", (0, "p_enum", False)),
         (b"ScaleAccumulationMode", (0

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list