[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1308] trunk/py/scripts/addons/rigify: fix for rigify with data editing restriction, store runtime props in the window manager.

Campbell Barton ideasman42 at gmail.com
Thu Dec 23 01:21:49 CET 2010


Revision: 1308
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1308
Author:   campbellbarton
Date:     2010-12-23 01:21:49 +0100 (Thu, 23 Dec 2010)

Log Message:
-----------
fix for rigify with data editing restriction, store runtime props in the window manager.

Modified Paths:
--------------
    trunk/py/scripts/addons/rigify/__init__.py
    trunk/py/scripts/addons/rigify/ui.py

Modified: trunk/py/scripts/addons/rigify/__init__.py
===================================================================
--- trunk/py/scripts/addons/rigify/__init__.py	2010-12-22 23:24:36 UTC (rev 1307)
+++ trunk/py/scripts/addons/rigify/__init__.py	2010-12-23 00:21:49 UTC (rev 1308)
@@ -125,9 +125,10 @@
     bpy.types.PoseBone.rigify_type = bpy.props.StringProperty(name="Rigify Type", description="Rig type for this bone.")
     bpy.types.PoseBone.rigify_parameters = bpy.props.CollectionProperty(type=RigifyParameters)
 
-    bpy.types.Scene.rigify_collection = bpy.props.EnumProperty(items=col_enum_list, default="All", name="Rigify Active Collection", description="The selected rig collection")
-    bpy.types.Scene.rigify_types = bpy.props.CollectionProperty(type=RigifyName)
-    bpy.types.Scene.rigify_active_type = bpy.props.IntProperty(name="Rigify Active Type", description="The selected rig type.")
+    IDStore = bpy.types.WindowManager
+    IDStore.rigify_collection = bpy.props.EnumProperty(items=col_enum_list, default="All", name="Rigify Active Collection", description="The selected rig collection")
+    IDStore.rigify_types = bpy.props.CollectionProperty(type=RigifyName)
+    IDStore.rigify_active_type = bpy.props.IntProperty(name="Rigify Active Type", description="The selected rig type.")
 
     metarig_menu.register()
 
@@ -136,9 +137,10 @@
     del bpy.types.PoseBone.rigify_type
     del bpy.types.PoseBone.rigify_parameters
 
-    del bpy.types.Scene.rigify_collection
-    del bpy.types.Scene.rigify_types
-    del bpy.types.Scene.rigify_active_type
+    IDStore = bpy.types.WindowManager
+    del IDStore.rigify_collection
+    del IDStore.rigify_types
+    del IDStore.rigify_active_type
 
     metarig_menu.unregister()
 

Modified: trunk/py/scripts/addons/rigify/ui.py
===================================================================
--- trunk/py/scripts/addons/rigify/ui.py	2010-12-22 23:24:36 UTC (rev 1307)
+++ trunk/py/scripts/addons/rigify/ui.py	2010-12-23 00:21:49 UTC (rev 1308)
@@ -45,39 +45,40 @@
         C = context
         layout = self.layout
         obj = context.object
+        id_store = C.window_manager
 
         if obj.mode in ('POSE', 'OBJECT'):
             row = layout.row()
             row.operator("pose.rigify_generate", text="Generate")
         elif obj.mode == 'EDIT':
             # Build types list
-            collection_name = str(C.scene.rigify_collection).replace(" ", "")
+            collection_name = str(id_store.rigify_collection).replace(" ", "")
 
-            for i in range(0, len(C.scene.rigify_types)):
-                C.scene.rigify_types.remove(0)
+            for i in range(0, len(id_store.rigify_types)):
+                id_store.rigify_types.remove(0)
 
             for r in rigify.rig_list:
                 collection = r.split('.')[0]
                 if collection_name == "All":
-                    a = C.scene.rigify_types.add()
+                    a = id_store.rigify_types.add()
                     a.name = r
                 elif r.startswith(collection_name + '.'):
-                    a = C.scene.rigify_types.add()
+                    a = id_store.rigify_types.add()
                     a.name = r
                 elif collection_name == "None" and len(r.split('.')) == 1:
-                    a = C.scene.rigify_types.add()
+                    a = id_store.rigify_types.add()
                     a.name = r
 
             ## Rig collection field
             #row = layout.row()
-            #row.prop(C.scene, 'rigify_collection', text="Category")
+            #row.prop(id_store, 'rigify_collection', text="Category")
 
             # Rig type list
             row = layout.row()
-            row.template_list(C.scene, "rigify_types", C.scene, 'rigify_active_type')
+            row.template_list(id_store, "rigify_types", id_store, 'rigify_active_type')
             row = layout.row()
             op = row.operator("armature.metarig_sample_add", text="Add sample")
-            op.metarig_type = C.scene.rigify_types[C.scene.rigify_active_type].name
+            op.metarig_type = id_store.rigify_types[id_store.rigify_active_type].name
 
 
 class BONE_PT_rigify_buttons(bpy.types.Panel):
@@ -98,31 +99,32 @@
 
     def draw(self, context):
         C = context
+        id_store = C.window_manager
         bone = context.active_pose_bone
-        collection_name = str(C.scene.rigify_collection).replace(" ", "")
+        collection_name = str(id_store.rigify_collection).replace(" ", "")
         rig_name = str(context.active_pose_bone.rigify_type).replace(" ", "")
 
         layout = self.layout
 
         # Build types list
-        for i in range(0, len(C.scene.rigify_types)):
-            C.scene.rigify_types.remove(0)
+        for i in range(0, len(id_store.rigify_types)):
+            id_store.rigify_types.remove(0)
 
         for r in rigify.rig_list:
             collection = r.split('.')[0]
             if collection_name == "All":
-                a = C.scene.rigify_types.add()
+                a = id_store.rigify_types.add()
                 a.name = r
             elif r.startswith(collection_name + '.'):
-                a = C.scene.rigify_types.add()
+                a = id_store.rigify_types.add()
                 a.name = r
             elif collection_name == "None" and len(r.split('.')) == 1:
-                a = C.scene.rigify_types.add()
+                a = id_store.rigify_types.add()
                 a.name = r
 
         # Rig type field
         row = layout.row()
-        row.prop_search(bone, "rigify_type", C.scene, "rigify_types", text="Rig type:")
+        row.prop_search(bone, "rigify_type", id_store, "rigify_types", text="Rig type:")
 
         # Rig type parameters / Rig type non-exist alert
         if rig_name != "":




More information about the Bf-extensions-cvs mailing list