Răsfoiți Sursa

Fixed redundant exporting of animations to both "animation" and "animations" attributes, merged all animations and skeletal animation options.

Digitalis.Digitoxin 11 ani în urmă
părinte
comite
dfc85ca42b

+ 5 - 5
utils/exporters/blender/2.66/scripts/addons/io_mesh_threejs/__init__.py

@@ -222,7 +222,7 @@ def save_settings_export(properties):
     "option_scale"        : properties.option_scale,
     "option_scale"        : properties.option_scale,
 
 
     "align_model"         : properties.align_model,
     "align_model"         : properties.align_model,
-    "option_all_animation" : properties.option_all_animations
+    #"option_all_animation" : properties.option_all_animations
     }
     }
 
 
     fname = get_settings_fullpath()
     fname = get_settings_fullpath()
@@ -268,7 +268,7 @@ def restore_settings_export(properties):
 
 
     properties.option_frame_step = settings.get("option_frame_step", 1)
     properties.option_frame_step = settings.get("option_frame_step", 1)
     properties.option_all_meshes = settings.get("option_all_meshes", True)
     properties.option_all_meshes = settings.get("option_all_meshes", True)
-    properties.option_all_animations = settings.get("option_all_animations", True)
+    #properties.option_all_animations = settings.get("option_all_animations", True)
 
 
 # ################################################################
 # ################################################################
 # Exporter
 # Exporter
@@ -317,7 +317,7 @@ class ExportTHREEJS(bpy.types.Operator, ExportHelper):
 
 
     option_frame_step = IntProperty(name = "Frame step", description = "Animation frame step", min = 1, max = 1000, soft_min = 1, soft_max = 1000, default = 1)
     option_frame_step = IntProperty(name = "Frame step", description = "Animation frame step", min = 1, max = 1000, soft_min = 1, soft_max = 1000, default = 1)
     option_all_meshes = BoolProperty(name = "All meshes", description = "All meshes (merged)", default = True)
     option_all_meshes = BoolProperty(name = "All meshes", description = "All meshes (merged)", default = True)
-    option_all_animations = BoolProperty(name = "All animations", description = "All animations", default = True)
+    #option_all_animations = BoolProperty(name = "All animations", description = "All animations", default = False)
 
 
     def invoke(self, context, event):
     def invoke(self, context, event):
         restore_settings_export(self.properties)
         restore_settings_export(self.properties)
@@ -414,8 +414,8 @@ class ExportTHREEJS(bpy.types.Operator, ExportHelper):
         row = layout.row()
         row = layout.row()
         row.prop(self.properties, "option_animation_skeletal")
         row.prop(self.properties, "option_animation_skeletal")
         row = layout.row()
         row = layout.row()
-        row.prop(self.properties, "option_all_animations")
-        row = layout.row()
+        #row.prop(self.properties, "option_all_animations")
+        #row = layout.row()
         row.prop(self.properties, "option_frame_step")
         row.prop(self.properties, "option_frame_step")
         layout.separator()
         layout.separator()
 
 

