Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-01-20 01:43:08 +0300
committerHans Goudey <h.goudey@me.com>2021-01-20 01:43:08 +0300
commit6290091bace2fc7654dd3052b8b2553310cead13 (patch)
tree15ac3d25dac4a45ca1cac01fc60dcd2782880099 /source/blender/editors/space_node/node_draw.c
parentda6dea5701311f41c7d70429b111b901b6bcf966 (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_draw.c')
-rw-r--r--source/blender/editors/space_node/node_draw.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 04d6934cc47..6ce65cd35cb 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -951,7 +951,7 @@ void node_draw_shadow(const SpaceNode *snode, const bNode *node, float radius, f
{
const rctf *rct = &node->totr;
UI_draw_roundbox_corner_set(UI_CNR_ALL);
- ui_draw_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT);
+ ui_draw_dropshadow(rct, radius, snode->runtime->aspect, alpha, node->flag & SELECT);
}
void node_draw_sockets(const View2D *v2d,
@@ -1473,19 +1473,19 @@ static void node_draw_hidden(const bContext *C,
immVertex2f(pos, rct->xmax - dx, centy - 4.0f);
immVertex2f(pos, rct->xmax - dx, centy + 4.0f);
- immVertex2f(pos, rct->xmax - dx - 3.0f * snode->aspect, centy - 4.0f);
- immVertex2f(pos, rct->xmax - dx - 3.0f * snode->aspect, centy + 4.0f);
+ immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy - 4.0f);
+ immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy + 4.0f);
immEnd();
immUniformThemeColorShade(color_id, 30);
- dx -= snode->aspect;
+ dx -= snode->runtime->aspect;
immBegin(GPU_PRIM_LINES, 4);
immVertex2f(pos, rct->xmax - dx, centy - 4.0f);
immVertex2f(pos, rct->xmax - dx, centy + 4.0f);
- immVertex2f(pos, rct->xmax - dx - 3.0f * snode->aspect, centy - 4.0f);
- immVertex2f(pos, rct->xmax - dx - 3.0f * snode->aspect, centy + 4.0f);
+ immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy - 4.0f);
+ immVertex2f(pos, rct->xmax - dx - 3.0f * snode->runtime->aspect, centy + 4.0f);
immEnd();
immUnbindProgram();
@@ -1661,7 +1661,7 @@ static void snode_setup_v2d(SpaceNode *snode, ARegion *region, const float cente
UI_view2d_view_ortho(v2d);
/* aspect+font, set each time */
- snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)region->winx;
+ snode->runtime->aspect = BLI_rctf_size_x(&v2d->cur) / (float)region->winx;
// XXX snode->curfont = uiSetCurFont_ext(snode->aspect);
}
@@ -1717,14 +1717,15 @@ void node_draw_space(const bContext *C, ARegion *region)
GPU_depth_test(GPU_DEPTH_NONE);
GPU_scissor_test(true);
- /* XXX snode->cursor set in coordspace for placing new nodes, used for drawing noodles too */
+ /* XXX snode->runtime->cursor set in coordspace for placing new nodes, used for drawing noodles
+ * too */
UI_view2d_region_to_view(&region->v2d,
win->eventstate->x - region->winrct.xmin,
win->eventstate->y - region->winrct.ymin,
- &snode->cursor[0],
- &snode->cursor[1]);
- snode->cursor[0] /= UI_DPI_FAC;
- snode->cursor[1] /= UI_DPI_FAC;
+ &snode->runtime->cursor[0],
+ &snode->runtime->cursor[1]);
+ snode->runtime->cursor[0] /= UI_DPI_FAC;
+ snode->runtime->cursor[1] /= UI_DPI_FAC;
int grid_levels = UI_GetThemeValueType(TH_NODE_GRID_LEVELS, SPACE_NODE);
@@ -1814,7 +1815,7 @@ void node_draw_space(const bContext *C, ARegion *region)
/* temporary links */
GPU_blend(GPU_BLEND_ALPHA);
GPU_line_smooth(true);
- LISTBASE_FOREACH (bNodeLinkDrag *, nldrag, &snode->linkdrag) {
+ LISTBASE_FOREACH (bNodeLinkDrag *, nldrag, &snode->runtime->linkdrag) {
LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) {
node_draw_link(v2d, snode, (bNodeLink *)linkdata->data);
}