Skip to content

Update the branch with changes from upstream 2.8 master. #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: rigify_0.6_beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

bl_info = {
"name": "Rigify",
"version": (0, 5),
"version": (0, 5, 1),
"author": "Nathan Vegdahl, Lucio Rossi, Ivan Cappiello",
"blender": (2, 78, 0),
"description": "Automatic rigging from building-block components",
Expand Down Expand Up @@ -258,8 +258,18 @@ class RigifyParameters(bpy.types.PropertyGroup):
name = bpy.props.StringProperty()


# Remember the initial property set
RIGIFY_PARAMETERS_BASE_DIR = set(dir(RigifyParameters))

RIGIFY_PARAMETER_TABLE = {'name': ('DEFAULT', bpy.props.StringProperty())}

def clear_rigify_parameters():
for name in list(dir(RigifyParameters)):
if name not in RIGIFY_PARAMETERS_BASE_DIR:
delattr(RigifyParameters, name)
if name in RIGIFY_PARAMETER_TABLE:
del RIGIFY_PARAMETER_TABLE[name]


def format_property_spec(spec):
"""Turns the return value of bpy.props.SomeProperty(...) into a readable string."""
Expand Down Expand Up @@ -353,7 +363,7 @@ def register():
bpy.types.Armature.active_feature_set = bpy.props.EnumProperty(
items=feature_sets.feature_set_items,
name="Feature Set",
description="Feature set to select from for this bone"
description="Restrict the rig list to a specific custom feature set"
)

bpy.types.PoseBone.rigify_type = bpy.props.StringProperty(name="Rigify Type", description="Rig type for this bone")
Expand Down Expand Up @@ -488,6 +498,9 @@ def unregister():
if "bl_rna" in RigifyPreferences.__dict__:
bpy.utils.unregister_class(RigifyPreferences)

clear_rigify_parameters()

# Sub-modules.
metarig_menu.unregister()
ui.unregister()
feature_sets.unregister()
2 changes: 1 addition & 1 deletion legacy/rigs/biped/arm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def add_parameters(params):

"""
params.use_complex_arm = bpy.props.BoolProperty(name="Complex Arm Rig", default=True, description="Generate the full, complex arm rig with twist bones and rubber-hose controls")
params.bend_hint = bpy.props.BoolProperty(name="Bend Hint", default=True, description="Give IK chain a hint about which way to bend. Useful for perfectly straight chains")
params.bend_hint = bpy.props.BoolProperty(name="Bend Hint", default=True, description="Give IK chain a hint about which way to bend. Useful for perfectly straight chains")

items = [('X', 'X', ''), ('Y', 'Y', ''), ('Z', 'Z', ''), ('-X', '-X', ''), ('-Y', '-Y', ''), ('-Z', '-Z', '')]
params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='X')
Expand Down
2 changes: 1 addition & 1 deletion legacy/rigs/biped/leg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def add_parameters(params):

"""
params.use_complex_leg = bpy.props.BoolProperty(name="Complex Leg Rig", default=True, description="Generate the full, complex leg rig with twist bones and rubber-hose controls")
params.bend_hint = bpy.props.BoolProperty(name="Bend Hint", default=True, description="Give IK chain a hint about which way to bend (useful for perfectly straight chains)")
params.bend_hint = bpy.props.BoolProperty(name="Bend Hint", default=True, description="Give IK chain a hint about which way to bend. Useful for perfectly straight chains")

items = [('X', 'X', ''), ('Y', 'Y', ''), ('Z', 'Z', ''), ('-X', '-X', ''), ('-Y', '-Y', ''), ('-Z', '-Z', '')]
params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='X')
Expand Down
46 changes: 10 additions & 36 deletions legacy/rigs/biped/limb_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
from math import pi

import bpy
from rna_prop_ui import rna_idprop_ui_prop_get
from mathutils import Vector

