davidhaver-WIP-realize-depth #3

Closed
David-Haver wants to merge 65 commits from David-Haver/blender-old:davidhaver-WIP-realize-depth into WIP-realize-depth

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit 50e2511232 - Show all commits

View File

@ -882,20 +882,15 @@ static void beztmap_to_data(TransInfo *t, FCurve *fcu, BeztMap *bezms, int totve
/* This function is called by recalc_data during the Transform loop to recalculate /* This function is called by recalc_data during the Transform loop to recalculate
* the handles of curves and sort the keyframes so that the curves draw correctly. * the handles of curves and sort the keyframes so that the curves draw correctly.
* It is only called if some keyframes have moved out of order. * The Span of FCurves should only contain those that need sorting.
*
* anim_data is the list of channels (F-Curves) retrieved already containing the
* channels to work on. It should not be freed here as it may still need to be used.
*/ */
static void remake_graph_transdata(TransInfo *t, ListBase *anim_data) static void remake_graph_transdata(TransInfo *t, const blender::Span<FCurve *> fcurves)
{ {
SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0; const bool use_handle = (sipo->flag & SIPO_NOHANDLES) == 0;
/* Sort and reassign verts. */ /* Sort and reassign verts. */
LISTBASE_FOREACH (bAnimListElem *, ale, anim_data) { for (FCurve *fcu : fcurves) {
FCurve *fcu = (FCurve *)ale->key_data;
if (fcu->bezt) { if (fcu->bezt) {
BeztMap *bezm; BeztMap *bezm;
@ -927,8 +922,6 @@ static void recalcData_graphedit(TransInfo *t)
bAnimContext ac = {nullptr}; bAnimContext ac = {nullptr};
int filter; int filter;
int dosort = 0;
BKE_view_layer_synced_ensure(t->scene, t->view_layer); BKE_view_layer_synced_ensure(t->scene, t->view_layer);
/* Initialize relevant anim-context 'context' data from TransInfo data. */ /* Initialize relevant anim-context 'context' data from TransInfo data. */
@ -954,6 +947,7 @@ static void recalcData_graphedit(TransInfo *t)
ANIM_animdata_filter( ANIM_animdata_filter(
&ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype)); &ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
blender::Vector<FCurve *> unsorted_fcurves;
/* Now test if there is a need to re-sort. */ /* Now test if there is a need to re-sort. */
LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) {
FCurve *fcu = (FCurve *)ale->key_data; FCurve *fcu = (FCurve *)ale->key_data;
@ -965,7 +959,7 @@ static void recalcData_graphedit(TransInfo *t)
/* Watch it: if the time is wrong: do not correct handles yet. */ /* Watch it: if the time is wrong: do not correct handles yet. */
if (test_time_fcurve(fcu)) { if (test_time_fcurve(fcu)) {
dosort++; unsorted_fcurves.append(fcu);
} }
else { else {
BKE_fcurve_handles_recalc_ex(fcu, BEZT_FLAG_TEMP_TAG); BKE_fcurve_handles_recalc_ex(fcu, BEZT_FLAG_TEMP_TAG);
@ -979,8 +973,8 @@ static void recalcData_graphedit(TransInfo *t)
} }
/* Do resort and other updates? */ /* Do resort and other updates? */
if (dosort) { if (!unsorted_fcurves.is_empty()) {
remake_graph_transdata(t, &anim_data); remake_graph_transdata(t, unsorted_fcurves);
} }
/* Now free temp channels. */ /* Now free temp channels. */