diff options
author | Hans Goudey <h.goudey@me.com> | 2021-01-20 01:43:08 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-01-20 01:43:08 +0300 |
commit | 6290091bace2fc7654dd3052b8b2553310cead13 (patch) | |
tree | 15ac3d25dac4a45ca1cac01fc60dcd2782880099 /source/blender/editors/space_node/node_relationships.c | |
parent | da6dea5701311f41c7d70429b111b901b6bcf966 (diff) |
Cleanup: Store runtime space node variables in a separate struct
This commit moves runtime-only variables from the `SpaceNode`
DNA struct to a private struct in `node_intern.h`. Before, it was hard
to tell which data needed to be saved in files, this should make it
more clear.
Node that the `edittree` field is basically a runtime variable, since
it's set from the `treepath` list on read, but moving it would require
some more invasive changes that I don't think are worth it right now.
Also, not all of the moved variables were explicitly cleared on read--
`aspect` is set at the start of a redraw, `cursor` is set in a region
callback, and `recalc` was used as an update flag.
Differential Revision: https://developer.blender.org/D10141
Diffstat (limited to 'source/blender/editors/space_node/node_relationships.c')
-rw-r--r-- | source/blender/editors/space_node/node_relationships.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index ee3cc16080d..ee7c8bca2f8 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -663,7 +663,7 @@ static void node_link_exit(bContext *C, wmOperator *op, bool apply_links) snode_dag_update(C, snode); } - BLI_remlink(&snode->linkdrag, nldrag); + BLI_remlink(&snode->runtime->linkdrag, nldrag); /* links->data pointers are either held by the tree or freed already */ BLI_freelistN(&nldrag->links); MEM_freeN(nldrag); @@ -903,7 +903,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (nldrag) { op->customdata = nldrag; - BLI_addtail(&snode->linkdrag, nldrag); + BLI_addtail(&snode->runtime->linkdrag, nldrag); /* add modal handler */ WM_event_add_modal_handler(C, op); @@ -918,7 +918,7 @@ static void node_link_cancel(bContext *C, wmOperator *op) SpaceNode *snode = CTX_wm_space_node(C); bNodeLinkDrag *nldrag = op->customdata; - BLI_remlink(&snode->linkdrag, nldrag); + BLI_remlink(&snode->runtime->linkdrag, nldrag); BLI_freelistN(&nldrag->links); MEM_freeN(nldrag); @@ -1798,7 +1798,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd, static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) { SpaceNode *snode = CTX_wm_space_node(C); - NodeInsertOfsData *iofsd = snode->iofsd; + NodeInsertOfsData *iofsd = snode->runtime->iofsd; bool redraw = false; if (!snode || event->type != TIMER || iofsd == NULL || iofsd->anim_timer != event->customdata) { @@ -1837,7 +1837,7 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w node->anim_init_locx = node->anim_ofsx = 0.0f; } - snode->iofsd = NULL; + snode->runtime->iofsd = NULL; MEM_freeN(iofsd); return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); @@ -1851,7 +1851,7 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w static int node_insert_offset_invoke(bContext *C, wmOperator *op, const wmEvent *event) { const SpaceNode *snode = CTX_wm_space_node(C); - NodeInsertOfsData *iofsd = snode->iofsd; + NodeInsertOfsData *iofsd = snode->runtime->iofsd; if (!iofsd || !iofsd->insert) { return OPERATOR_CANCELLED; @@ -1927,7 +1927,7 @@ void ED_node_link_insert(Main *bmain, ScrArea *area) iofsd->prev = link->fromnode; iofsd->next = node; - snode->iofsd = iofsd; + snode->runtime->iofsd = iofsd; } ntreeUpdateTree(bmain, snode->edittree); /* needed for pointers */ |