from ...utils import angle_on_plane, align_bone_roll, align_bone_z_axis
from ...utils import new_bone, copy_bone, put_bone, make_nonscaling_child
from ...utils import strip_org, make_mechanism_name, make_deformer_name, insert_before_lr
from ...utils import create_widget, create_limb_widget, create_line_widget, create_sphere_widget

from ....utils.mechanism import make_property

class FKLimb:
def __init__(self, obj, bone1, bone2, bone3, primary_rotation_axis, layers):
Expand Down Expand Up @@ -155,17 +155,9 @@ def generate(self):

# Set up custom properties
if parent is not None:
prop = rna_idprop_ui_prop_get(ulimb_p, "isolate", create=True)
ulimb_p["isolate"] = 0.0
prop["soft_min"] = prop["min"] = 0.0
prop["soft_max"] = prop["max"] = 1.0

prop = rna_idprop_ui_prop_get(ulimb_p, "stretch_length", create=True)
ulimb_p["stretch_length"] = 1.0
prop["min"] = 0.05
prop["max"] = 20.0
prop["soft_min"] = 0.25
prop["soft_max"] = 4.0
make_property(ulimb_p, "isolate", 0.0)

make_property(ulimb_p, "stretch_length", 1.0, min=0.05, max=20.0, soft_min=0.25, soft_max=4.0)

# Stretch drivers
def add_stretch_drivers(pose_bone):
Expand Down Expand Up @@ -501,28 +493,13 @@ def generate(self):

# Set up custom properties
if self.switch is True:
prop = rna_idprop_ui_prop_get(elimb_p, "ikfk_switch", create=True)
elimb_p["ikfk_switch"] = 0.0
prop["soft_min"] = prop["min"] = 0.0
prop["soft_max"] = prop["max"] = 1.0
make_property(elimb_p, "ikfk_switch", 0.0)

if self.pole_parent is not None:
prop = rna_idprop_ui_prop_get(pole_p, "follow", create=True)
pole_p["follow"] = 1.0
prop["soft_min"] = prop["min"] = 0.0
prop["soft_max"] = prop["max"] = 1.0

prop = rna_idprop_ui_prop_get(elimb_p, "stretch_length", create=True)
elimb_p["stretch_length"] = 1.0
prop["min"] = 0.05
prop["max"] = 20.0
prop["soft_min"] = 0.25
prop["soft_max"] = 4.0

prop = rna_idprop_ui_prop_get(elimb_p, "auto_stretch", create=True)
elimb_p["auto_stretch"] = 1.0
prop["soft_min"] = prop["min"] = 0.0
prop["soft_max"] = prop["max"] = 1.0
make_property(pole_p, "follow", 1.0)

make_property(elimb_p, "stretch_length", 1.0, min=0.05, max=20.0, soft_min=0.25, soft_max=4.0)
make_property(elimb_p, "auto_stretch", 1.0)

# Stretch parameter drivers
def add_stretch_drivers(pose_bone):
Expand Down Expand Up @@ -1096,10 +1073,7 @@ def generate(self):
flimb1_smoother_p.bone.bbone_out = 1.0

# Custom properties
prop = rna_idprop_ui_prop_get(jhose_p, "smooth_bend", create=True)
jhose_p["smooth_bend"] = 0.0
prop["soft_min"] = prop["min"] = 0.0
prop["soft_max"] = prop["max"] = 1.0
make_property(jhose_p, "smooth_bend", 0.0)

# Constraints
con = ulimb1_p.constraints.new('COPY_LOCATION')
Expand Down
13 changes: 5 additions & 8 deletions legacy/rigs/finger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import re

import bpy
from rna_prop_ui import rna_idprop_ui_prop_get
from mathutils import Vector

from ..utils import MetarigError
Expand All @@ -30,6 +29,7 @@
from ..utils import strip_org, make_mechanism_name, make_deformer_name
from ..utils import create_widget, create_limb_widget

from ...utils.mechanism import make_property

