diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-06-08 00:48:33 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-06-08 14:23:37 +0300 |
commit | e54fb1b8191ee41ce537c8e1d6bbf81fa5e0302d (patch) | |
tree | f09e64c3a7f94925f0729153e1eef707e5d8112d /source/blender/editors/transform/transform_convert_action.c | |
parent | 826769d1c7b5b56124b45512feb70d2e8607c0f5 (diff) |
Cleanup: Move each recalcData to their respective TransData file
Diffstat (limited to 'source/blender/editors/transform/transform_convert_action.c')
-rw-r--r-- | source/blender/editors/transform/transform_convert_action.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c index 21ef1539911..87256764e65 100644 --- a/source/blender/editors/transform/transform_convert_action.c +++ b/source/blender/editors/transform/transform_convert_action.c @@ -555,7 +555,7 @@ void createTransActionData(bContext *C, TransInfo *t) * \{ */ /* This function helps flush transdata written to tempdata into the gp-frames */ -void flushTransIntFrameActionData(TransInfo *t) +static void flushTransIntFrameActionData(TransInfo *t) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); tGPFtransdata *tfd = tc->custom.type.data; @@ -566,4 +566,56 @@ void flushTransIntFrameActionData(TransInfo *t) } } +/* helper for recalcData() - for Action Editor transforms */ +void recalcData_actedit(TransInfo *t) +{ + ViewLayer *view_layer = t->view_layer; + SpaceAction *saction = (SpaceAction *)t->area->spacedata.first; + + bAnimContext ac = {NULL}; + ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; + int filter; + + /* initialize relevant anim-context 'context' data from TransInfo data */ + /* NOTE: sync this with the code in ANIM_animdata_get_context() */ + ac.bmain = CTX_data_main(t->context); + ac.scene = t->scene; + ac.view_layer = t->view_layer; + ac.obact = OBACT(view_layer); + ac.area = t->area; + ac.region = t->region; + ac.sl = (t->area) ? t->area->spacedata.first : NULL; + ac.spacetype = (t->area) ? t->area->spacetype : 0; + ac.regiontype = (t->region) ? t->region->regiontype : 0; + + ANIM_animdata_context_getdata(&ac); + + /* perform flush */ + if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { + /* flush transform values back to actual coordinates */ + flushTransIntFrameActionData(t); + } + + if (ac.datatype != ANIMCONT_MASK) { + /* Get animdata blocks visible in editor, + * assuming that these will be the ones where things changed. */ + filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA); + ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); + + /* just tag these animdata-blocks to recalc, assuming that some data there changed + * BUT only do this if realtime updates are enabled + */ + if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) { + for (ale = anim_data.first; ale; ale = ale->next) { + /* set refresh tags for objects using this animation */ + ANIM_list_elem_update(CTX_data_main(t->context), t->scene, ale); + } + } + + /* now free temp channels */ + ANIM_animdata_freelist(&anim_data); + } +} + /** \} */ |