Cleanup: Anim: Replace use of T_AUTOMERGE
In the animation transform code, `T_AUTOMERGE` was used to indicate that the duplicated keys need to be merged. In perparation of #111051, this no longer makes much sense because in grease pencil we cannot have two keys in the same channel at the same frame. This PR replaces the `T_AUTOMERGE` flag in the animation code to `T_DUPLICATED_KEYS` to indicate that the transform is being called with duplicated keyframes. Pull Request: https://projects.blender.org/blender/blender/pulls/111268
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user