diff options
author | Nathan Vegdahl <cessen@cessen.com> | 2011-06-19 00:41:43 +0400 |
---|---|---|
committer | Nathan Vegdahl <cessen@cessen.com> | 2011-06-19 00:41:43 +0400 |
commit | 1a3f4c4c6af16a3214c9dd3847590b87c580c11a (patch) | |
tree | 546eadd221be849884ac0adb00829f70fa71272c /rigify/ui.py | |
parent | 83840e5713eaeaf3b8ec0c779d0dffe8666cd85c (diff) |
Rigify: users can now specify layer names in the metarig armature properties.
The layer names are then used in creating the custom rig layer UI. This is
useful for users that do not want to--or do not have the knowledge to--edit
the generated python script by hand. It is also handy even for more advanced
users when regerating the rig over and over (which over-writes the script
and any hand-made edits).
Also misc bug fixes in some of the rig types.
Diffstat (limited to 'rigify/ui.py')
-rw-r--r-- | rigify/ui.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/rigify/ui.py b/rigify/ui.py index a751cfe9..eafa9679 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -81,6 +81,46 @@ class DATA_PT_rigify_buttons(bpy.types.Panel): op.metarig_type = id_store.rigify_types[id_store.rigify_active_type].name +class DATA_PT_rigify_layer_names(bpy.types.Panel): + bl_label = "Rigify Layer Names" + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = "data" + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + if not context.armature: + return False + #obj = context.object + #if obj: + # return (obj.mode in ('POSE', 'OBJECT', 'EDIT')) + #return False + return True + + def draw(self, context): + C = context + layout = self.layout + obj = context.object + + if len(obj.data.rigify_props) < 1: + obj.data.rigify_props.add() + + for i in range(28): + if (i % 16) == 0: + col = layout.column() + if i == 0: + col.label(text="Top Row:") + else: + col.label(text="Bottom Row:") + if (i % 8) == 0: + col = layout.column(align=True) + row = col.row() + row.prop(obj.data, "layers", index=i, text="", toggle=True) + row.prop(obj.data.rigify_props[0], "layer_name_%s" % str(i+1).rjust(2, "0"), text="Layer %d" % (i + 1)) + + + class BONE_PT_rigify_buttons(bpy.types.Panel): bl_label = "Rigify Type" bl_space_type = 'PROPERTIES' @@ -243,6 +283,7 @@ class Sample(bpy.types.Operator): #from bl_ui import space_info # ensure the menu is loaded first def register(): + bpy.utils.register_class(DATA_PT_rigify_layer_names) bpy.utils.register_class(DATA_PT_rigify_buttons) bpy.utils.register_class(BONE_PT_rigify_buttons) bpy.utils.register_class(Generate) @@ -252,6 +293,7 @@ def register(): def unregister(): + bpy.utils.unregister_class(DATA_PT_rigify_layer_names) bpy.utils.unregister_class(DATA_PT_rigify_buttons) bpy.utils.unregister_class(BONE_PT_rigify_buttons) bpy.utils.unregister_class(Generate) |