diff --git a/rigify/__init__.py b/rigify/__init__.py index 8565a67db37b92acc8ff47fd94c2f43a6ef06aeb..4a431e3a1f12c026df703edd926b6e2631bf4e53 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -125,9 +125,10 @@ def register(): 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 @@ def unregister(): 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() diff --git a/rigify/ui.py b/rigify/ui.py index 5af4122bab12e85cb08b25af77d9c948c7e05ea3..a27d319bcc497d19bed488aa685eb5022fb2c3eb 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -45,39 +45,40 @@ class DATA_PT_rigify_buttons(bpy.types.Panel): 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 @@ class BONE_PT_rigify_buttons(bpy.types.Panel): 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 != "":