@@ -256,50 +256,29 @@ def draw(self, context):
256
256
257
257
col = layout .column (align = True )
258
258
row = col .row (align = True )
259
+ id_store = context .window_manager
259
260
260
261
layout .prop (scn , 'order_list' )
261
262
262
- col = layout .column (align = True )
263
- row = col .row (align = True )
263
+ if id_store .rigify_convert_only_selected :
264
+ icon = 'OUTLINER_DATA_ARMATURE'
265
+ else :
266
+ icon = 'ARMATURE_DATA'
264
267
265
- col .label (text = "Current Action:" )
266
- col .operator ('current.selected' )
267
- col .operator ('current.every' )
268
+ layout .prop (id_store , 'rigify_convert_only_selected' , toggle = True , icon = icon )
268
269
269
- row = col .row (align = True )
270
270
col = layout .column (align = True )
271
+ row = col .row (align = True )
271
272
272
- col .label (text = "All Actions:" )
273
- col .operator ('all.selected' )
274
- col .operator ('all.every' )
275
-
276
-
277
- class CONVERT_OT_current_action_selected_bones (bpy .types .Operator ):
278
- bl_label = 'Selected Bones'
279
- bl_idname = 'current.selected'
280
- bl_description = 'Converts selected bones in current Action'
281
- bl_options = {'REGISTER' , 'UNDO' }
282
-
283
- # on mouse up:
284
- def invoke (self , context , event ):
285
- self .execute (context )
286
- return {'FINISHED' }
287
-
288
- def execute (op , context ):
289
- obj = bpy .context .active_object
290
- pose_bones = bpy .context .selected_pose_bones
291
- action = obj .animation_data .action
292
- order = order_list [bpy .context .scene ['order_list' ]]
293
-
294
- convert .one_act_sel_bon (obj , action , pose_bones , order )
295
-
296
- return {'FINISHED' }
273
+ row .operator ('rigify_quat2eu.current' , icon = 'ACTION' )
274
+ row = col .row (align = True )
275
+ row .operator ('rigify_quat2eu.all' , icon = 'NLA' )
297
276
298
277
299
- class CONVERT_OT_current_action_every_bones (bpy .types .Operator ):
300
- bl_label = 'All Bones '
301
- bl_idname = 'current.every '
302
- bl_description = 'Converts every bone in current Action'
278
+ class CONVERT_OT_quat2eu_current_action (bpy .types .Operator ):
279
+ bl_label = 'Convert Current Action '
280
+ bl_idname = 'rigify_quat2eu.current '
281
+ bl_description = 'Converts bones in current Action'
303
282
bl_options = {'REGISTER' , 'UNDO' }
304
283
305
284
# on mouse up:
@@ -312,16 +291,20 @@ def execute(op, context):
312
291
pose_bones = bpy .context .selected_pose_bones
313
292
action = obj .animation_data .action
314
293
order = order_list [bpy .context .scene ['order_list' ]]
294
+ id_store = context .window_manager
315
295
316
- convert .one_act_every_bon (obj , action , order )
296
+ if id_store .rigify_convert_only_selected :
297
+ convert .one_act_sel_bon (obj , action , pose_bones , order )
298
+ else :
299
+ convert .one_act_every_bon (obj , action , order )
317
300
318
301
return {'FINISHED' }
319
302
320
303
321
- class CONVERT_OT_all_actions_selected_bones (bpy .types .Operator ):
322
- bl_label = 'Selected Bone '
323
- bl_idname = 'all.selected '
324
- bl_description = 'Converts selected bones in every Action'
304
+ class CONVERT_OT_quat2eu_all_actions (bpy .types .Operator ):
305
+ bl_label = 'Convert All Actions '
306
+ bl_idname = 'rigify_quat2eu.all '
307
+ bl_description = 'Converts bones in every Action'
325
308
bl_options = {'REGISTER' , 'UNDO' }
326
309
327
310
# on mouse up:
@@ -333,32 +316,19 @@ def execute(op, context):
333
316
obj = bpy .context .active_object
334
317
pose_bones = bpy .context .selected_pose_bones
335
318
order = order_list [bpy .context .scene ['order_list' ]]
319
+ id_store = context .window_manager
336
320
337
- convert .all_act_sel_bon (obj , pose_bones , order )
338
-
339
- return {'FINISHED' }
340
-
341
-
342
- class CONVERT_OT_all_action_every_bones (bpy .types .Operator ):
343
- bl_label = 'All Bone'
344
- bl_idname = 'all.every'
345
- bl_description = 'Converts every bone in every Action'
346
- bl_options = {'REGISTER' , 'UNDO' }
347
-
348
- # on mouse up:
349
- def invoke (self , context , event ):
350
- self .execute (context )
351
- return {'FINISHED' }
352
-
353
- def execute (op , context ):
354
- obj = bpy .context .active_object
355
- order = order_list [bpy .context .scene ['order_list' ]]
321
+ if id_store .rigify_convert_only_selected :
322
+ convert .all_act_sel_bon (obj , pose_bones , order )
323
+ else :
324
+ convert .all_act_every_bon (obj , order )
356
325
357
- convert .all_act_every_bon (obj , order )
358
326
return {'FINISHED' }
359
327
360
328
361
329
def register ():
330
+ IDStore = bpy .types .WindowManager
331
+
362
332
items = [('QUATERNION' , 'QUATERNION' , 'QUATERNION' ),
363
333
('XYZ' , 'XYZ' , 'XYZ' ),
364
334
('XZY' , 'XZY' , 'XZY' ),
@@ -367,21 +337,23 @@ def register():
367
337
('ZXY' , 'ZXY' , 'ZXY' ),
368
338
('ZYX' , 'ZYX' , 'ZYX' )]
369
339
370
- bpy .types .Scene .order_list = bpy .props .EnumProperty (items = items , name = 'Order ' ,
340
+ bpy .types .Scene .order_list = bpy .props .EnumProperty (items = items , name = 'Convert to ' ,
371
341
description = "The target rotation mode" , default = 'QUATERNION' )
372
342
373
- bpy .utils .register_class (ToolsPanel )
374
- bpy .utils .register_class (CONVERT_OT_all_action_every_bones )
375
- bpy .utils .register_class (CONVERT_OT_all_actions_selected_bones )
376
- bpy .utils .register_class (CONVERT_OT_current_action_every_bones )
377
- bpy .utils .register_class (CONVERT_OT_current_action_selected_bones )
343
+ IDStore .rigify_convert_only_selected = bpy .props .BoolProperty (
344
+ name = "Convert Only Selected" , description = "Convert selected bones only" , default = True )
378
345
346
+ bpy .utils .register_class (ToolsPanel )
347
+ bpy .utils .register_class (CONVERT_OT_quat2eu_current_action )
348
+ bpy .utils .register_class (CONVERT_OT_quat2eu_all_actions )
379
349
380
350
def unregister ():
351
+ IDStore = bpy .types .WindowManager
352
+
381
353
bpy .utils .unregister_class (ToolsPanel )
382
- bpy .utils .unregister_class (CONVERT_OT_all_action_every_bones )
383
- bpy .utils .unregister_class (CONVERT_OT_all_actions_selected_bones )
384
- bpy . utils . unregister_class ( CONVERT_OT_current_action_every_bones )
385
- bpy . utils . unregister_class ( CONVERT_OT_current_action_selected_bones )
354
+ bpy .utils .unregister_class (CONVERT_OT_quat2eu_current_action )
355
+ bpy .utils .unregister_class (CONVERT_OT_quat2eu_all_actions )
356
+
357
+ del IDStore . rigify_convert_only_selected
386
358
387
359
# bpy.utils.register_module(__name__)
0 commit comments