+ 10 - 12
utils/exporters/blender/2.66/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -267,7 +267,6 @@ TEMPLATE_MODEL_ASCII = """\
 
 
 	"skinWeights" : [%(weights)s],
 	"skinWeights" : [%(weights)s],
 
 
-	"animation"  : {%(animation)s},
         "animations" : [%(animations)s]
         "animations" : [%(animations)s]
 """
 """
 
 
@@ -933,9 +932,9 @@ def generate_animation(option_animation_skeletal, option_frame_step, flipyz, act
 
 
     return animation_string
     return animation_string
 
 
-def generate_all_animations(option_animation_skeletal, option_frame_step, flipyz, option_all_animations):
+def generate_all_animations(option_animation_skeletal, option_frame_step, flipyz):
     all_animations_string = ""
     all_animations_string = ""
-    if option_all_animations:
+    if option_animation_skeletal:
         for index in range(0, len(bpy.data.actions)):
         for index in range(0, len(bpy.data.actions)):
             if index != 0 :
             if index != 0 :
                 all_animations_string += ", \n"
                 all_animations_string += ", \n"
@@ -1300,7 +1299,7 @@ def generate_ascii_model(meshes, morphs,
                          filepath,
                          filepath,
                          option_animation_morph,
                          option_animation_morph,
                          option_animation_skeletal,
                          option_animation_skeletal,
-                         option_all_animations,
+                         #option_all_animations,
                          option_frame_step):
                          option_frame_step):
 
 
     vertices = []
     vertices = []
@@ -1401,8 +1400,7 @@ def generate_ascii_model(meshes, morphs,
     "bones"     : bones_string,
     "bones"     : bones_string,
     "indices"   : indices_string,
     "indices"   : indices_string,
     "weights"   : weights_string,
     "weights"   : weights_string,
-    "animation" : generate_animation(option_animation_skeletal, option_frame_step, flipyz, 0),
-    "animations" : generate_all_animations(option_animation_skeletal, option_frame_step, flipyz, option_all_animations)
+    "animations" : generate_all_animations(option_animation_skeletal, option_frame_step, flipyz)
     }
     }
 
 
     text = TEMPLATE_FILE_ASCII % {
     text = TEMPLATE_FILE_ASCII % {
@@ -1485,7 +1483,7 @@ def generate_mesh_string(objects, scene,
                 filepath,
                 filepath,
                 option_animation_morph,
                 option_animation_morph,
                 option_animation_skeletal,
                 option_animation_skeletal,
-                option_all_animations,
+                #option_all_animations,
                 option_frame_step):
                 option_frame_step):
 
 
     meshes = extract_meshes(objects, scene, export_single_model, option_scale, flipyz)
     meshes = extract_meshes(objects, scene, export_single_model, option_scale, flipyz)
@@ -1550,7 +1548,7 @@ def generate_mesh_string(objects, scene,
                                 filepath,
                                 filepath,
                                 option_animation_morph,
                                 option_animation_morph,
                                 option_animation_skeletal,
                                 option_animation_skeletal,
-                                option_all_animations,
+                                #option_all_animations,
                                 option_frame_step)
                                 option_frame_step)
 
 
     # remove temp meshes
     # remove temp meshes
@@ -1578,7 +1576,7 @@ def export_mesh(objects,
                 option_copy_textures,
                 option_copy_textures,
                 option_animation_morph,
                 option_animation_morph,
                 option_animation_skeletal,
                 option_animation_skeletal,
-                option_all_animations,
+                #option_all_animations,
                 option_frame_step):
                 option_frame_step):
 
 
     """Export single mesh"""
     """Export single mesh"""
@@ -1602,7 +1600,7 @@ def export_mesh(objects,
                 filepath,
                 filepath,
                 option_animation_morph,
                 option_animation_morph,
                 option_animation_skeletal,
                 option_animation_skeletal,
-                option_all_animations,
+                #option_all_animations,
                 option_frame_step)
                 option_frame_step)
 
 
     write_file(filepath, text)
     write_file(filepath, text)
@@ -2339,7 +2337,7 @@ def save(operator, context, filepath = "",
          option_copy_textures = False,
          option_copy_textures = False,
          option_animation_morph = False,
          option_animation_morph = False,
          option_animation_skeletal = False,
          option_animation_skeletal = False,
-         option_all_animations = False,
+         #option_all_animations = False,
          option_frame_step = 1,
          option_frame_step = 1,
          option_all_meshes = True):
          option_all_meshes = True):
 
 
@@ -2463,7 +2461,7 @@ def save(operator, context, filepath = "",
                     option_copy_textures,
                     option_copy_textures,
                     option_animation_morph,
                     option_animation_morph,
                     option_animation_skeletal,
                     option_animation_skeletal,
-                    option_all_animations,
+                    #option_all_animations,
                     option_frame_step)
                     option_frame_step)
 
 
     return {'FINISHED'}
     return {'FINISHED'}