Changeset View
Changeset View
Standalone View
Standalone View
rigify/utils/layers.py
| Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | def add_parameters(self, params): | ||||
| description="" | description="" | ||||
| ) | ) | ||||
| setattr(params, self.toggle_option, prop_toggle) | setattr(params, self.toggle_option, prop_toggle) | ||||
| prop_layers = bpy.props.BoolVectorProperty( | prop_layers = bpy.props.BoolVectorProperty( | ||||
| size=32, | size=32, | ||||
| description=self.description, | description=self.description, | ||||
| subtype='LAYER', | |||||
| default=tuple([i == 1 for i in range(0, 32)]) | default=tuple([i == 1 for i in range(0, 32)]) | ||||
| ) | ) | ||||
| setattr(params, self.layers_option, prop_layers) | setattr(params, self.layers_option, prop_layers) | ||||
| def parameters_ui(self, layout, params): | def parameters_ui(self, layout, params): | ||||
| box = layout.box() | box = layout.box() | ||||
| box.prop(params, self.toggle_option) | box.prop(params, self.toggle_option) | ||||
| active = getattr(params, self.toggle_option) | active = getattr(params, self.toggle_option) | ||||
| if not active: | if not active: | ||||
| return | return | ||||
| r = box.row() | row = box.row(align=True) | ||||
| col = r.column(align=True) | row.prop(params, self.layers_option, text="") | ||||
| row = col.row(align=True) | |||||
| bone_layers = bpy.context.active_pose_bone.bone.layers[:] | |||||
| for i in range(8): # Layers 0-7 | |||||
| icon = "NONE" | |||||
| if bone_layers[i]: | |||||
| icon = "LAYER_ACTIVE" | |||||
| row.prop(params, self.layers_option, index=i, toggle=True, text="", icon=icon) | |||||
| row = col.row(align=True) | |||||
| for i in range(16, 24): # Layers 16-23 | |||||
| icon = "NONE" | |||||
| if bone_layers[i]: | |||||
| icon = "LAYER_ACTIVE" | |||||
| row.prop(params, self.layers_option, index=i, toggle=True, text="", icon=icon) | |||||
| col = r.column(align=True) | |||||
| row = col.row(align=True) | |||||
| for i in range(8, 16): # Layers 8-15 | |||||
| icon = "NONE" | |||||
| if bone_layers[i]: | |||||
| icon = "LAYER_ACTIVE" | |||||
| row.prop(params, self.layers_option, index=i, toggle=True, text="", icon=icon) | |||||
| row = col.row(align=True) | |||||
| for i in range(24, 32): # Layers 24-31 | |||||
| icon = "NONE" | |||||
| if bone_layers[i]: | |||||
| icon = "LAYER_ACTIVE" | |||||
| row.prop(params, self.layers_option, index=i, toggle=True, text="", icon=icon) | |||||
| ControlLayersOption.FK = ControlLayersOption('fk', description="Layers for the FK controls to be on") | ControlLayersOption.FK = ControlLayersOption('fk', description="Layers for the FK controls to be on") | ||||
| ControlLayersOption.TWEAK = ControlLayersOption('tweak', description="Layers for the tweak controls to be on") | ControlLayersOption.TWEAK = ControlLayersOption('tweak', description="Layers for the tweak controls to be on") | ||||