Cleanup: Anim: Replace use of T_AUTOMERGE #111268

Merged
Falk David merged 2 commits from filedescriptor/blender:cleanup-anim-use-of-automerge-flag into main 2023-09-11 14:43:42 +02:00
7 changed files with 19 additions and 5 deletions

View File

@ -85,7 +85,7 @@ void ED_operatormacros_action()
WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_TRANSLATE);
RNA_boolean_set(otmacro->ptr, "use_automerge_and_split", true);
RNA_boolean_set(otmacro->ptr, "use_duplicated_keyframes", true);
RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
}

View File

@ -509,7 +509,7 @@ void ED_operatormacros_graph()
OPTYPE_UNDO | OPTYPE_REGISTER);
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
RNA_boolean_set(otmacro->ptr, "use_automerge_and_split", true);
RNA_boolean_set(otmacro->ptr, "use_duplicated_keyframes", true);
RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
}

View File

@ -147,8 +147,11 @@ enum eTFlag {
T_NO_GIZMO = 1 << 24,
T_DRAW_SNAP_SOURCE = 1 << 25,
/** Special flag for when the transform code is called after keys have been duplicated. */
T_DUPLICATED_KEYFRAMES = 1 << 26,
};
ENUM_OPERATORS(eTFlag, T_NO_GIZMO);
ENUM_OPERATORS(eTFlag, T_DUPLICATED_KEYFRAMES);
#define T_ALL_RESTRICTIONS (T_NO_CONSTRAINT | T_NULL_ONE)
#define T_PROP_EDIT_ALL (T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED)

View File

@ -1065,7 +1065,7 @@ static void special_aftertrans_update__actedit(bContext *C, TransInfo *t)
bAnimContext ac;
const bool canceled = (t->state == TRANS_CANCEL);
const bool duplicate = (t->flag & T_AUTOMERGE) != 0;
const bool duplicate = (t->flag & T_DUPLICATED_KEYFRAMES) != 0;
/* initialize relevant anim-context 'context' data */
if (ANIM_animdata_get_context(C, &ac) == 0) {

View File

@ -1005,7 +1005,7 @@ static void special_aftertrans_update__graph(bContext *C, TransInfo *t)
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
const bool canceled = (t->state == TRANS_CANCEL);
const bool duplicate = (t->flag & T_AUTOMERGE) != 0;
const bool duplicate = (t->flag & T_DUPLICATED_KEYFRAMES) != 0;
/* initialize relevant anim-context 'context' data */
if (ANIM_animdata_get_context(C, &ac) == 0) {

View File

@ -649,6 +649,14 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
if (op && (prop = RNA_struct_find_property(op->ptr, "use_duplicated_keyframes")) &&
RNA_property_is_set(op->ptr, prop))
{
if (RNA_property_boolean_get(op->ptr, prop)) {
t->flag |= T_DUPLICATED_KEYFRAMES;
}
}
/* Mirror is not supported with proportional editing, turn it off. */
#if 0
if (t->flag & T_PROP_EDIT) {

View File

@ -767,6 +767,9 @@ void Transform_Properties(wmOperatorType *ot, int flags)
prop = RNA_def_boolean(
ot->srna, "remove_on_cancel", false, "Remove on Cancel", "Remove elements on cancel");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
prop = RNA_def_boolean(
ot->srna, "use_duplicated_keyframes", false, "Duplicated Keyframes", "Transform duplicated keyframes");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
}
if (flags & P_CORRECT_UV) {