dead
[carveJwlIkooP6JGAAIwe30JlM.git] / blender_export.py
index 515acd770322a82979dc1391b40b1a81aef3c62a..538ed6cdd69168bf32316d683daa90cfbd57deca 100644 (file)
@@ -1241,6 +1241,8 @@ def encoder_build_scene_graph( collection ):
 
       def _extend( p, n, d ):
       #{
+         nonlocal collection
+
          uid = _new_uid()
          tree = {}
          tree["uid"] = uid
@@ -1249,7 +1251,7 @@ def encoder_build_scene_graph( collection ):
          tree["obj"] = n
          tree["parent"] = p
          n.cv_data.uid = uid
-         
+
          # Descend into amature
          #
          if n.type == 'ARMATURE':
@@ -1257,6 +1259,7 @@ def encoder_build_scene_graph( collection ):
             tree["bones"] = [None] # None is the root transform
             tree["ik_count"] = 0
             tree["collider_count"] = 0
+            tree["compile_animation"] = collection.cv_data.animations
             
             # Here also collects some information about constraints, ik and 
             # counts colliders for the armature.
@@ -1305,7 +1308,6 @@ def encoder_build_scene_graph( collection ):
          #
          for obj1 in n.children:
          #{
-            nonlocal collection
             for c1 in obj1.users_collection:
             #{
                if c1 == collection:
@@ -1667,7 +1669,12 @@ def encoder_compile_armature( node, node_def ):
    # extra info
    node_def['anim_start'] = len(animdata)
    node_def['anim_count'] = 0
-   
+   if not node_def['compile_animation']:
+   #{
+      return
+   #}  
+
    # Compile anims
    #
    if obj.animation_data:
@@ -2631,6 +2638,7 @@ class CV_SCENE_SETTINGS(bpy.types.PropertyGroup):
 class CV_COLLECTION_SETTINGS(bpy.types.PropertyGroup):
 #{
    pack_textures: bpy.props.BoolProperty( name="Pack Textures", default=False )
+   animations:    bpy.props.BoolProperty( name="Export animation", default=True)
 #}
 
 class CV_MATERIAL_SETTINGS(bpy.types.PropertyGroup):
@@ -2857,6 +2865,7 @@ class CV_INTERFACE(bpy.types.Panel):
       #{
          box.label( text=col.name + ".mdl" )
          box.prop( col.cv_data, "pack_textures" )
+         box.prop( col.cv_data, "animations" )
          box.operator( "carve.compile_this" )
       #}
       else: