diff --git a/operators.py b/operators.py index 2c2fa07..b6943a2 100644 --- a/operators.py +++ b/operators.py @@ -314,6 +314,7 @@ class BW_OT_paste_bone_groups(Operator): return {'FINISHED'} + class BW_OT_add_folder(Operator): bl_idname = 'bonewidget.add_folder' bl_label = "Add Folder" @@ -421,10 +422,6 @@ class BW_OT_create_widget(Operator): def poll(cls, context): return ctx.bone and ctx.active_widget - def invoke(self, context, event): - self.symmetrize = ctx.prefs.symmetrize - return self.execute(context) - def execute(self, context): folder = ctx.active_folder blend = folder.get_widget_path(folder.active_widget) @@ -488,6 +485,8 @@ class BW_OT_edit_widget(Operator): bl_label = "Edit Widget" bl_options = {'REGISTER', 'UNDO'} + clean: BoolProperty(name='Clean', default=True) + @classmethod def poll(cls, context): return ctx.bone and ctx.bone.custom_shape @@ -495,8 +494,12 @@ class BW_OT_edit_widget(Operator): def execute(self, context): #ctx._rig = ctx.rig widgets = ctx.selected_widgets - + bones = ctx.selected_bones rig = ctx.rig + prefs = ctx.prefs + + if self.clean: + bpy.ops.bonewidget.clean_widget() bpy.ops.object.mode_set(mode='OBJECT') bpy.ops.object.select_all(action='DESELECT') @@ -507,10 +510,12 @@ class BW_OT_edit_widget(Operator): ctx.widget_layer_col.exclude = False ctx.widget_layer_col.hide_viewport = False - for w in widgets: - link_to_col(w, ctx.widget_col) - w.select_set(True) - context.view_layer.objects.active = w + for bone in bones: + if not bone.custom_shape: + continue + #link_to_col(w, ctx.widget_col) + bone.custom_shape.select_set(True) + context.view_layer.objects.active = bone.custom_shape bpy.ops.object.mode_set(mode='EDIT') @@ -523,10 +528,10 @@ class BW_OT_return_to_rig(Operator): bl_label = "Return to rig" bl_options = {'REGISTER', 'UNDO'} - symmetrize: BoolProperty(name='Symmetrize', default=True) + clean: BoolProperty(name='Clean', default=True) def invoke(self, context, event): - self.symmetrize = ctx.prefs.symmetrize + self.symmetrize = ctx.prefs.auto_symmetrize return self.execute(context) def execute(self, context): @@ -553,9 +558,8 @@ class BW_OT_return_to_rig(Operator): for b in rig.pose.bones: b.bone.select = b in bones+[bone] - if self.symmetrize: - for b in bones: - symmetrize_bone_shape(b, prefix=ctx.prefs.prefix) + if self.clean: + bpy.ops.bonewidget.clean_widget() return {'FINISHED'} @@ -703,7 +707,7 @@ class BW_OT_clean_widget(Operator): return context.object and context.object.mode == 'POSE' def invoke(self, context, event): - self.symmetrize = ctx.prefs.symmetrize + self.symmetrize = ctx.prefs.auto_symmetrize return self.execute(context) def execute(self, context): @@ -720,8 +724,8 @@ class BW_OT_clean_widget(Operator): if not shape: continue - bone.custom_shape = get_clean_shape(bone, shape, separate=True, - rename=prefs.rename, col=ctx.widget_col, prefix=prefs.prefix) + bone.custom_shape = get_clean_shape(bone, shape, separate=prefs.auto_separate, + rename=prefs.auto_rename, col=ctx.widget_col, prefix=prefs.prefix, match=prefs.auto_match_transform) if self.symmetrize: symmetrize_bone_shape(bone, prefix=ctx.prefs.prefix) diff --git a/properties.py b/properties.py index 25eaa40..38f3295 100644 --- a/properties.py +++ b/properties.py @@ -34,7 +34,7 @@ def transform_widgets(self, context): transform_mesh(shape.data, self.loc, self.rot, self.scale, self.xz_scale, self.size, self.slide, coords=coords) - if ctx.prefs.symmetrize: + if ctx.prefs.auto_symmetrize: for bone in ctx.selected_bones: flipped_bone = get_flipped_bone(bone) if flipped_bone and flipped_bone.custom_shape in shapes: @@ -212,10 +212,10 @@ class BW_prefs(AddonPreferences): prefix: StringProperty(name='Prefix', default='WGT-', description='Prefix for the shape object and data name') category: StringProperty(name='Tab', default='Rigging', update=lambda s,c: update_tab()) - symmetrize: BoolProperty(name='Symmetrize', default=True, update=undo_redo) - separate: BoolProperty(default=True, name="Separate", update=undo_redo) - match_transform: BoolProperty(default=True, name="Match Transform", update=undo_redo) - rename: BoolProperty(default=True, name="Rename", update=undo_redo) + auto_symmetrize: BoolProperty(name='Symmetrize', default=True, update=undo_redo) + auto_separate: BoolProperty(default=True, name="Separate", update=undo_redo) + auto_match_transform: BoolProperty(default=True, name="Match Transform", update=undo_redo) + auto_rename: BoolProperty(default=True, name="Rename", update=undo_redo) show_transforms: BoolProperty(default=False) show_preferences: BoolProperty(default=False) diff --git a/ui.py b/ui.py index d2bfda7..95bd3ec 100644 --- a/ui.py +++ b/ui.py @@ -84,12 +84,12 @@ def draw_prefs(layout): split.label(text='Auto:') col = split.column(align=True) - add_bool_row(col, 'symmetrize', name='Symmetrize', icon='MOD_MIRROR') - add_bool_row(col, 'separate', name='Separate', icon='UNLINKED') + add_bool_row(col, 'auto_symmetrize', name='Symmetrize', icon='MOD_MIRROR') + add_bool_row(col, 'auto_separate', name='Separate', icon='UNLINKED') #col = row.column(align=True) - add_bool_row(col, 'match_transform', name='Match Transform', icon='TRANSFORM_ORIGINS') - add_bool_row(col, 'rename', name='Rename', icon='SYNTAX_OFF') + add_bool_row(col, 'auto_match_transform', name='Match Transform', icon='TRANSFORM_ORIGINS') + add_bool_row(col, 'auto_rename', name='Rename', icon='SYNTAX_OFF') #bpy.ops.wm.save_userpref() prefs_unsaved = bpy.context.preferences.is_dirty diff --git a/widgets/Default/circle.blend b/widgets/Default/circle.blend index 7284bb2..aea8f33 100644 Binary files a/widgets/Default/circle.blend and b/widgets/Default/circle.blend differ diff --git a/widgets/Default/circle.png b/widgets/Default/circle.png index 75f33c4..b611a77 100644 Binary files a/widgets/Default/circle.png and b/widgets/Default/circle.png differ diff --git a/widgets/Default/circle_arrow.blend b/widgets/Default/circle_arrow.blend new file mode 100644 index 0000000..0d7e107 Binary files /dev/null and b/widgets/Default/circle_arrow.blend differ diff --git a/widgets/Default/circle_arrow.png b/widgets/Default/circle_arrow.png new file mode 100644 index 0000000..0a7a044 Binary files /dev/null and b/widgets/Default/circle_arrow.png differ diff --git a/widgets/Default/double_arrow.blend b/widgets/Default/double_arrow.blend new file mode 100644 index 0000000..d6705c9 Binary files /dev/null and b/widgets/Default/double_arrow.blend differ diff --git a/widgets/Default/double_arrow.png b/widgets/Default/double_arrow.png new file mode 100644 index 0000000..3d187d8 Binary files /dev/null and b/widgets/Default/double_arrow.png differ diff --git a/widgets/Default/pelvis.blend b/widgets/Default/pelvis.blend deleted file mode 100644 index 954e880..0000000 Binary files a/widgets/Default/pelvis.blend and /dev/null differ diff --git a/widgets/Default/pelvis.png b/widgets/Default/pelvis.png deleted file mode 100644 index bb20140..0000000 Binary files a/widgets/Default/pelvis.png and /dev/null differ diff --git a/widgets/Default/torso_001.blend b/widgets/Default/torso_001.blend new file mode 100644 index 0000000..94991c5 Binary files /dev/null and b/widgets/Default/torso_001.blend differ diff --git a/widgets/Default/torso_001.png b/widgets/Default/torso_001.png new file mode 100644 index 0000000..df4123d Binary files /dev/null and b/widgets/Default/torso_001.png differ