[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [908] contrib/py/scripts/addons/ space_view3d_copy_attributes.py: quick update (doesn't fix things yet)

bassam kurdali bkurdali at freefactory.org
Wed Aug 11 17:57:53 CEST 2010


Revision: 908
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=908
Author:   bassamk
Date:     2010-08-11 17:57:53 +0200 (Wed, 11 Aug 2010)

Log Message:
-----------
quick update (doesn't fix things yet)

Modified Paths:
--------------
    contrib/py/scripts/addons/space_view3d_copy_attributes.py

Modified: contrib/py/scripts/addons/space_view3d_copy_attributes.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_copy_attributes.py	2010-08-11 15:31:05 UTC (rev 907)
+++ contrib/py/scripts/addons/space_view3d_copy_attributes.py	2010-08-11 15:57:53 UTC (rev 908)
@@ -41,12 +41,21 @@
         return {'FINISHED'}
     return exec_func
 
+def build_invoke(loopfunc,func):
+    '''Generator function that returns invoke functions for various operators'''
+    def invoke_func(self, context, event):
+        loopfunc(self, context, func)
+        return {'FINISHED'}
+    return invoke_func
+
 def genops(copylist, oplist, prefix, poll_func, loopfunc):
     '''Generate ops from the copy list and its associated functions '''
     for op in copylist:
         exec_func = build_exec(loopfunc,op[3])
+        invoke_func = build_invoke(loopfunc,op[3])
         opclass = type(op[0], (bpy.types.Operator,), dict(bl_idname=prefix+op[0], bl_label="Copy " +op[1], bl_description = op[2]))
         setattr(opclass, 'execute', exec_func)
+        setattr(opclass, 'invoke', invoke_func)
         setattr(opclass, 'poll', poll_func)
         #print(op[0],op[3])
         oplist.append(opclass)
@@ -144,7 +153,8 @@
                 ('POSE_CON', "Object Constraints", "Copy Object Constraints from Active to Selected",pConExec),
                 ('POSE_IKS', "IK Limits","Copy IK Limits from Active to Selected",pIKsExec))
 
-def pose_poll_func(self, context):
+ at classmethod
+def pose_poll_func(cls, context):
     return(context.mode == 'POSE')
 
 pose_ops=[] #list of pose mode copy operators
@@ -319,7 +329,8 @@
                 ('OBJ_MOD', "Modifiers","Copy Modifiers from Active to Selected",obMod),
                 ('OBJ_WEI', "Vertex Weights","Copy vertex weights based on indices",obWei))
 
-def object_poll_func(self, context):
+ at classmethod
+def object_poll_func(cls, context):
     return(len(context.selected_objects) > 1)
 
 object_ops = []




More information about the Bf-extensions-cvs mailing list