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/generate.py
parent85b44a34f7c0eaebf67a8d65bb234523a9262d5d (diff)
Rigify 0.5 metarig fixes, advanced generation options, code cleanup
Diffstat (limited to 'rigify/generate.py')
-rw-r--r--rigify/generate.py36
1 files changed, 25 insertions, 11 deletions
diff --git a/rigify/generate.py b/rigify/generate.py
index 66971a7e..1af872d6 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -31,6 +31,7 @@ from .utils import RIG_DIR
from .utils import create_root_widget
from .utils import random_id
from .utils import copy_attributes
+from .utils import gamma_correct
from .rig_ui_template import UI_SLIDERS, layers_ui, UI_REGISTER
@@ -71,7 +72,7 @@ def generate_rig(context, metarig):
bpy.ops.object.mode_set(mode='OBJECT')
scene = context.scene
-
+ id_store = context.window_manager
#------------------------------------------
# Create/find the rig object and set it up
@@ -79,10 +80,8 @@ def generate_rig(context, metarig):
# regenerate in the same object. If not, create a new
# object to generate the rig in.
print("Fetch rig.")
- try:
- name = metarig["rig_object_name"]
- except KeyError:
- name = "rig"
+
+ name = id_store.rigify_target_rig or "rig"
try:
obj = scene.objects[name]
@@ -102,6 +101,19 @@ def generate_rig(context, metarig):
obj.select = True
scene.objects.active = obj
+ # Remove wgts if force update is set
+ if "WGTS" in scene.objects and id_store.rigify_force_widget_update:
+ bpy.ops.object.select_all(action='DESELECT')
+ for i, lyr in enumerate(WGT_LAYERS):
+ if lyr:
+ context.scene.layers[i] = True
+ for wgt in bpy.data.objects["WGTS"].children:
+ wgt.select = True
+ bpy.ops.object.delete(use_global=False)
+ for i, lyr in enumerate(WGT_LAYERS):
+ if lyr:
+ context.scene.layers[i] = False
+
# Remove all bones from the generated rig armature.
bpy.ops.object.mode_set(mode='EDIT')
for bone in obj.data.edit_bones:
@@ -423,12 +435,14 @@ def generate_rig(context, metarig):
# Create list of layer name/row pairs
layer_layout = []
for l in metarig.data.rigify_layers:
- print( l.name )
+ print(l.name)
layer_layout += [(l.name, l.row)]
# Generate the UI script
- if "rig_ui.py" in bpy.data.texts:
- script = bpy.data.texts["rig_ui.py"]
+ rig_ui_name = id_store.rigify_rig_ui or 'rig_ui.py'
+
+ if rig_ui_name in bpy.data.texts.keys():
+ script = bpy.data.texts[rig_ui_name]
script.clear()
else:
script = bpy.data.texts.new("rig_ui.py")
@@ -521,9 +535,9 @@ def create_bone_groups(obj, metarig):
if name not in obj.pose.bone_groups.keys():
bg = obj.pose.bone_groups.new(name)
bg.color_set = 'CUSTOM'
- bg.colors.normal = groups[g_id].normal
- bg.colors.select = groups[g_id].select
- bg.colors.active = groups[g_id].active
+ bg.colors.normal = gamma_correct(groups[g_id].normal)
+ bg.colors.select = gamma_correct(groups[g_id].select)
+ bg.colors.active = gamma_correct(groups[g_id].active)
for b in pb:
try: