diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py index 9608c008a99..73a2f947958 100644 --- a/release/scripts/startup/bl_ui/properties_animviz.py +++ b/release/scripts/startup/bl_ui/properties_animviz.py @@ -56,7 +56,9 @@ class MotionPathButtonsPanel: # Update Selected. col = layout.column(align=True) - col.operator(f"{op_category}.paths_update", text="Update Path", icon=icon) + row = col.row(align=True) + row.operator(f"{op_category}.paths_update", text="Update Path", icon=icon) + row.operator(f"{op_category}.paths_clear", text="", icon='X').only_selected = True else: # Calculate. col = layout.column(align=True) @@ -67,7 +69,7 @@ class MotionPathButtonsPanel: # Note that 'col' is from inside the preceeding `if` or `else` block. row = col.row(align=True) row.operator("object.paths_update_visible", text="Update All Paths", icon='WORLD') - row.operator(f"{op_category}.paths_clear", text="", icon='X') + row.operator(f"{op_category}.paths_clear", text="", icon='X').only_selected = False class MotionPathButtonsPanel_display: diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index e11558722af..0dc6f3e609a 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -11,6 +11,8 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BLT_translation.h" + #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_object_types.h" @@ -427,13 +429,15 @@ static int pose_clear_paths_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/* operator callback/wrapper */ -static int pose_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static char *pose_clear_paths_description(struct bContext *UNUSED(C), + struct wmOperatorType *UNUSED(ot), + struct PointerRNA *ptr) { - if ((event->modifier & KM_SHIFT) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { - RNA_boolean_set(op->ptr, "only_selected", true); + const bool only_selected = RNA_boolean_get(ptr, "only_selected"); + if (only_selected) { + return BLI_strdup(TIP_("Clear motion paths of selected bones")); } - return pose_clear_paths_exec(C, op); + return BLI_strdup(TIP_("Clear motion paths of all bones")); } void POSE_OT_paths_clear(wmOperatorType *ot) @@ -441,12 +445,11 @@ void POSE_OT_paths_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Bone Paths"; ot->idname = "POSE_OT_paths_clear"; - ot->description = "Clear motion paths for all bones, hold Shift key for selected bones only"; /* api callbacks */ - ot->invoke = pose_clear_paths_invoke; ot->exec = pose_clear_paths_exec; ot->poll = ED_operator_posemode_exclusive; + ot->get_description = pose_clear_paths_description; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 86ea1d3be43..e9b176daf4a 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1439,13 +1439,15 @@ static int object_clear_paths_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -/* operator callback/wrapper */ -static int object_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event) +static char *object_clear_paths_description(struct bContext *UNUSED(C), + struct wmOperatorType *UNUSED(ot), + struct PointerRNA *ptr) { - if ((event->modifier & KM_SHIFT) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { - RNA_boolean_set(op->ptr, "only_selected", true); + const bool only_selected = RNA_boolean_get(ptr, "only_selected"); + if (only_selected) { + return BLI_strdup(TIP_("Clear motion paths of selected objects")); } - return object_clear_paths_exec(C, op); + return BLI_strdup(TIP_("Clear motion paths of all objects")); } void OBJECT_OT_paths_clear(wmOperatorType *ot) @@ -1453,12 +1455,11 @@ void OBJECT_OT_paths_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Object Paths"; ot->idname = "OBJECT_OT_paths_clear"; - ot->description = "Clear motion paths for all objects, hold Shift key for selected objects only"; /* api callbacks */ - ot->invoke = object_clear_paths_invoke; ot->exec = object_clear_paths_exec; ot->poll = ED_operator_object_active_editable; + ot->get_description = object_clear_paths_description; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;