class Rig:
""" A finger rig. It takes a single chain of bones.
Expand Down Expand Up @@ -187,15 +187,12 @@ def control(self):
for bone in helpers:
# Add custom prop
prop_name = "bend_%02d" % i
prop = rna_idprop_ui_prop_get(pb[ctrl], prop_name, create=True)
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
if i == 1:
pb[ctrl][prop_name] = 0.0
propval = 0.0
else:
pb[ctrl][prop_name] = val
propval = val

make_property(pb[ctrl], prop_name, propval)

# Add driver
if 'X' in self.primary_rotation_axis:
Expand Down
24 changes: 4 additions & 20 deletions legacy/rigs/neck_short.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
# <pep8 compliant>

import bpy
from rna_prop_ui import rna_idprop_ui_prop_get

from ..utils import MetarigError
from ..utils import copy_bone, new_bone, put_bone
from ..utils import connected_children_names
from ..utils import strip_org, make_mechanism_name, make_deformer_name
from ..utils import create_circle_widget

from ...utils.mechanism import make_property

script1 = """
head_neck = ["%s", "%s"]
Expand Down Expand Up @@ -190,27 +190,11 @@ def gen_control(self):
head_ctrl_p.custom_shape_transform = pb[self.org_bones[-1]]

# Custom properties
prop = rna_idprop_ui_prop_get(head_ctrl_p, "inf_extent", create=True)
head_ctrl_p["inf_extent"] = 0.5
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0

prop = rna_idprop_ui_prop_get(head_ctrl_p, "neck_follow", create=True)
head_ctrl_p["neck_follow"] = 1.0
prop["min"] = 0.0
prop["max"] = 2.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
make_property(head_ctrl_p, "inf_extent", 0.5)
make_property(head_ctrl_p, "neck_follow", 1.0, max=2.0, soft_max=1.0)

if self.isolate:
prop = rna_idprop_ui_prop_get(head_ctrl_p, "isolate", create=True)
head_ctrl_p["isolate"] = 0.0
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
make_property(head_ctrl_p, "isolate", 0.0)

# Constraints

Expand Down
11 changes: 3 additions & 8 deletions legacy/rigs/pitchipoy/limbs/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from ....utils import strip_org
from .limb_utils import *
from ..super_widgets import create_hand_widget
from rna_prop_ui import rna_idprop_ui_prop_get

from .....utils.mechanism import make_property

def create_arm( cls, bones ):
org_bones = cls.org_bones
Expand Down Expand Up @@ -81,13 +82,7 @@ def create_arm( cls, bones ):
# Create ik/fk switch property
pb_parent = pb[ bones['parent'] ]

pb_parent['IK_Strertch'] = 1.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK_Strertch', create=True )
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = 'IK Stretch'
prop = make_property(pb_parent, 'IK_Strertch', 1.0, description='IK Stretch')

# Add driver to limit scale constraint influence
b = bones['ik']['mch_str']
Expand Down
10 changes: 3 additions & 7 deletions legacy/rigs/pitchipoy/limbs/leg.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from ..super_widgets import create_foot_widget, create_ballsocket_widget
from .limb_utils import *

from .....utils.mechanism import make_property

