[Bf-extensions-cvs] [7d34c607] master: animation_animall: initial update 2.8 series

meta-androcto noreply at git.blender.org
Sun Aug 11 08:09:15 CEST 2019


Commit: 7d34c60774ca70c04bc3206b34f511d536470742
Author: meta-androcto
Date:   Sun Aug 11 16:08:52 2019 +1000
Branches: master
https://developer.blender.org/rBAC7d34c60774ca70c04bc3206b34f511d536470742

animation_animall: initial update 2.8 series

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

M	animation_animall.py

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

diff --git a/animation_animall.py b/animation_animall.py
index d6c58cd0..92e058e9 100644
--- a/animation_animall.py
+++ b/animation_animall.py
@@ -19,9 +19,9 @@
 bl_info = {
     "name": "AnimAll",
     "author": "Daniel Salazar <zanqdo at gmail.com>",
-    "version": (0, 8, 1),
-    "blender": (2, 73, 0),
-    "location": "Tool bar > Animation tab > AnimAll",
+    "version": (0, 8, 2),
+    "blender": (2, 80, 0),
+    "location": "3D View > Toolbox > Animation tab > AnimAll",
     "description": "Allows animation of mesh, lattice, curve and surface data",
     "warning": "",
     "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
@@ -47,56 +47,61 @@ from bpy.props import (
 
 
 # Property Definitions
-
-bpy.types.WindowManager.key_shape = BoolProperty(
-    name="Shape",
-    description="Insert keyframes on active Shape Key layer",
-    default=False
+class AnimallProperties(bpy.types.PropertyGroup):
+    key_selected: BoolProperty(
+        name="Selected Only",
+        description="Insert keyframes only on selected elements",
+        default=True
+    )
+    key_shape: BoolProperty(
+        name="Shape",
+        description="Insert keyframes on active Shape Key layer",
+        default=False
     )
-bpy.types.WindowManager.key_uvs = BoolProperty(
-    name="UVs",
-    description="Insert keyframes on active UV coordinates",
-    default=False
+    key_uvs: BoolProperty(
+        name="UVs",
+        description="Insert keyframes on active UV coordinates",
+        default=False
     )
-bpy.types.WindowManager.key_ebevel = BoolProperty(
-    name="E-Bevel",
-    description="Insert keyframes on edge bevel weight",
-    default=False
+    key_ebevel: BoolProperty(
+        name="E-Bevel",
+        description="Insert keyframes on edge bevel weight",
+        default=False
     )
-bpy.types.WindowManager.key_vbevel = BoolProperty(
-    name="V-Bevel",
-    description="Insert keyframes on vertex bevel weight",
-    default=False
+    key_vbevel: BoolProperty(
+        name="V-Bevel",
+        description="Insert keyframes on vertex bevel weight",
+        default=False
     )
-bpy.types.WindowManager.key_crease = BoolProperty(
-    name="Crease",
-    description="Insert keyframes on edge creases",
-    default=False
+    key_crease: BoolProperty(
+        name="Crease",
+        description="Insert keyframes on edge creases",
+        default=False
     )
-bpy.types.WindowManager.key_vcols = BoolProperty(
-    name="V-Cols",
-    description="Insert keyframes on active Vertex Color values",
-    default=False
+    key_vcols: BoolProperty(
+        name="V-Cols",
+        description="Insert keyframes on active Vertex Color values",
+        default=False
     )
-bpy.types.WindowManager.key_vgroups = BoolProperty(
-    name="V-Groups",
-    description="Insert keyframes on active Vertex Group values",
-    default=False
+    key_vgroups: BoolProperty(
+        name="V-groups",
+        description="Insert keyframes on active Vertex group values",
+        default=False
     )
-bpy.types.WindowManager.key_points = BoolProperty(
-    name="Points",
-    description="Insert keyframes on point locations",
-    default=False
+    key_points: BoolProperty(
+        name="Points",
+        description="Insert keyframes on point locations",
+        default=False
     )
-bpy.types.WindowManager.key_radius = BoolProperty(
-    name="Radius",
-    description="Insert keyframes on point radius (Shrink/Fatten)",
-    default=False
+    key_radius: BoolProperty(
+        name="Radius",
+        description="Insert keyframes on point radius (Shrink/Fatten)",
+        default=False
     )
-bpy.types.WindowManager.key_tilt = BoolProperty(
-    name="Tilt",
-    description="Insert keyframes on point tilt",
-    default=False
+    key_tilt: BoolProperty(
+        name="Tilt",
+        description="Insert keyframes on point tilt",
+        default=False
     )
 
 
@@ -111,9 +116,9 @@ def refresh_ui_keyframes():
         pass
 
 
-def insert_key(data, key):
+def insert_key(data, key, group=''):
     try:
-        data.keyframe_insert(key)
+        data.keyframe_insert(key, group=group)
     except:
         pass
 
@@ -129,52 +134,56 @@ def delete_key(data, key):
 
 class VIEW3D_PT_animall(Panel):
     bl_space_type = 'VIEW_3D'
-    bl_region_type = 'TOOLS'
+    bl_region_type = 'UI'
     bl_category = "Animation"
     bl_label = 'AnimAll'
 
     @classmethod
     def poll(self, context):
-        if context.active_object and context.active_object.type in {'MESH', 'LATTICE', 'CURVE', 'SURFACE'}:
-            return context.active_object.type
+        return context.active_object and context.active_object.type in {'MESH', 'LATTICE', 'CURVE', 'SURFACE'}
 
     def draw(self, context):
-        Obj = context.active_object
+        obj = context.active_object
+        animall_properties = context.window_manager.animall_properties
 
         layout = self.layout
         col = layout.column(align=True)
+        row = col.row()
+        row.prop(animall_properties, "key_selected")
+        col.separator()
+
         row = col.row()
 
-        if Obj.type == 'LATTICE':
-            row.prop(context.window_manager, "key_points")
-            row.prop(context.window_manager, "key_shape")
+        if obj.type == 'LATTICE':
+            row.prop(animall_properties, "key_points")
+            row.prop(animall_properties, "key_shape")
 
-        elif Obj.type == 'MESH':
-            row.prop(context.window_manager, "key_points")
-            row.prop(context.window_manager, "key_shape")
+        elif obj.type == 'MESH':
+            row.prop(animall_properties, "key_points")
+            row.prop(animall_properties, "key_shape")
             row = col.row()
-            row.prop(context.window_manager, "key_ebevel")
-            row.prop(context.window_manager, "key_vbevel")
+            row.prop(animall_properties, "key_ebevel")
+            row.prop(animall_properties, "key_vbevel")
             row = col.row()
-            row.prop(context.window_manager, "key_crease")
-            row.prop(context.window_manager, "key_uvs")
+            row.prop(animall_properties, "key_crease")
+            row.prop(animall_properties, "key_uvs")
             row = col.row()
-            row.prop(context.window_manager, "key_vcols")
-            row.prop(context.window_manager, "key_vgroups")
+            row.prop(animall_properties, "key_vcols")
+            row.prop(animall_properties, "key_vgroups")
 
-        elif Obj.type == 'CURVE':
-            row.prop(context.window_manager, "key_points")
-            row.prop(context.window_manager, "key_shape")
+        elif obj.type == 'CURVE':
+            row.prop(animall_properties, "key_points")
+            row.prop(animall_properties, "key_shape")
             row = col.row()
-            row.prop(context.window_manager, "key_radius")
-            row.prop(context.window_manager, "key_tilt")
+            row.prop(animall_properties, "key_radius")
+            row.prop(animall_properties, "key_tilt")
 
-        elif Obj.type == 'SURFACE':
-            row.prop(context.window_manager, "key_points")
-            row.prop(context.window_manager, "key_shape")
+        elif obj.type == 'SURFACE':
+            row.prop(animall_properties, "key_points")
+            row.prop(animall_properties, "key_shape")
             row = col.row()
-            row.prop(context.window_manager, "key_radius")
-            row.prop(context.window_manager, "key_tilt")
+            row.prop(animall_properties, "key_radius")
+            row.prop(animall_properties, "key_tilt")
 
         layout.separator()
         row = layout.row(align=True)
@@ -183,26 +192,26 @@ class VIEW3D_PT_animall(Panel):
         row = layout.row()
         row.operator("anim.clear_animation_animall", icon="X")
 
-        if context.window_manager.key_shape:
-            ShapeKey = Obj.active_shape_key
-            ShapeKeyIndex = Obj.active_shape_key_index
+        if animall_properties.key_shape:
+            shape_key = obj.active_shape_key
+            shape_key_index = obj.active_shape_key_index
 
             split = layout.split()
             row = split.row()
 
-            if ShapeKeyIndex > 0:
-                row.label(text=ShapeKey.name, icon="SHAPEKEY_DATA")
-                row.prop(ShapeKey, "value", text="")
-                row.prop(Obj, "show_only_shape_key", text="")
-                if ShapeKey.value < 1:
+            if shape_key_index > 0:
+                row.label(text=shape_key.name, icon="SHAPEKEY_DATA")
+                row.prop(shape_key, "value", text="")
+                row.prop(obj, "show_only_shape_key", text="")
+                if shape_key.value < 1:
                     row = layout.row()
-                    row.label(text='Maybe set "%s" to 1.0?' % ShapeKey.name, icon="INFO")
-            elif ShapeKey:
-                row.label(text="Can not key on Basis Shape", icon="ERROR")
+                    row.label(text='Maybe set "%s" to 1.0?' % shape_key.name, icon="INFO")
+            elif shape_key:
+                row.label(text="Cannot key on Basis Shape", icon="ERROR")
             else:
                 row.label(text="No active Shape Key", icon="ERROR")
 
-        if context.window_manager.key_points and context.window_manager.key_shape:
+        if animall_properties.key_points and animall_properties.key_shape:
             row = layout.row()
             row.label(text='"Points" and "Shape" are redundant?', icon="INFO")
 
@@ -219,119 +228,104 @@ class ANIM_OT_insert_keyframe_animall(Operator):
         return {'FINISHED'}
 
     def execute(op, context):
-        Obj = context.active_object
-
-        if Obj.type == 'MESH':
-            Mode = False
-            if context.mode == 'EDIT_MESH':
-                Mode = not Mode
-                bpy.ops.object.editmode_toggle()
-
-            Data = Obj.data
-
-            if context.window_manager.key_shape:
-                if Obj.active_shape_key_index > 0:
-                    for Vert in Obj.active_shape_key.data:
-                        insert_key(Vert, 'co')
-
-            if context.window_manager.key_points:
-                for Vert in Data.vertices:
-               

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list