Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucio Rossi <lucio.rossi75@gmail.com>2017-06-08 21:24:52 +0300
committerLucio Rossi <lucio.rossi75@gmail.com>2017-06-08 21:25:26 +0300
commit4ea8e752d0d8af195bc6d4d0725ba62513c2ff48 (patch)
tree32c2fcd44070577df585d65df68c1bfafcba3b84 /rigify/ui.py
parent85b44a34f7c0eaebf67a8d65bb234523a9262d5d (diff)
Rigify 0.5 metarig fixes, advanced generation options, code cleanup
Diffstat (limited to 'rigify/ui.py')
-rw-r--r--rigify/ui.py106
1 files changed, 72 insertions, 34 deletions
diff --git a/rigify/ui.py b/rigify/ui.py
index 4c9e6e78..b4feb2b6 100644
--- a/rigify/ui.py
+++ b/rigify/ui.py
@@ -20,6 +20,7 @@
import bpy
from bpy.props import StringProperty
+from mathutils import Color
from .utils import get_rig_type, MetarigError
from .utils import write_metarig, write_widget
@@ -34,7 +35,6 @@ class DATA_PT_rigify_buttons(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"
- #bl_options = {'DEFAULT_OPEN'}
@classmethod
def poll(cls, context):
@@ -70,6 +70,40 @@ class DATA_PT_rigify_buttons(bpy.types.Panel):
layout.label(text=WARNING, icon='ERROR')
layout.operator("pose.rigify_generate", text="Generate Rig")
+ layout.prop(id_store, "rigify_advanced_generation")
+
+ if id_store.rigify_advanced_generation:
+
+ main_row = layout.row(align=True).split(percentage=0.3)
+ col1 = main_row.column()
+ col2 = main_row.column()
+ col1.label(text="Target Rig")
+ col1.label(text="Target UI")
+
+ row = col2.row(align=True)
+
+ for i in range(0, len(id_store.rigify_target_rigs)):
+ id_store.rigify_target_rigs.remove(0)
+
+ for ob in context.scene.objects:
+ if type(ob.data) == bpy.types.Armature and "rig_id" in ob.data:
+ id_store.rigify_target_rigs.add()
+ id_store.rigify_target_rigs[-1].name = ob.name
+
+ row.prop_search(id_store, "rigify_target_rig", id_store, "rigify_target_rigs", text="",
+ icon='OUTLINER_OB_ARMATURE')
+
+ for i in range(0, len(id_store.rigify_rig_uis)):
+ id_store.rigify_rig_uis.remove(0)
+
+ for t in bpy.data.texts:
+ id_store.rigify_rig_uis.add()
+ id_store.rigify_rig_uis[-1].name = t.name
+
+ row = col2.row()
+ row.prop_search(id_store, "rigify_rig_ui", id_store, "rigify_rig_uis", text="", icon='TEXT')
+
+ layout.prop(id_store, "rigify_force_widget_update")
if show_update_metarig:
layout.label(text="Some bones have old legacy rigify_type. Click to upgrade", icon='ERROR')
@@ -84,7 +118,7 @@ class DATA_PT_rigify_buttons(bpy.types.Panel):
id_store.rigify_types.remove(0)
for r in rig_lists.rig_list:
- # collection = r.split('.')[0] # UNUSED
+
if collection_name == "All":
a = id_store.rigify_types.add()
a.name = r
@@ -95,10 +129,6 @@ class DATA_PT_rigify_buttons(bpy.types.Panel):
a = id_store.rigify_types.add()
a.name = r
- ## Rig collection field
- #row = layout.row()
- #row.prop(id_store, 'rigify_collection', text="Category")
-
# Rig type list
row = layout.row()
row.template_list("UI_UL_list", "rigify_types", id_store, "rigify_types", id_store, 'rigify_active_type')
@@ -129,21 +159,30 @@ class DATA_PT_rigify_layer_names(bpy.types.Panel):
arm.rigify_layers.add()
else:
# Can't add while drawing, just use button
- if len(arm.rigify_layers) < 28:
+ if len(arm.rigify_layers) < 29:
layout.operator("pose.rigify_layer_init")
return
# UI
+ main_row = layout.row(align=True).split(0.05)
+ col1 = main_row.column()
+ col2 = main_row.column()
+ col1.label()
+ for i in range(32):
+ if i == 16 or i == 29:
+ col1.label()
+ col1.label(str(i+1) + '.')
+
for i, rigify_layer in enumerate(arm.rigify_layers):
# note: rigify_layer == arm.rigify_layers[i]
if (i % 16) == 0:
- col = layout.column()
+ col = col2.column()
if i == 0:
col.label(text="Top Row:")
else:
col.label(text="Bottom Row:")
if (i % 8) == 0:
- col = layout.column()
+ col = col2.column()
if i != 28:
row = col.row(align=True)
icon = 'RESTRICT_VIEW_OFF' if arm.layers[i] else 'RESTRICT_VIEW_ON'
@@ -172,7 +211,7 @@ class DATA_PT_rigify_layer_names(bpy.types.Panel):
else:
row.label(text=arm.rigify_colors[rigify_layer.group-1].name)
- col = layout.column()
+ col = col2.column()
col.label(text="Reserved:")
# reserved_names = {28: 'Root', 29: 'DEF', 30: 'MCH', 31: 'ORG'}
reserved_names = {29: 'DEF', 30: 'MCH', 31: 'ORG'}
@@ -198,20 +237,31 @@ class DATA_OT_rigify_add_bone_groups(bpy.types.Operator):
if not hasattr(armature, 'rigify_colors'):
return {'FINISHED'}
- groups = ['Face', 'Face Primary', 'Face Secondary', 'FK', 'IK', 'Tweaks', 'Torso', 'Upper Body', 'Upper Spine']
- themes = {'Face': 'THEME11', 'Face Primary': 'THEME01', 'Face Secondary': 'THEME09',
- 'FK': 'THEME04', 'IK': 'THEME01', 'Tweaks': 'THEME14',
- 'Torso': 'THEME03', 'Upper Body': 'THEME09', 'Upper Spine': 'THEME02'}
+ groups = ['Root', 'IK', 'Special', 'Tweak', 'FK', 'Extra']
for g in groups:
if g in armature.rigify_colors.keys():
continue
+
armature.rigify_colors.add()
armature.rigify_colors[-1].name = g
- id = int(themes[g][-2:]) - 1
- armature.rigify_colors[-1].normal = bpy.context.user_preferences.themes[0].bone_color_sets[id].normal
- armature.rigify_colors[-1].select = bpy.context.user_preferences.themes[0].bone_color_sets[id].select
- armature.rigify_colors[-1].active = bpy.context.user_preferences.themes[0].bone_color_sets[id].active
+
+ armature.rigify_colors[g].select = Color((0.3140000104904175, 0.7839999794960022, 1.0))
+ armature.rigify_colors[g].active = Color((0.5490000247955322, 1.0, 1.0))
+ armature.rigify_colors[g].standard_colors_lock = True
+
+ if g == "Root":
+ armature.rigify_colors[g].normal = Color((0.43529415130615234, 0.18431372940540314, 0.41568630933761597))
+ if g == "IK":
+ armature.rigify_colors[g].normal = Color((0.6039215922355652, 0.0, 0.0))
+ if g== "Special":
+ armature.rigify_colors[g].normal = Color((0.9568628072738647, 0.7882353663444519, 0.0470588281750679))
+ if g== "Tweak":
+ armature.rigify_colors[g].normal = Color((0.03921568766236305, 0.21176472306251526, 0.5803921818733215))
+ if g== "FK":
+ armature.rigify_colors[g].normal = Color((0.11764706671237946, 0.5686274766921997, 0.03529411926865578))
+ if g== "Extra":
+ armature.rigify_colors[g].normal = Color((0.9686275124549866, 0.250980406999588, 0.0941176563501358))
return {'FINISHED'}
@@ -553,20 +603,6 @@ class VIEW3D_PT_tools_rigify_dev(bpy.types.Panel):
r = self.layout.row()
r.operator("mesh.rigify_encode_mesh_widget", text="Encode Mesh Widget to Python")
-#~ class INFO_MT_armature_metarig_add(bpy.types.Menu):
- #~ bl_idname = "INFO_MT_armature_metarig_add"
- #~ bl_label = "Meta-Rig"
-
- #~ def draw(self, context):
- #~ import rigify
-
- #~ layout = self.layout
- #~ layout.operator_context = 'INVOKE_REGION_WIN'
-
- #~ for submodule_type in rigify.get_submodule_types():
- #~ text = bpy.path.display_name(submodule_type)
- #~ layout.operator("pose.metarig_sample_add", text=text, icon='OUTLINER_OB_ARMATURE').metarig_type = submodule_type
-
def rigify_report_exception(operator, exception):
import traceback
@@ -600,8 +636,10 @@ class LayerInit(bpy.types.Operator):
def execute(self, context):
obj = context.object
arm = obj.data
- for i in range(1 + len(arm.rigify_layers), 29):
+ for i in range(1 + len(arm.rigify_layers), 30):
arm.rigify_layers.add()
+ arm.rigify_layers[28].name = 'Root'
+ arm.rigify_layers[28].row = 14
return {'FINISHED'}
@@ -696,7 +734,7 @@ class EncodeMetarig(bpy.types.Operator):
else:
text_block = bpy.data.texts.new(name)
- text = write_metarig(context.active_object, layers=True, func_name="create")
+ text = write_metarig(context.active_object, layers=True, func_name="create", groups=True)
text_block.write(text)
bpy.ops.object.mode_set(mode='EDIT')