diff options
author | Lucio Rossi <lucio.rossi75@gmail.com> | 2017-05-14 20:17:22 +0300 |
---|---|---|
committer | Lucio Rossi <lucio.rossi75@gmail.com> | 2017-05-14 20:17:22 +0300 |
commit | 6ddeca86fb7974fd44eb60724bfbc7935c92cd78 (patch) | |
tree | 81eafea7dfdd79432f4ea62de5b41cb2456a5fec /rigify/__init__.py | |
parent | f36789d8bc728bc7ec3c9738f1ca76e8f017ce7a (diff) |
Rigify 0.5 Bone Groups and Selection Sets support
Diffstat (limited to 'rigify/__init__.py')
-rw-r--r-- | rigify/__init__.py | 100 |
1 files changed, 97 insertions, 3 deletions
diff --git a/rigify/__init__.py b/rigify/__init__.py index 638260e1..2e7953b1 100644 --- a/rigify/__init__.py +++ b/rigify/__init__.py @@ -162,14 +162,75 @@ class RigifyName(bpy.types.PropertyGroup): name = bpy.props.StringProperty() +class RigifyColorSet(bpy.types.PropertyGroup): + name = bpy.props.StringProperty(name="Color Set", default=" ") + active = bpy.props.FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(1.0, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + normal = bpy.props.FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(1.0, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + select = bpy.props.FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(1.0, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + standard_colors_lock = bpy.props.BoolProperty(default=True) + + +class RigifySelectionColors(bpy.types.PropertyGroup): + + select = bpy.props.FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(0.314, 0.784, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + + active = bpy.props.FloatVectorProperty( + name="object_color", + subtype='COLOR', + default=(0.549, 1.0, 1.0), + min=0.0, max=1.0, + description="color picker" + ) + + class RigifyParameters(bpy.types.PropertyGroup): name = bpy.props.StringProperty() class RigifyArmatureLayer(bpy.types.PropertyGroup): - name = bpy.props.StringProperty(name="Layer Name", default=" ") - row = bpy.props.IntProperty(name="Layer Row", default=1, min=1, max=32) + def get_group(self): + if 'group_prop' in self.keys(): + return self['group_prop'] + else: + return 0 + + def set_group(self, value): + arm = bpy.context.object.data + if value > len(arm.rigify_colors): + self['group_prop'] = len(arm.rigify_colors) + else: + self['group_prop'] = value + + name = bpy.props.StringProperty(name="Layer Name", default=" ") + row = bpy.props.IntProperty(name="Layer Row", default=1, min=1, max=32, description='UI row for this layer') + set = bpy.props.BoolProperty(name="Selection Set", default=False, description='Add Selection Set for this layer') + group = bpy.props.IntProperty(name="Bone Group", default=0, min=0, max=32, + get=get_group, set=set_group, description='Assign Bone Group to this layer') ##### REGISTER ##### @@ -179,6 +240,9 @@ def register(): bpy.utils.register_class(RigifyName) bpy.utils.register_class(RigifyParameters) + + bpy.utils.register_class(RigifyColorSet) + bpy.utils.register_class(RigifySelectionColors) bpy.utils.register_class(RigifyArmatureLayer) bpy.utils.register_class(RigifyPreferences) bpy.types.Armature.rigify_layers = bpy.props.CollectionProperty(type=RigifyArmatureLayer) @@ -186,7 +250,33 @@ 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.PointerProperty(type=RigifyParameters) - bpy.types.Armature.rigify_layers = bpy.props.CollectionProperty(type=RigifyArmatureLayer) + bpy.types.Armature.rigify_colors = bpy.props.CollectionProperty(type=RigifyColorSet) + + bpy.types.Armature.rigify_selection_colors = bpy.props.PointerProperty(type=RigifySelectionColors) + + bpy.types.Armature.rigify_colors_index = bpy.props.IntProperty(default=-1) + bpy.types.Armature.rigify_colors_lock = bpy.props.BoolProperty(default=True) + bpy.types.Armature.rigify_theme_to_add = bpy.props.EnumProperty(items=(('THEME01', 'THEME01', ''), + ('THEME02', 'THEME02', ''), + ('THEME03', 'THEME03', ''), + ('THEME04', 'THEME04', ''), + ('THEME05', 'THEME05', ''), + ('THEME06', 'THEME06', ''), + ('THEME07', 'THEME07', ''), + ('THEME08', 'THEME08', ''), + ('THEME09', 'THEME09', ''), + ('THEME10', 'THEME10', ''), + ('THEME11', 'THEME11', ''), + ('THEME12', 'THEME12', ''), + ('THEME13', 'THEME13', ''), + ('THEME14', 'THEME14', ''), + ('THEME15', 'THEME15', ''), + ('THEME16', 'THEME16', ''), + ('THEME17', 'THEME17', ''), + ('THEME18', 'THEME18', ''), + ('THEME19', 'THEME19', ''), + ('THEME20', 'THEME20', '') + ), name='Theme') IDStore = bpy.types.WindowManager IDStore.rigify_collection = bpy.props.EnumProperty(items=rig_lists.col_enum_list, default="All", @@ -220,6 +310,10 @@ def unregister(): bpy.utils.unregister_class(RigifyName) bpy.utils.unregister_class(RigifyParameters) + + bpy.utils.unregister_class(RigifyColorSet) + bpy.utils.unregister_class(RigifySelectionColors) + bpy.utils.unregister_class(RigifyArmatureLayer) bpy.utils.unregister_class(RigifyPreferences) |