Transform: Remove internal mode 'TFM_TIME_DUPLICATE'
No functional changes. `TFM_TIME_DUPLICATE` is basically the `TIME_TRANSLATE` or `TRANSLATE` modes. The difference is that `TFM_TIME_DUPLICATE` merge duplicates keyframes at the end of the operation. It is an unexposed mode in python and promotes code duplication. It has a similar initialization to `TIME_EXTEND` which redirects to `TIME_TRANSLATE` or `TRANSLATE` depending on the spacetype. As it is dependent on other modes (as well as `TIME_EXTEND`), it makes things a bit more confusing. There's no real benefit to creating a new internal mode just to indicate this small change (merge duplicates). So indicate in another way (by properties) that you want to merge duplicate keyframes.
This commit is contained in:
committed by
Germano Cavalcante
parent
64aa96d421
commit
a83a0a811f
@@ -52,8 +52,8 @@ typedef enum {
|
||||
TFM_TIME_SLIDE,
|
||||
TFM_TIME_SCALE,
|
||||
TFM_TIME_EXTEND,
|
||||
TFM_TIME_DUPLICATE,
|
||||
TFM_BAKE_TIME,
|
||||
/* TFM_TIME_DUPLICATE (deprecated). */
|
||||
TFM_BAKE_TIME = 26,
|
||||
TFM_DEPRECATED, /* was BEVEL */
|
||||
TFM_BWEIGHT,
|
||||
TFM_ALIGN,
|
||||
|
||||
@@ -84,7 +84,8 @@ void ED_operatormacros_action(void)
|
||||
OPTYPE_UNDO | OPTYPE_REGISTER);
|
||||
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_DUPLICATE);
|
||||
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_proportional_edit", false);
|
||||
}
|
||||
|
||||
|
||||
@@ -497,8 +497,8 @@ void ED_operatormacros_graph(void)
|
||||
"Make a copy of all selected keyframes and move them",
|
||||
OPTYPE_UNDO | OPTYPE_REGISTER);
|
||||
WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
|
||||
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
|
||||
RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_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_proportional_edit", false);
|
||||
}
|
||||
|
||||
|
||||
@@ -782,7 +782,7 @@ static void special_aftertrans_update__actedit(bContext *C, TransInfo *t)
|
||||
bAnimContext ac;
|
||||
|
||||
const bool canceled = (t->state == TRANS_CANCEL);
|
||||
const bool duplicate = (t->mode == TFM_TIME_DUPLICATE);
|
||||
const bool duplicate = (t->flag & T_AUTOMERGE) != 0;
|
||||
|
||||
/* initialize relevant anim-context 'context' data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
||||
|
||||
@@ -136,7 +136,7 @@ static void bezt_to_transdata(TransData *td,
|
||||
|
||||
static bool graph_edit_is_translation_mode(TransInfo *t)
|
||||
{
|
||||
return ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE, TFM_TIME_DUPLICATE);
|
||||
return ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE);
|
||||
}
|
||||
|
||||
static bool graph_edit_use_local_center(TransInfo *t)
|
||||
@@ -983,7 +983,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->mode == TFM_TIME_DUPLICATE);
|
||||
const bool duplicate = (t->flag & T_AUTOMERGE) != 0;
|
||||
|
||||
/* initialize relevant anim-context 'context' data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
||||
|
||||
@@ -630,21 +630,19 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
|
||||
t->options |= CTX_NO_PET;
|
||||
}
|
||||
|
||||
if (t->obedit_type == OB_MESH) {
|
||||
if (op && (prop = RNA_struct_find_property(op->ptr, "use_automerge_and_split")) &&
|
||||
RNA_property_is_set(op->ptr, prop))
|
||||
{
|
||||
if (RNA_property_boolean_get(op->ptr, prop)) {
|
||||
t->flag |= T_AUTOMERGE | T_AUTOSPLIT;
|
||||
}
|
||||
if (op && (prop = RNA_struct_find_property(op->ptr, "use_automerge_and_split")) &&
|
||||
RNA_property_is_set(op->ptr, prop))
|
||||
{
|
||||
if (RNA_property_boolean_get(op->ptr, prop)) {
|
||||
t->flag |= T_AUTOMERGE | T_AUTOSPLIT;
|
||||
}
|
||||
else {
|
||||
char automerge = t->scene->toolsettings->automerge;
|
||||
if (automerge & AUTO_MERGE) {
|
||||
t->flag |= T_AUTOMERGE;
|
||||
if (automerge & AUTO_MERGE_AND_SPLIT) {
|
||||
t->flag |= T_AUTOSPLIT;
|
||||
}
|
||||
}
|
||||
else if (t->obedit_type == OB_MESH) {
|
||||
char automerge = t->scene->toolsettings->automerge;
|
||||
if (automerge & AUTO_MERGE) {
|
||||
t->flag |= T_AUTOMERGE;
|
||||
if (automerge & AUTO_MERGE_AND_SPLIT) {
|
||||
t->flag |= T_AUTOSPLIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1167,17 +1167,6 @@ void transform_mode_init(TransInfo *t, wmOperator *op, const int mode)
|
||||
case TFM_TIME_SCALE:
|
||||
initTimeScale(t);
|
||||
break;
|
||||
case TFM_TIME_DUPLICATE:
|
||||
/* same as TFM_TIME_EXTEND, but we need the mode info for later
|
||||
* so that duplicate-culling will work properly
|
||||
*/
|
||||
if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
|
||||
initTranslation(t);
|
||||
}
|
||||
else {
|
||||
initTimeTranslate(t);
|
||||
}
|
||||
break;
|
||||
case TFM_TIME_EXTEND:
|
||||
/* now that transdata has been made, do like for TFM_TIME_TRANSLATE (for most Animation
|
||||
* Editors because they have only 1D transforms for time values) or TFM_TRANSLATION
|
||||
|
||||
@@ -1380,7 +1380,8 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
|
||||
|
||||
Transform_Properties(ot,
|
||||
P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR |
|
||||
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_NAVIGATION);
|
||||
P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER | P_VIEW3D_NAVIGATION |
|
||||
P_POST_TRANSFORM);
|
||||
}
|
||||
|
||||
static int transform_from_gizmo_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
|
||||
|
||||
Reference in New Issue
Block a user