1 #====================== BEGIN GPL LICENSE BLOCK ======================
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #======================= END GPL LICENSE BLOCK ========================
22 from bpy
.props
import StringProperty
23 from mathutils
import Color
25 from .utils
import get_rig_type
, MetarigError
26 from .utils
import write_metarig
, write_widget
27 from .utils
import unique_name
28 from .utils
import upgradeMetarigTypes
, outdated_types
29 from .utils
import get_keyed_frames
, bones_in_frame
30 from .utils
import overwrite_prop_animation
31 from .rigs
.utils
import get_limb_generated_names
32 from . import rig_lists
33 from . import generate
34 from . import rot_mode
37 class DATA_PT_rigify_buttons(bpy
.types
.Panel
):
38 bl_label
= "Rigify Buttons"
39 bl_space_type
= 'PROPERTIES'
40 bl_region_type
= 'WINDOW'
44 def poll(cls
, context
):
45 return context
.object.type == 'ARMATURE' and context
.active_object
.data
.get("rig_id") is None
47 def draw(self
, context
):
51 id_store
= C
.window_manager
53 if obj
.mode
in {'POSE', 'OBJECT'}:
55 WARNING
= "Warning: Some features may change after generation"
57 show_update_metarig
= False
58 show_not_updatable
= False
60 check_props
= ['IK_follow', 'root/parent', 'FK_limb_follow', 'IK_Stretch']
62 for obj
in bpy
.data
.objects
:
63 if type(obj
.data
) != bpy
.types
.Armature
:
65 for bone
in obj
.pose
.bones
:
66 if bone
.bone
.layers
[30] and (list(set(bone
.keys()) & set(check_props
))):
69 for b
in obj
.pose
.bones
:
70 if b
.rigify_type
in outdated_types
.keys():
71 if outdated_types
[b
.rigify_type
]:
72 show_update_metarig
= True
74 show_update_metarig
= False
75 show_not_updatable
= True
79 layout
.label(text
=WARNING
, icon
='ERROR')
81 if show_not_updatable
:
82 layout
.label(text
="WARNING: This metarig contains deprecated rigify rig-types and cannot be upgraded automatically.", icon
='ERROR')
83 layout
.label(text
="If you want to use it anyway try enabling the legacy mode before generating again.")
85 layout
.operator("pose.rigify_switch_to_legacy", text
="Switch to Legacy")
87 enable_generate_and_advanced
= not (show_not_updatable
or show_update_metarig
)
89 if show_update_metarig
:
91 layout
.label(text
="This metarig contains old rig-types that can be automatically upgraded to benefit of rigify's new features.", icon
='ERROR')
92 layout
.label(text
= "To use it as-is you need to enable legacy mode.",)
93 layout
.operator("pose.rigify_upgrade_types", text
="Upgrade Metarig")
96 row
.operator("pose.rigify_generate", text
="Generate Rig", icon
='POSE_HLT')
97 row
.enabled
= enable_generate_and_advanced
99 if id_store
.rigify_advanced_generation
:
104 col
= layout
.column()
105 col
.enabled
= enable_generate_and_advanced
107 row
.prop(id_store
, "rigify_advanced_generation", toggle
=True, icon
=icon
)
109 if id_store
.rigify_advanced_generation
:
111 row
= col
.row(align
=True)
112 row
.prop(id_store
, "rigify_generate_mode", expand
=True)
114 main_row
= col
.row(align
=True).split(percentage
=0.3)
115 col1
= main_row
.column()
116 col2
= main_row
.column()
117 col1
.label(text
="Rig Name")
119 row
.label(text
="Target Rig")
120 row
.enabled
= (id_store
.rigify_generate_mode
== "overwrite")
122 row
.label(text
="Target UI")
123 row
.enabled
= (id_store
.rigify_generate_mode
== "overwrite")
125 row
= col2
.row(align
=True)
126 row
.prop(id_store
, "rigify_rig_basename", text
="", icon
="SORTALPHA")
128 row
= col2
.row(align
=True)
129 for i
in range(0, len(id_store
.rigify_target_rigs
)):
130 id_store
.rigify_target_rigs
.remove(0)
132 for ob
in context
.scene
.objects
:
133 if type(ob
.data
) == bpy
.types
.Armature
and "rig_id" in ob
.data
:
134 id_store
.rigify_target_rigs
.add()
135 id_store
.rigify_target_rigs
[-1].name
= ob
.name
137 row
.prop_search(id_store
, "rigify_target_rig", id_store
, "rigify_target_rigs", text
="",
138 icon
='OUTLINER_OB_ARMATURE')
139 row
.enabled
= (id_store
.rigify_generate_mode
== "overwrite")
141 for i
in range(0, len(id_store
.rigify_rig_uis
)):
142 id_store
.rigify_rig_uis
.remove(0)
144 for t
in bpy
.data
.texts
:
145 id_store
.rigify_rig_uis
.add()
146 id_store
.rigify_rig_uis
[-1].name
= t
.name
149 row
.prop_search(id_store
, "rigify_rig_ui", id_store
, "rigify_rig_uis", text
="", icon
='TEXT')
150 row
.enabled
= (id_store
.rigify_generate_mode
== "overwrite")
153 row
.prop(id_store
, "rigify_force_widget_update")
154 if id_store
.rigify_generate_mode
== 'new':
157 elif obj
.mode
== 'EDIT':
159 collection_name
= str(id_store
.rigify_collection
).replace(" ", "")
161 for i
in range(0, len(id_store
.rigify_types
)):
162 id_store
.rigify_types
.remove(0)
164 for r
in rig_lists
.rig_list
:
166 if collection_name
== "All":
167 a
= id_store
.rigify_types
.add()
169 elif r
.startswith(collection_name
+ '.'):
170 a
= id_store
.rigify_types
.add()
172 elif (collection_name
== "None") and ("." not in r
):
173 a
= id_store
.rigify_types
.add()
178 row
.template_list("UI_UL_list", "rigify_types", id_store
, "rigify_types", id_store
, 'rigify_active_type')
180 props
= layout
.operator("armature.metarig_sample_add", text
="Add sample")
181 props
.metarig_type
= id_store
.rigify_types
[id_store
.rigify_active_type
].name
184 class DATA_PT_rigify_layer_names(bpy
.types
.Panel
):
185 bl_label
= "Rigify Layer Names"
186 bl_space_type
= 'PROPERTIES'
187 bl_region_type
= 'WINDOW'
189 bl_options
= {'DEFAULT_CLOSED'}
192 def poll(cls
, context
):
193 return context
.object.type == 'ARMATURE' and context
.active_object
.data
.get("rig_id") is None
195 def draw(self
, context
):
200 # Ensure that the layers exist
202 for i
in range(1 + len(arm
.rigify_layers
), 29):
203 arm
.rigify_layers
.add()
205 # Can't add while drawing, just use button
206 if len(arm
.rigify_layers
) < 29:
207 layout
.operator("pose.rigify_layer_init")
211 main_row
= layout
.row(align
=True).split(0.05)
212 col1
= main_row
.column()
213 col2
= main_row
.column()
216 if i
== 16 or i
== 29:
218 col1
.label(str(i
+1) + '.')
220 for i
, rigify_layer
in enumerate(arm
.rigify_layers
):
221 # note: rigify_layer == arm.rigify_layers[i]
225 col
.label(text
="Top Row:")
227 col
.label(text
="Bottom Row:")
231 row
= col
.row(align
=True)
232 icon
= 'RESTRICT_VIEW_OFF' if arm
.layers
[i
] else 'RESTRICT_VIEW_ON'
233 row
.prop(arm
, "layers", index
=i
, text
="", toggle
=True, icon
=icon
)
234 #row.prop(arm, "layers", index=i, text="Layer %d" % (i + 1), toggle=True, icon=icon)
235 row
.prop(rigify_layer
, "name", text
="")
236 row
.prop(rigify_layer
, "row", text
="UI Row")
237 icon
= 'RADIOBUT_ON' if rigify_layer
.set else 'RADIOBUT_OFF'
238 row
.prop(rigify_layer
, "set", text
="", toggle
=True, icon
=icon
)
239 row
.prop(rigify_layer
, "group", text
="Bone Group")
241 row
= col
.row(align
=True)
243 icon
= 'RESTRICT_VIEW_OFF' if arm
.layers
[i
] else 'RESTRICT_VIEW_ON'
244 row
.prop(arm
, "layers", index
=i
, text
="", toggle
=True, icon
=icon
)
245 # row.prop(arm, "layers", index=i, text="Layer %d" % (i + 1), toggle=True, icon=icon)
246 row1
= row
.split(align
=True).row(align
=True)
247 row1
.prop(rigify_layer
, "name", text
="")
248 row1
.prop(rigify_layer
, "row", text
="UI Row")
250 icon
= 'RADIOBUT_ON' if rigify_layer
.set else 'RADIOBUT_OFF'
251 row
.prop(rigify_layer
, "set", text
="", toggle
=True, icon
=icon
)
252 row
.prop(rigify_layer
, "group", text
="Bone Group")
253 if rigify_layer
.group
== 0:
254 row
.label(text
='None')
256 row
.label(text
=arm
.rigify_colors
[rigify_layer
.group
-1].name
)
259 col
.label(text
="Reserved:")
260 # reserved_names = {28: 'Root', 29: 'DEF', 30: 'MCH', 31: 'ORG'}
261 reserved_names
= {29: 'DEF', 30: 'MCH', 31: 'ORG'}
262 # for i in range(28, 32):
263 for i
in range(29, 32):
264 row
= col
.row(align
=True)
265 icon
= 'RESTRICT_VIEW_OFF' if arm
.layers
[i
] else 'RESTRICT_VIEW_ON'
266 row
.prop(arm
, "layers", index
=i
, text
="", toggle
=True, icon
=icon
)
267 row
.label(text
=reserved_names
[i
])
270 class DATA_OT_rigify_add_bone_groups(bpy
.types
.Operator
):
271 bl_idname
= "armature.rigify_add_bone_groups"
272 bl_label
= "Rigify Add Standard Bone Groups"
275 def poll(cls
, context
):
276 return context
.object.type == 'ARMATURE'
278 def execute(self
, context
):
281 if not hasattr(armature
, 'rigify_colors'):
284 groups
= ['Root', 'IK', 'Special', 'Tweak', 'FK', 'Extra']
287 if g
in armature
.rigify_colors
.keys():
290 armature
.rigify_colors
.add()
291 armature
.rigify_colors
[-1].name
= g
293 armature
.rigify_colors
[g
].select
= Color((0.3140000104904175, 0.7839999794960022, 1.0))
294 armature
.rigify_colors
[g
].active
= Color((0.5490000247955322, 1.0, 1.0))
295 armature
.rigify_colors
[g
].standard_colors_lock
= True
298 armature
.rigify_colors
[g
].normal
= Color((0.43529415130615234, 0.18431372940540314, 0.41568630933761597))
300 armature
.rigify_colors
[g
].normal
= Color((0.6039215922355652, 0.0, 0.0))
302 armature
.rigify_colors
[g
].normal
= Color((0.9568628072738647, 0.7882353663444519, 0.0470588281750679))
304 armature
.rigify_colors
[g
].normal
= Color((0.03921568766236305, 0.21176472306251526, 0.5803921818733215))
306 armature
.rigify_colors
[g
].normal
= Color((0.11764706671237946, 0.5686274766921997, 0.03529411926865578))
308 armature
.rigify_colors
[g
].normal
= Color((0.9686275124549866, 0.250980406999588, 0.0941176563501358))
313 class DATA_OT_rigify_use_standard_colors(bpy
.types
.Operator
):
314 bl_idname
= "armature.rigify_use_standard_colors"
315 bl_label
= "Rigify Get active/select colors from current theme"
318 def poll(cls
, context
):
319 return context
.object.type == 'ARMATURE'
321 def execute(self
, context
):
324 if not hasattr(armature
, 'rigify_colors'):
327 current_theme
= bpy
.context
.user_preferences
.themes
.items()[0][0]
328 theme
= bpy
.context
.user_preferences
.themes
[current_theme
]
330 armature
.rigify_selection_colors
.select
= theme
.view_3d
.bone_pose
331 armature
.rigify_selection_colors
.active
= theme
.view_3d
.bone_pose_active
333 # for col in armature.rigify_colors:
334 # col.select = theme.view_3d.bone_pose
335 # col.active = theme.view_3d.bone_pose_active
340 class DATA_OT_rigify_apply_selection_colors(bpy
.types
.Operator
):
341 bl_idname
= "armature.rigify_apply_selection_colors"
342 bl_label
= "Rigify Apply user defined active/select colors"
345 def poll(cls
, context
):
346 return context
.object.type == 'ARMATURE'
348 def execute(self
, context
):
351 if not hasattr(armature
, 'rigify_colors'):
354 #current_theme = bpy.context.user_preferences.themes.items()[0][0]
355 #theme = bpy.context.user_preferences.themes[current_theme]
357 for col
in armature
.rigify_colors
:
358 col
.select
= armature
.rigify_selection_colors
.select
359 col
.active
= armature
.rigify_selection_colors
.active
364 class DATA_OT_rigify_bone_group_add(bpy
.types
.Operator
):
365 bl_idname
= "armature.rigify_bone_group_add"
366 bl_label
= "Rigify Add Bone Group color set"
369 def poll(cls
, context
):
370 return context
.object.type == 'ARMATURE'
372 def execute(self
, context
):
376 if hasattr(armature
, 'rigify_colors'):
377 armature
.rigify_colors
.add()
378 armature
.rigify_colors
[-1].name
= unique_name(armature
.rigify_colors
, 'Group')
380 current_theme
= bpy
.context
.user_preferences
.themes
.items()[0][0]
381 theme
= bpy
.context
.user_preferences
.themes
[current_theme
]
383 armature
.rigify_colors
[-1].normal
= theme
.view_3d
.wire
384 armature
.rigify_colors
[-1].normal
.hsv
= theme
.view_3d
.wire
.hsv
385 armature
.rigify_colors
[-1].select
= theme
.view_3d
.bone_pose
386 armature
.rigify_colors
[-1].select
.hsv
= theme
.view_3d
.bone_pose
.hsv
387 armature
.rigify_colors
[-1].active
= theme
.view_3d
.bone_pose_active
388 armature
.rigify_colors
[-1].active
.hsv
= theme
.view_3d
.bone_pose_active
.hsv
393 class DATA_OT_rigify_bone_group_add_theme(bpy
.types
.Operator
):
394 bl_idname
= "armature.rigify_bone_group_add_theme"
395 bl_label
= "Rigify Add Bone Group color set from Theme"
396 bl_options
= {"REGISTER", "UNDO"}
398 theme
= bpy
.props
.EnumProperty(items
=(('THEME01', 'THEME01', ''),
399 ('THEME02', 'THEME02', ''),
400 ('THEME03', 'THEME03', ''),
401 ('THEME04', 'THEME04', ''),
402 ('THEME05', 'THEME05', ''),
403 ('THEME06', 'THEME06', ''),
404 ('THEME07', 'THEME07', ''),
405 ('THEME08', 'THEME08', ''),
406 ('THEME09', 'THEME09', ''),
407 ('THEME10', 'THEME10', ''),
408 ('THEME11', 'THEME11', ''),
409 ('THEME12', 'THEME12', ''),
410 ('THEME13', 'THEME13', ''),
411 ('THEME14', 'THEME14', ''),
412 ('THEME15', 'THEME15', ''),
413 ('THEME16', 'THEME16', ''),
414 ('THEME17', 'THEME17', ''),
415 ('THEME18', 'THEME18', ''),
416 ('THEME19', 'THEME19', ''),
417 ('THEME20', 'THEME20', '')
422 def poll(cls
, context
):
423 return context
.object.type == 'ARMATURE'
425 def execute(self
, context
):
429 if hasattr(armature
, 'rigify_colors'):
431 if self
.theme
in armature
.rigify_colors
.keys():
433 armature
.rigify_colors
.add()
434 armature
.rigify_colors
[-1].name
= self
.theme
436 id = int(self
.theme
[-2:]) - 1
438 theme_color_set
= bpy
.context
.user_preferences
.themes
[0].bone_color_sets
[id]
440 armature
.rigify_colors
[-1].normal
= theme_color_set
.normal
441 armature
.rigify_colors
[-1].select
= theme_color_set
.select
442 armature
.rigify_colors
[-1].active
= theme_color_set
.active
447 class DATA_OT_rigify_bone_group_remove(bpy
.types
.Operator
):
448 bl_idname
= "armature.rigify_bone_group_remove"
449 bl_label
= "Rigify Remove Bone Group color set"
451 idx
= bpy
.props
.IntProperty()
454 def poll(cls
, context
):
455 return context
.object.type == 'ARMATURE'
457 def execute(self
, context
):
459 obj
.data
.rigify_colors
.remove(self
.idx
)
461 # set layers references to 0
462 for l
in obj
.data
.rigify_layers
:
463 if l
.group
== self
.idx
+ 1:
465 elif l
.group
> self
.idx
+ 1:
471 class DATA_OT_rigify_bone_group_remove_all(bpy
.types
.Operator
):
472 bl_idname
= "armature.rigify_bone_group_remove_all"
473 bl_label
= "Rigify Remove All Bone Groups"
476 def poll(cls
, context
):
477 return context
.object.type == 'ARMATURE'
479 def execute(self
, context
):
482 for i
, col
in enumerate(obj
.data
.rigify_colors
):
483 obj
.data
.rigify_colors
.remove(0)
484 # set layers references to 0
485 for l
in obj
.data
.rigify_layers
:
492 class DATA_UL_rigify_bone_groups(bpy
.types
.UIList
):
493 def draw_item(self
, context
, layout
, data
, item
, icon
, active_data
, active_propname
, index
):
494 row
= layout
.row(align
=True)
495 row
= row
.split(percentage
=0.1)
496 row
.label(text
=str(index
+1))
497 row
= row
.split(percentage
=0.7)
498 row
.prop(item
, "name", text
='', emboss
=False)
499 row
= row
.row(align
=True)
500 icon
= 'LOCKED' if item
.standard_colors_lock
else 'UNLOCKED'
501 #row.prop(item, "standard_colors_lock", text='', icon=icon)
502 row
.prop(item
, "normal", text
='')
503 row2
= row
.row(align
=True)
504 row2
.prop(item
, "select", text
='')
505 row2
.prop(item
, "active", text
='')
506 #row2.enabled = not item.standard_colors_lock
507 row2
.enabled
= not bpy
.context
.object.data
.rigify_colors_lock
510 class DATA_MT_rigify_bone_groups_specials(bpy
.types
.Menu
):
511 bl_label
= 'Rigify Bone Groups Specials'
513 def draw(self
, context
):
516 layout
.operator('armature.rigify_bone_group_remove_all')
519 class DATA_PT_rigify_bone_groups(bpy
.types
.Panel
):
520 bl_label
= "Rigify Bone Groups"
521 bl_space_type
= 'PROPERTIES'
522 bl_region_type
= 'WINDOW'
524 bl_options
= {'DEFAULT_CLOSED'}
527 def poll(cls
, context
):
528 return context
.object.type == 'ARMATURE' and context
.active_object
.data
.get("rig_id") is None
530 def draw(self
, context
):
533 color_sets
= obj
.data
.rigify_colors
534 idx
= obj
.data
.rigify_colors_index
538 row
.operator("armature.rigify_use_standard_colors", icon
='FILE_REFRESH', text
='')
539 row
= row
.row(align
=True)
540 row
.prop(armature
.rigify_selection_colors
, 'select', text
='')
541 row
.prop(armature
.rigify_selection_colors
, 'active', text
='')
542 row
= layout
.row(align
=True)
543 icon
= 'LOCKED' if armature
.rigify_colors_lock
else 'UNLOCKED'
544 row
.prop(armature
, 'rigify_colors_lock', text
= 'Unified select/active colors', icon
=icon
)
545 row
.operator("armature.rigify_apply_selection_colors", icon
='FILE_REFRESH', text
='Apply')
547 row
.template_list("DATA_UL_rigify_bone_groups", "", obj
.data
, "rigify_colors", obj
.data
, "rigify_colors_index")
549 col
= row
.column(align
=True)
550 col
.operator("armature.rigify_bone_group_add", icon
='ZOOMIN', text
="")
551 col
.operator("armature.rigify_bone_group_remove", icon
='ZOOMOUT', text
="").idx
= obj
.data
.rigify_colors_index
552 col
.menu("DATA_MT_rigify_bone_groups_specials", icon
='DOWNARROW_HLT', text
="")
554 row
.prop(armature
, 'rigify_theme_to_add', text
= 'Theme')
555 op
= row
.operator("armature.rigify_bone_group_add_theme", text
="Add From Theme")
556 op
.theme
= armature
.rigify_theme_to_add
558 row
.operator("armature.rigify_add_bone_groups", text
="Add Standard")
561 class BONE_PT_rigify_buttons(bpy
.types
.Panel
):
562 bl_label
= "Rigify Type"
563 bl_space_type
= 'PROPERTIES'
564 bl_region_type
= 'WINDOW'
566 #bl_options = {'DEFAULT_OPEN'}
569 def poll(cls
, context
):
571 return context
.object.type == 'ARMATURE' and context
.active_pose_bone\
572 and context
.active_object
.data
.get("rig_id") is None
574 def draw(self
, context
):
576 id_store
= C
.window_manager
577 bone
= context
.active_pose_bone
578 collection_name
= str(id_store
.rigify_collection
).replace(" ", "")
579 rig_name
= str(context
.active_pose_bone
.rigify_type
).replace(" ", "")
584 for i
in range(0, len(id_store
.rigify_types
)):
585 id_store
.rigify_types
.remove(0)
587 for r
in rig_lists
.rig_list
:
588 if r
in rig_lists
.implementation_rigs
:
590 # collection = r.split('.')[0] # UNUSED
591 if collection_name
== "All":
592 a
= id_store
.rigify_types
.add()
594 elif r
.startswith(collection_name
+ '.'):
595 a
= id_store
.rigify_types
.add()
597 elif collection_name
== "None" and len(r
.split('.')) == 1:
598 a
= id_store
.rigify_types
.add()
603 row
.prop_search(bone
, "rigify_type", id_store
, "rigify_types", text
="Rig type:")
605 # Rig type parameters / Rig type non-exist alert
608 rig
= get_rig_type(rig_name
)
610 except (ImportError, AttributeError):
613 box
.label(text
="ALERT: type \"%s\" does not exist!" % rig_name
)
617 except AttributeError:
618 col
= layout
.column()
619 col
.label(text
="No options")
621 col
= layout
.column()
622 col
.label(text
="Options:")
624 rig
.parameters_ui(box
, bone
.rigify_parameters
)
627 class VIEW3D_PT_tools_rigify_dev(bpy
.types
.Panel
):
628 bl_label
= "Rigify Dev Tools"
629 bl_category
= 'Tools'
630 bl_space_type
= 'VIEW_3D'
631 bl_region_type
= 'TOOLS'
634 def poll(cls
, context
):
635 return context
.mode
in ['EDIT_ARMATURE', 'EDIT_MESH']
637 def draw(self
, context
):
638 obj
= context
.active_object
640 if context
.mode
== 'EDIT_ARMATURE':
641 r
= self
.layout
.row()
642 r
.operator("armature.rigify_encode_metarig", text
="Encode Metarig to Python")
643 r
= self
.layout
.row()
644 r
.operator("armature.rigify_encode_metarig_sample", text
="Encode Sample to Python")
646 if context
.mode
== 'EDIT_MESH':
647 r
= self
.layout
.row()
648 r
.operator("mesh.rigify_encode_mesh_widget", text
="Encode Mesh Widget to Python")
651 class VIEW3D_PT_rigify_animation_tools(bpy
.types
.Panel
):
652 bl_label
= "Rigify Animation Tools"
653 bl_category
= 'Tools'
654 bl_context
= "posemode"
655 bl_space_type
= 'VIEW_3D'
656 bl_region_type
= 'TOOLS'
659 def poll(cls
, context
):
660 return context
.object.type == 'ARMATURE' and context
.active_object
.data
.get("rig_id") is not None
662 def draw(self
, context
):
663 obj
= context
.active_object
664 id_store
= context
.window_manager
666 row
= self
.layout
.row()
668 if id_store
.rigify_transfer_only_selected
:
669 icon
= 'OUTLINER_DATA_ARMATURE'
671 icon
= 'ARMATURE_DATA'
673 row
.prop(id_store
, 'rigify_transfer_only_selected', toggle
=True, icon
=icon
)
675 row
= self
.layout
.row(align
=True)
676 row
.operator("rigify.ik2fk", text
='IK2FK Pose', icon
='SNAP_ON')
677 row
.operator("rigify.fk2ik", text
='FK2IK Pose', icon
='SNAP_ON')
679 row
= self
.layout
.row(align
=True)
680 row
.operator("rigify.transfer_fk_to_ik", text
='IK2FK Action', icon
='ACTION_TWEAK')
681 row
.operator("rigify.transfer_ik_to_fk", text
='FK2IK Action', icon
='ACTION_TWEAK')
683 row
= self
.layout
.row(align
=True)
684 row
.operator("rigify.clear_animation", text
="Clear IK Action", icon
='CANCEL').type = "IK"
685 row
.operator("rigify.clear_animation", text
="Clear FK Action", icon
='CANCEL').type = "FK"
687 row
= self
.layout
.row(align
=True)
688 op
= row
.operator("rigify.rotation_pole", icon
='FORCE_HARMONIC', text
='Switch to pole')
692 op
= row
.operator("rigify.rotation_pole", icon
='FORCE_MAGNETIC', text
='Switch to rotation')
696 row
= self
.layout
.row(align
=True)
697 row
.prop(id_store
, 'rigify_transfer_start_frame')
698 row
.prop(id_store
, 'rigify_transfer_end_frame')
699 row
.operator("rigify.get_frame_range", icon
='TIME', text
='')
702 def rigify_report_exception(operator
, exception
):
706 # find the module name where the error happened
707 # hint, this is the metarig type!
708 exceptionType
, exceptionValue
, exceptionTraceback
= sys
.exc_info()
709 fn
= traceback
.extract_tb(exceptionTraceback
)[-1][0]
710 fn
= os
.path
.basename(fn
)
711 fn
= os
.path
.splitext(fn
)[0]
713 if fn
.startswith("__"):
714 message
.append("Incorrect armature...")
716 message
.append("Incorrect armature for type '%s'" % fn
)
717 message
.append(exception
.message
)
719 message
.reverse() # XXX - stupid! menu's are upside down!
721 operator
.report({'INFO'}, '\n'.join(message
))
724 class LayerInit(bpy
.types
.Operator
):
725 """Initialize armature rigify layers"""
727 bl_idname
= "pose.rigify_layer_init"
728 bl_label
= "Add Rigify Layers"
729 bl_options
= {'UNDO'}
731 def execute(self
, context
):
734 for i
in range(1 + len(arm
.rigify_layers
), 30):
735 arm
.rigify_layers
.add()
736 arm
.rigify_layers
[28].name
= 'Root'
737 arm
.rigify_layers
[28].row
= 14
741 class Generate(bpy
.types
.Operator
):
742 """Generates a rig from the active metarig armature"""
744 bl_idname
= "pose.rigify_generate"
745 bl_label
= "Rigify Generate Rig"
746 bl_options
= {'UNDO'}
747 bl_description
= 'Generates a rig from the active metarig armature'
749 def execute(self
, context
):
751 importlib
.reload(generate
)
753 use_global_undo
= context
.user_preferences
.edit
.use_global_undo
754 context
.user_preferences
.edit
.use_global_undo
= False
756 generate
.generate_rig(context
, context
.object)
757 except MetarigError
as rig_exception
:
758 rigify_report_exception(self
, rig_exception
)
760 context
.user_preferences
.edit
.use_global_undo
= use_global_undo
765 class UpgradeMetarigTypes(bpy
.types
.Operator
):
766 """Upgrades metarig bones rigify_types"""
768 bl_idname
= "pose.rigify_upgrade_types"
769 bl_label
= "Rigify Upgrade Metarig Types"
770 bl_description
= 'Upgrades the rigify types on the active metarig armature'
771 bl_options
= {'UNDO'}
773 def execute(self
, context
):
774 for obj
in bpy
.data
.objects
:
775 if type(obj
.data
) == bpy
.types
.Armature
:
776 upgradeMetarigTypes(obj
)
780 class SwitchToLegacy(bpy
.types
.Operator
):
781 """Switch to Legacy mode"""
783 bl_idname
= "pose.rigify_switch_to_legacy"
784 bl_label
= "Legacy Mode will disable Rigify new features"
785 bl_description
= 'Switches Rigify to Legacy Mode'
786 bl_options
= {'UNDO'}
788 def invoke(self
, context
, event
):
789 return context
.window_manager
.invoke_confirm(self
, event
)
791 def execute(self
, context
):
792 bpy
.context
.user_preferences
.addons
['rigify'].preferences
.legacy_mode
= True
796 class Sample(bpy
.types
.Operator
):
797 """Create a sample metarig to be modified before generating """ \
800 bl_idname
= "armature.metarig_sample_add"
801 bl_label
= "Add a sample metarig for a rig type"
802 bl_options
= {'UNDO'}
804 metarig_type
= StringProperty(
806 description
="Name of the rig type to generate a sample of",
810 def execute(self
, context
):
811 if context
.mode
== 'EDIT_ARMATURE' and self
.metarig_type
!= "":
812 use_global_undo
= context
.user_preferences
.edit
.use_global_undo
813 context
.user_preferences
.edit
.use_global_undo
= False
815 rig
= get_rig_type(self
.metarig_type
)
816 create_sample
= rig
.create_sample
817 except (ImportError, AttributeError):
818 raise Exception("rig type '" + self
.metarig_type
+ "' has no sample.")
820 create_sample(context
.active_object
)
822 context
.user_preferences
.edit
.use_global_undo
= use_global_undo
823 bpy
.ops
.object.mode_set(mode
='EDIT')
828 class EncodeMetarig(bpy
.types
.Operator
):
829 """ Creates Python code that will generate the selected metarig.
831 bl_idname
= "armature.rigify_encode_metarig"
832 bl_label
= "Rigify Encode Metarig"
833 bl_options
= {'UNDO'}
836 def poll(self
, context
):
837 return context
.mode
== 'EDIT_ARMATURE'
839 def execute(self
, context
):
842 if name
in bpy
.data
.texts
:
843 text_block
= bpy
.data
.texts
[name
]
846 text_block
= bpy
.data
.texts
.new(name
)
848 text
= write_metarig(context
.active_object
, layers
=True, func_name
="create", groups
=True)
849 text_block
.write(text
)
850 bpy
.ops
.object.mode_set(mode
='EDIT')
855 class EncodeMetarigSample(bpy
.types
.Operator
):
856 """ Creates Python code that will generate the selected metarig
859 bl_idname
= "armature.rigify_encode_metarig_sample"
860 bl_label
= "Rigify Encode Metarig Sample"
861 bl_options
= {'UNDO'}
864 def poll(self
, context
):
865 return context
.mode
== 'EDIT_ARMATURE'
867 def execute(self
, context
):
868 name
= "metarig_sample.py"
870 if name
in bpy
.data
.texts
:
871 text_block
= bpy
.data
.texts
[name
]
874 text_block
= bpy
.data
.texts
.new(name
)
876 text
= write_metarig(context
.active_object
, layers
=False, func_name
="create_sample")
877 text_block
.write(text
)
878 bpy
.ops
.object.mode_set(mode
='EDIT')
883 class EncodeWidget(bpy
.types
.Operator
):
884 """ Creates Python code that will generate the selected metarig.
886 bl_idname
= "mesh.rigify_encode_mesh_widget"
887 bl_label
= "Rigify Encode Widget"
888 bl_options
= {'UNDO'}
891 def poll(self
, context
):
892 return context
.mode
== 'EDIT_MESH'
894 def execute(self
, context
):
897 if name
in bpy
.data
.texts
:
898 text_block
= bpy
.data
.texts
[name
]
901 text_block
= bpy
.data
.texts
.new(name
)
903 text
= write_widget(context
.active_object
)
904 text_block
.write(text
)
905 bpy
.ops
.object.mode_set(mode
='EDIT')
910 class OBJECT_OT_GetFrameRange(bpy
.types
.Operator
):
911 """Get start and end frame range"""
912 bl_idname
= "rigify.get_frame_range"
913 bl_label
= "Get Frame Range"
915 def execute(self
, context
):
917 id_store
= context
.window_manager
919 id_store
.rigify_transfer_start_frame
= scn
.frame_start
920 id_store
.rigify_transfer_end_frame
= scn
.frame_end
925 def FktoIk(rig
, window
='ALL'):
927 scn
= bpy
.context
.scene
928 id_store
= bpy
.context
.window_manager
930 rig_id
= rig
.data
['rig_id']
931 leg_ik2fk
= eval('bpy.ops.pose.rigify_leg_ik2fk_' + rig_id
)
932 arm_ik2fk
= eval('bpy.ops.pose.rigify_arm_ik2fk_' + rig_id
)
933 limb_generated_names
= get_limb_generated_names(rig
)
936 frames
= get_keyed_frames(rig
)
937 frames
= [f
for f
in frames
if f
in range(id_store
.rigify_transfer_start_frame
, id_store
.rigify_transfer_end_frame
+1)]
938 elif window
== 'CURRENT':
939 frames
= [scn
.frame_current
]
941 frames
= [scn
.frame_current
]
943 if not id_store
.rigify_transfer_only_selected
:
944 pbones
= rig
.pose
.bones
945 bpy
.ops
.pose
.select_all(action
='DESELECT')
947 pbones
= bpy
.context
.selected_pose_bones
948 bpy
.ops
.pose
.select_all(action
='DESELECT')
951 for group
in limb_generated_names
:
952 if b
.name
in limb_generated_names
[group
].values() or b
.name
in limb_generated_names
[group
]['controls']\
953 or b
.name
in limb_generated_names
[group
]['ik_ctrl']:
954 names
= limb_generated_names
[group
]
955 if names
['limb_type'] == 'arm':
957 controls
= names
['controls']
958 ik_ctrl
= names
['ik_ctrl']
959 fk_ctrl
= names
['fk_ctrl']
960 parent
= names
['parent']
962 rig
.pose
.bones
[controls
[0]].bone
.select
= True
963 rig
.pose
.bones
[controls
[4]].bone
.select
= True
964 rig
.pose
.bones
[pole
].bone
.select
= True
965 rig
.pose
.bones
[parent
].bone
.select
= True
966 kwargs
= {'uarm_fk': controls
[1], 'farm_fk': controls
[2], 'hand_fk': controls
[3],
967 'uarm_ik': controls
[0], 'farm_ik': ik_ctrl
[1], 'hand_ik': controls
[4],
968 'pole': pole
, 'main_parent': parent
}
969 args
= (controls
[0], controls
[1], controls
[2], controls
[3],
970 controls
[4], pole
, parent
)
973 controls
= names
['controls']
974 ik_ctrl
= names
['ik_ctrl']
975 fk_ctrl
= names
['fk_ctrl']
976 parent
= names
['parent']
978 rig
.pose
.bones
[controls
[0]].bone
.select
= True
979 rig
.pose
.bones
[controls
[6]].bone
.select
= True
980 rig
.pose
.bones
[controls
[5]].bone
.select
= True
981 rig
.pose
.bones
[pole
].bone
.select
= True
982 rig
.pose
.bones
[parent
].bone
.select
= True
983 kwargs
= {'thigh_fk': controls
[1], 'shin_fk': controls
[2], 'foot_fk': controls
[3],
984 'mfoot_fk': controls
[7], 'thigh_ik': controls
[0], 'shin_ik': ik_ctrl
[1],
985 'foot_ik': controls
[6], 'pole': pole
, 'footroll': controls
[5], 'mfoot_ik': ik_ctrl
[2],
986 'main_parent': parent
}
987 args
= (controls
[0], controls
[1], controls
[2], controls
[3],
988 controls
[6], controls
[5], pole
, parent
)
991 if not bones_in_frame(f
, rig
, *args
):
995 bpy
.ops
.anim
.keyframe_insert_menu(type='BUILTIN_KSI_VisualLocRot')
996 bpy
.ops
.anim
.keyframe_insert_menu(type='Scaling')
998 bpy
.ops
.pose
.select_all(action
='DESELECT')
999 limb_generated_names
.pop(group
)
1003 def IktoFk(rig
, window
='ALL'):
1005 scn
= bpy
.context
.scene
1006 id_store
= bpy
.context
.window_manager
1008 rig_id
= rig
.data
['rig_id']
1009 leg_fk2ik
= eval('bpy.ops.pose.rigify_leg_fk2ik_' + rig_id
)
1010 arm_fk2ik
= eval('bpy.ops.pose.rigify_arm_fk2ik_' + rig_id
)
1011 limb_generated_names
= get_limb_generated_names(rig
)
1014 frames
= get_keyed_frames(rig
)
1015 frames
= [f
for f
in frames
if f
in range(id_store
.rigify_transfer_start_frame
, id_store
.rigify_transfer_end_frame
+1)]
1016 elif window
== 'CURRENT':
1017 frames
= [scn
.frame_current
]
1019 frames
= [scn
.frame_current
]
1021 if not id_store
.rigify_transfer_only_selected
:
1022 bpy
.ops
.pose
.select_all(action
='DESELECT')
1023 pbones
= rig
.pose
.bones
1025 pbones
= bpy
.context
.selected_pose_bones
1026 bpy
.ops
.pose
.select_all(action
='DESELECT')
1029 for group
in limb_generated_names
:
1030 if b
.name
in limb_generated_names
[group
].values() or b
.name
in limb_generated_names
[group
]['controls']\
1031 or b
.name
in limb_generated_names
[group
]['ik_ctrl']:
1032 names
= limb_generated_names
[group
]
1033 if names
['limb_type'] == 'arm':
1035 controls
= names
['controls']
1036 ik_ctrl
= names
['ik_ctrl']
1037 fk_ctrl
= names
['fk_ctrl']
1038 parent
= names
['parent']
1039 pole
= names
['pole']
1040 rig
.pose
.bones
[controls
[1]].bone
.select
= True
1041 rig
.pose
.bones
[controls
[2]].bone
.select
= True
1042 rig
.pose
.bones
[controls
[3]].bone
.select
= True
1043 kwargs
= {'uarm_fk': controls
[1], 'farm_fk': controls
[2], 'hand_fk': controls
[3],
1044 'uarm_ik': controls
[0], 'farm_ik': ik_ctrl
[1],
1045 'hand_ik': controls
[4]}
1046 args
= (controls
[0], controls
[1], controls
[2], controls
[3],
1047 controls
[4], pole
, parent
)
1050 controls
= names
['controls']
1051 ik_ctrl
= names
['ik_ctrl']
1052 fk_ctrl
= names
['fk_ctrl']
1053 parent
= names
['parent']
1054 pole
= names
['pole']
1055 rig
.pose
.bones
[controls
[1]].bone
.select
= True
1056 rig
.pose
.bones
[controls
[2]].bone
.select
= True
1057 rig
.pose
.bones
[controls
[3]].bone
.select
= True
1058 kwargs
= {'thigh_fk': controls
[1], 'shin_fk': controls
[2], 'foot_fk': controls
[3],
1059 'mfoot_fk': controls
[7], 'thigh_ik': controls
[0], 'shin_ik': ik_ctrl
[1],
1060 'foot_ik': ik_ctrl
[2], 'mfoot_ik': ik_ctrl
[2]}
1061 args
= (controls
[0], controls
[1], controls
[2], controls
[3],
1062 controls
[6], controls
[5], pole
, parent
)
1065 if not bones_in_frame(f
, rig
, *args
):
1069 bpy
.ops
.anim
.keyframe_insert_menu(type='BUILTIN_KSI_VisualLocRot')
1070 bpy
.ops
.anim
.keyframe_insert_menu(type='Scaling')
1072 bpy
.ops
.pose
.select_all(action
='DESELECT')
1073 limb_generated_names
.pop(group
)
1077 def clearAnimation(act
, type, names
):
1081 if names
[group
]['limb_type'] == 'arm':
1083 bones
.extend([names
[group
]['controls'][0], names
[group
]['controls'][4]])
1085 bones
.extend([names
[group
]['controls'][1], names
[group
]['controls'][2], names
[group
]['controls'][3]])
1088 bones
.extend([names
[group
]['controls'][0], names
[group
]['controls'][6], names
[group
]['controls'][5],
1089 names
[group
]['controls'][4]])
1091 bones
.extend([names
[group
]['controls'][1], names
[group
]['controls'][2], names
[group
]['controls'][3],
1092 names
[group
]['controls'][4]])
1094 for fcu
in act
.fcurves
:
1095 words
= fcu
.data_path
.split('"')
1096 if (words
[0] == "pose.bones[" and
1104 act
.fcurves
.remove(fcu
)
1106 # Put cleared bones back to rest pose
1107 bpy
.ops
.pose
.loc_clear()
1108 bpy
.ops
.pose
.rot_clear()
1109 bpy
.ops
.pose
.scale_clear()
1114 def rotPoleToggle(rig
, window
='ALL', value
=False, toggle
=False, bake
=False):
1116 scn
= bpy
.context
.scene
1117 id_store
= bpy
.context
.window_manager
1119 rig_id
= rig
.data
['rig_id']
1120 leg_fk2ik
= eval('bpy.ops.pose.rigify_leg_fk2ik_' + rig_id
)
1121 arm_fk2ik
= eval('bpy.ops.pose.rigify_arm_fk2ik_' + rig_id
)
1122 leg_ik2fk
= eval('bpy.ops.pose.rigify_leg_ik2fk_' + rig_id
)
1123 arm_ik2fk
= eval('bpy.ops.pose.rigify_arm_ik2fk_' + rig_id
)
1124 limb_generated_names
= get_limb_generated_names(rig
)
1127 frames
= get_keyed_frames(rig
)
1128 frames
= [f
for f
in frames
if f
in range(id_store
.rigify_transfer_start_frame
, id_store
.rigify_transfer_end_frame
+1)]
1129 elif window
== 'CURRENT':
1130 frames
= [scn
.frame_current
]
1132 frames
= [scn
.frame_current
]
1134 if not id_store
.rigify_transfer_only_selected
:
1135 bpy
.ops
.pose
.select_all(action
='DESELECT')
1136 pbones
= rig
.pose
.bones
1138 pbones
= bpy
.context
.selected_pose_bones
1139 bpy
.ops
.pose
.select_all(action
='DESELECT')
1142 for group
in limb_generated_names
:
1143 names
= limb_generated_names
[group
]
1146 new_pole_vector_value
= not rig
.pose
.bones
[names
['parent']]['pole_vector']
1148 new_pole_vector_value
= value
1150 if b
.name
in names
.values() or b
.name
in names
['controls'] or b
.name
in names
['ik_ctrl']:
1151 if names
['limb_type'] == 'arm':
1154 controls
= names
['controls']
1155 ik_ctrl
= names
['ik_ctrl']
1156 fk_ctrl
= names
['fk_ctrl']
1157 parent
= names
['parent']
1158 pole
= names
['pole']
1159 rig
.pose
.bones
[controls
[0]].bone
.select
= not new_pole_vector_value
1160 rig
.pose
.bones
[controls
[4]].bone
.select
= not new_pole_vector_value
1161 rig
.pose
.bones
[parent
].bone
.select
= not new_pole_vector_value
1162 rig
.pose
.bones
[pole
].bone
.select
= new_pole_vector_value
1164 kwargs1
= {'uarm_fk': controls
[1], 'farm_fk': controls
[2], 'hand_fk': controls
[3],
1165 'uarm_ik': controls
[0], 'farm_ik': ik_ctrl
[1],
1166 'hand_ik': controls
[4]}
1167 kwargs2
= {'uarm_fk': controls
[1], 'farm_fk': controls
[2], 'hand_fk': controls
[3],
1168 'uarm_ik': controls
[0], 'farm_ik': ik_ctrl
[1], 'hand_ik': controls
[4],
1169 'pole': pole
, 'main_parent': parent
}
1170 args
= (controls
[0], controls
[4], pole
, parent
)
1174 controls
= names
['controls']
1175 ik_ctrl
= names
['ik_ctrl']
1176 fk_ctrl
= names
['fk_ctrl']
1177 parent
= names
['parent']
1178 pole
= names
['pole']
1179 rig
.pose
.bones
[controls
[0]].bone
.select
= not new_pole_vector_value
1180 rig
.pose
.bones
[controls
[6]].bone
.select
= not new_pole_vector_value
1181 rig
.pose
.bones
[controls
[5]].bone
.select
= not new_pole_vector_value
1182 rig
.pose
.bones
[parent
].bone
.select
= not new_pole_vector_value
1183 rig
.pose
.bones
[pole
].bone
.select
= new_pole_vector_value
1185 kwargs1
= {'thigh_fk': controls
[1], 'shin_fk': controls
[2], 'foot_fk': controls
[3],
1186 'mfoot_fk': controls
[7], 'thigh_ik': controls
[0], 'shin_ik': ik_ctrl
[1],
1187 'foot_ik': ik_ctrl
[2], 'mfoot_ik': ik_ctrl
[2]}
1188 kwargs2
= {'thigh_fk': controls
[1], 'shin_fk': controls
[2], 'foot_fk': controls
[3],
1189 'mfoot_fk': controls
[7], 'thigh_ik': controls
[0], 'shin_ik': ik_ctrl
[1],
1190 'foot_ik': controls
[6], 'pole': pole
, 'footroll': controls
[5], 'mfoot_ik': ik_ctrl
[2],
1191 'main_parent': parent
}
1192 args
= (controls
[0], controls
[6], controls
[5], pole
, parent
)
1195 if bake
and not bones_in_frame(f
, rig
, *args
):
1199 rig
.pose
.bones
[names
['parent']]['pole_vector'] = new_pole_vector_value
1202 bpy
.ops
.anim
.keyframe_insert_menu(type='BUILTIN_KSI_VisualLocRot')
1203 bpy
.ops
.anim
.keyframe_insert_menu(type='Scaling')
1204 overwrite_prop_animation(rig
, rig
.pose
.bones
[parent
], 'pole_vector', new_pole_vector_value
, [f
])
1206 bpy
.ops
.pose
.select_all(action
='DESELECT')
1207 limb_generated_names
.pop(group
)
1212 class OBJECT_OT_IK2FK(bpy
.types
.Operator
):
1213 """ Snaps IK limb on FK limb at current frame"""
1214 bl_idname
= "rigify.ik2fk"
1216 bl_description
= "Snaps IK limb on FK"
1218 def execute(self
,context
):
1219 rig
= context
.object
1220 id_store
= context
.window_manager
1222 FktoIk(rig
, window
='CURRENT')
1227 class OBJECT_OT_FK2IK(bpy
.types
.Operator
):
1228 """ Snaps FK limb on IK limb at current frame"""
1229 bl_idname
= "rigify.fk2ik"
1231 bl_description
= "Snaps FK limb on IK"
1233 def execute(self
,context
):
1234 rig
= context
.object
1236 IktoFk(rig
, window
='CURRENT')
1241 class OBJECT_OT_TransferFKtoIK(bpy
.types
.Operator
):
1242 """Transfers FK animation to IK"""
1243 bl_idname
= "rigify.transfer_fk_to_ik"
1244 bl_label
= "Transfer FK anim to IK"
1245 bl_description
= "Transfer FK animation to IK bones"
1247 def execute(self
, context
):
1248 rig
= context
.object
1249 id_store
= context
.window_manager
1256 class OBJECT_OT_TransferIKtoFK(bpy
.types
.Operator
):
1257 """Transfers FK animation to IK"""
1258 bl_idname
= "rigify.transfer_ik_to_fk"
1259 bl_label
= "Transfer IK anim to FK"
1260 bl_description
= "Transfer IK animation to FK bones"
1262 def execute(self
, context
):
1263 rig
= context
.object
1270 class OBJECT_OT_ClearAnimation(bpy
.types
.Operator
):
1271 bl_idname
= "rigify.clear_animation"
1272 bl_label
= "Clear Animation"
1273 bl_description
= "Clear Animation For FK or IK Bones"
1274 type = StringProperty()
1276 def execute(self
, context
):
1278 use_global_undo
= context
.user_preferences
.edit
.use_global_undo
1279 context
.user_preferences
.edit
.use_global_undo
= False
1281 rig
= context
.object
1283 if not rig
.animation_data
:
1285 act
= rig
.animation_data
.action
1289 clearAnimation(act
, self
.type, names
=get_limb_generated_names(rig
))
1291 context
.user_preferences
.edit
.use_global_undo
= use_global_undo
1295 class OBJECT_OT_Rot2Pole(bpy
.types
.Operator
):
1296 bl_idname
= "rigify.rotation_pole"
1297 bl_label
= "Rotation - Pole toggle"
1298 bl_description
= "Toggles IK chain between rotation and pole target"
1299 bone_name
= bpy
.props
.StringProperty(default
='')
1300 window
= bpy
.props
.StringProperty(default
='ALL')
1301 toggle
= bpy
.props
.BoolProperty(default
=True)
1302 value
= bpy
.props
.BoolProperty(default
=True)
1303 bake
= bpy
.props
.BoolProperty(default
=True)
1305 def execute(self
, context
):
1306 rig
= context
.object
1309 bpy
.ops
.pose
.select_all(action
='DESELECT')
1310 rig
.pose
.bones
[self
.bone_name
].bone
.select
= True
1312 rotPoleToggle(rig
, window
=self
.window
, toggle
=self
.toggle
, value
=self
.value
, bake
=self
.bake
)
1318 bpy
.utils
.register_class(DATA_OT_rigify_add_bone_groups
)
1319 bpy
.utils
.register_class(DATA_OT_rigify_use_standard_colors
)
1320 bpy
.utils
.register_class(DATA_OT_rigify_apply_selection_colors
)
1321 bpy
.utils
.register_class(DATA_OT_rigify_bone_group_add
)
1322 bpy
.utils
.register_class(DATA_OT_rigify_bone_group_add_theme
)
1323 bpy
.utils
.register_class(DATA_OT_rigify_bone_group_remove
)
1324 bpy
.utils
.register_class(DATA_OT_rigify_bone_group_remove_all
)
1325 bpy
.utils
.register_class(DATA_UL_rigify_bone_groups
)
1326 bpy
.utils
.register_class(DATA_MT_rigify_bone_groups_specials
)
1327 bpy
.utils
.register_class(DATA_PT_rigify_bone_groups
)
1328 bpy
.utils
.register_class(DATA_PT_rigify_layer_names
)
1329 bpy
.utils
.register_class(DATA_PT_rigify_buttons
)
1330 bpy
.utils
.register_class(BONE_PT_rigify_buttons
)
1331 bpy
.utils
.register_class(VIEW3D_PT_rigify_animation_tools
)
1332 bpy
.utils
.register_class(VIEW3D_PT_tools_rigify_dev
)
1333 bpy
.utils
.register_class(LayerInit
)
1334 bpy
.utils
.register_class(Generate
)
1335 bpy
.utils
.register_class(UpgradeMetarigTypes
)
1336 bpy
.utils
.register_class(SwitchToLegacy
)
1337 bpy
.utils
.register_class(Sample
)
1338 bpy
.utils
.register_class(EncodeMetarig
)
1339 bpy
.utils
.register_class(EncodeMetarigSample
)
1340 bpy
.utils
.register_class(EncodeWidget
)
1341 bpy
.utils
.register_class(OBJECT_OT_GetFrameRange
)
1342 bpy
.utils
.register_class(OBJECT_OT_FK2IK
)
1343 bpy
.utils
.register_class(OBJECT_OT_IK2FK
)
1344 bpy
.utils
.register_class(OBJECT_OT_TransferFKtoIK
)
1345 bpy
.utils
.register_class(OBJECT_OT_TransferIKtoFK
)
1346 bpy
.utils
.register_class(OBJECT_OT_ClearAnimation
)
1347 bpy
.utils
.register_class(OBJECT_OT_Rot2Pole
)
1354 bpy
.utils
.unregister_class(DATA_OT_rigify_add_bone_groups
)
1355 bpy
.utils
.unregister_class(DATA_OT_rigify_use_standard_colors
)
1356 bpy
.utils
.unregister_class(DATA_OT_rigify_apply_selection_colors
)
1357 bpy
.utils
.unregister_class(DATA_OT_rigify_bone_group_add
)
1358 bpy
.utils
.unregister_class(DATA_OT_rigify_bone_group_add_theme
)
1359 bpy
.utils
.unregister_class(DATA_OT_rigify_bone_group_remove
)
1360 bpy
.utils
.unregister_class(DATA_OT_rigify_bone_group_remove_all
)
1361 bpy
.utils
.unregister_class(DATA_UL_rigify_bone_groups
)
1362 bpy
.utils
.unregister_class(DATA_MT_rigify_bone_groups_specials
)
1363 bpy
.utils
.unregister_class(DATA_PT_rigify_bone_groups
)
1364 bpy
.utils
.unregister_class(DATA_PT_rigify_layer_names
)
1365 bpy
.utils
.unregister_class(DATA_PT_rigify_buttons
)
1366 bpy
.utils
.unregister_class(BONE_PT_rigify_buttons
)
1367 bpy
.utils
.unregister_class(VIEW3D_PT_rigify_animation_tools
)
1368 bpy
.utils
.unregister_class(VIEW3D_PT_tools_rigify_dev
)
1369 bpy
.utils
.unregister_class(LayerInit
)
1370 bpy
.utils
.unregister_class(Generate
)
1371 bpy
.utils
.unregister_class(UpgradeMetarigTypes
)
1372 bpy
.utils
.unregister_class(SwitchToLegacy
)
1373 bpy
.utils
.unregister_class(Sample
)
1374 bpy
.utils
.unregister_class(EncodeMetarig
)
1375 bpy
.utils
.unregister_class(EncodeMetarigSample
)
1376 bpy
.utils
.unregister_class(EncodeWidget
)
1377 bpy
.utils
.unregister_class(OBJECT_OT_GetFrameRange
)
1378 bpy
.utils
.unregister_class(OBJECT_OT_FK2IK
)
1379 bpy
.utils
.unregister_class(OBJECT_OT_IK2FK
)
1380 bpy
.utils
.unregister_class(OBJECT_OT_TransferFKtoIK
)
1381 bpy
.utils
.unregister_class(OBJECT_OT_TransferIKtoFK
)
1382 bpy
.utils
.unregister_class(OBJECT_OT_ClearAnimation
)
1383 bpy
.utils
.unregister_class(OBJECT_OT_Rot2Pole
)
1385 rot_mode
.unregister()