def create_leg( cls, bones ):
org_bones = list(
[cls.org_bones[0]] + connected_children_names(cls.obj, cls.org_bones[0])
Expand Down Expand Up @@ -236,13 +238,7 @@ def create_leg( cls, bones ):
# Create ik/fk switch property
pb_parent = pb[ bones['parent'] ]

pb_parent['IK_Strertch'] = 1.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK_Strertch', create=True )
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = 'IK Stretch'
prop = make_property(pb_parent, 'IK_Strertch', 1.0, description='IK Stretch')

# Add driver to limit scale constraint influence
b = bones['ik']['mch_str']
Expand Down
10 changes: 3 additions & 7 deletions legacy/rigs/pitchipoy/limbs/paw.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from ..super_widgets import create_foot_widget, create_ballsocket_widget
from .limb_utils import *

from .....utils.mechanism import make_property

def create_paw( cls, bones ):
org_bones = list(
[cls.org_bones[0]] + connected_children_names(cls.obj, cls.org_bones[0])
Expand Down Expand Up @@ -105,13 +107,7 @@ def create_paw( cls, bones ):
# Create ik/fk switch property
pb_parent = pb[ bones['parent'] ]

pb_parent['IK_Strertch'] = 1.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK_Strertch', create=True )
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = 'IK Stretch'
prop = make_property(pb_parent, 'IK_Strertch', 1.0, description='IK Stretch')

# Add driver to limit scale constraint influence
b = bones['ik']['mch_str']
Expand Down
31 changes: 6 additions & 25 deletions legacy/rigs/pitchipoy/limbs/super_limb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
from ....utils import create_circle_widget, create_sphere_widget
from ....utils import MetarigError, make_mechanism_name, org
from ....utils import create_limb_widget, connected_children_names
from rna_prop_ui import rna_idprop_ui_prop_get
from ..super_widgets import create_ikarrow_widget
from math import trunc

from .....utils.mechanism import make_property

class Rig:

Expand Down Expand Up @@ -79,14 +79,7 @@ def create_parent(self):

name = 'FK_limb_follow'

pb[ mch ][ name ] = 0.0
prop = rna_idprop_ui_prop_get( pb[ mch ], name, create = True )

prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = name
make_property(pb[ mch ], name, 0.0)

drv = pb[ mch ].constraints[ 0 ].driver_add("influence").driver

Expand Down Expand Up @@ -335,17 +328,11 @@ def create_def( self, tweaks ):
name = 'rubber_tweak'

if i == trunc( len( tweaks[1:-1] ) / 2 ):
pb[t][name] = 0.0
defval = 0.0
else:
pb[t][name] = 1.0

prop = rna_idprop_ui_prop_get( pb[t], name, create=True )
defval = 1.0

prop["min"] = 0.0
prop["max"] = 2.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = name
make_property(pb[t], name, defval, max=2.0, soft_max=1.0)

for j,d in enumerate(def_bones[:-1]):
drvs = {}
Expand Down Expand Up @@ -498,13 +485,7 @@ def org_parenting_and_switch( self, org, ik, fk, parent ):
pb_parent = pb[ parent ]

# Create ik/fk switch property
pb_parent['IK/FK'] = 0.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK/FK', create=True )
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = 'IK/FK Switch'
prop = make_property(pb_parent, 'IK/FK', 0.0, description='IK/FK Switch')

# Constrain org to IK and FK bones
iks = [ ik['ctrl']['limb'] ]
Expand Down
15 changes: 5 additions & 10 deletions legacy/rigs/pitchipoy/super_face.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from ...utils import org, strip_org, make_deformer_name, connected_children_names, make_mechanism_name
from ...utils import create_circle_widget, create_sphere_widget, create_widget, create_cube_widget
from ...utils import MetarigError
from rna_prop_ui import rna_idprop_ui_prop_get
from .super_widgets import create_face_widget, create_eye_widget, create_eyes_widget, create_ear_widget, create_jaw_widget, create_teeth_widget

from ....utils.mechanism import make_property

script = """
all_controls = [%s]
Expand Down Expand Up @@ -917,16 +917,11 @@ def drivers_and_props( self, all_bones ):

for bone, prop_name in zip( [ jaw_ctrl, eyes_ctrl ], [ jaw_prop, eyes_prop ] ):
if bone == jaw_ctrl:
pb[ bone ][ prop_name ] = 0.0
defval = 0.0
else:
pb[ bone ][ prop_name ] = 1.0

prop = rna_idprop_ui_prop_get( pb[ bone ], prop_name )
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = prop_name
defval = 1.0

make_property(pb[ bone ], prop_name, defval)

# Jaw drivers
mch_jaws = all_bones['mch']['jaw'][1:-1]
Expand Down
Loading