[Bf-extensions-cvs] [e9975d4] master: Push Animation Tools
Eugenio Pignataro
noreply at git.blender.org
Thu Nov 20 19:20:02 CET 2014
Commit: e9975d494fbe9456dbdf148a35f9282d0c6193a0
Author: Eugenio Pignataro
Date: Thu Nov 20 15:19:53 2014 -0300
Branches: master
https://developer.blender.org/rBACe9975d494fbe9456dbdf148a35f9282d0c6193a0
Push Animation Tools
===================================================================
A oscurart_tools/oscurart_animation.py
===================================================================
diff --git a/oscurart_tools/oscurart_animation.py b/oscurart_tools/oscurart_animation.py
new file mode 100644
index 0000000..ad75361
--- /dev/null
+++ b/oscurart_tools/oscurart_animation.py
@@ -0,0 +1,44 @@
+import bpy
+from mathutils import Matrix
+
+##---------------------------RELOAD IMAGES------------------
+
+bpy.types.Scene.quick_animation_in = bpy.props.IntProperty(default=1)
+bpy.types.Scene.quick_animation_out = bpy.props.IntProperty(default=250)
+
+def DefQuickParent(inf,out):
+ if bpy.context.object.type == "ARMATURE":
+ ob = bpy.context.object
+ target = [object for object in bpy.context.selected_objects if object != ob][0]
+ ob = bpy.context.active_pose_bone if bpy.context.object.type == 'ARMATURE' else bpy.context.object
+ target.select = False
+ a = Matrix(target.matrix_world)
+ a.invert()
+ i = Matrix(ob.matrix)
+ for frame in range(inf,out):
+ bpy.context.scene.frame_set(frame=frame)
+ ob.matrix = target.matrix_world * a * i
+ bpy.ops.anim.keyframe_insert(type="LocRotScale")
+ else:
+ ob = bpy.context.object
+ target = [object for object in bpy.context.selected_objects if object != ob][0]
+ ob = bpy.context.active_pose_bone if bpy.context.object.type == 'ARMATURE' else bpy.context.object
+ target.select = False
+ a = Matrix(target.matrix_world)
+ a.invert()
+ i = Matrix(ob.matrix_world)
+ for frame in range(inf,out):
+ bpy.context.scene.frame_set(frame=frame)
+ ob.matrix_world = target.matrix_world * a * i
+ bpy.ops.anim.keyframe_insert(type="LocRotScale")
+
+class QuickParent (bpy.types.Operator):
+ bl_idname = "anim.quick_parent_osc"
+ bl_label = "Quick Parent"
+ bl_options = {"REGISTER", "UNDO"}
+
+ def execute(self,context):
+ DefQuickParent(bpy.context.scene.quick_animation_in,bpy.context.scene.quick_animation_out)
+ return {'FINISHED'}
+
+
More information about the Bf-extensions-cvs
mailing list