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-15 19:48:22 +0300
committerHans Goudey <h.goudey@me.com>2021-01-15 19:48:22 +0300
commit237e27e161c9ac3c6b9d74dae1cafb5ea55c0458 (patch)
treeb1f2193e6269befc4bf365573b15a89c5c76aedd /source/blender/editors/space_node/node_draw.c
parent20a54347eec65d687c8d87bb16e1e7df9cad1a8b (diff)
Cleanup: Add const in various places in node code
Also includes some various other minor cleanups, like using bool instead of int in a couple places.
Diffstat (limited to 'source/blender/editors/space_node/node_draw.c')
-rw-r--r--source/blender/editors/space_node/node_draw.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index d3fec7257f5..04d6934cc47 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -317,14 +317,14 @@ static void node_uiblocks_init(const bContext *C, bNodeTree *ntree)
}
}
-void node_to_view(struct bNode *node, float x, float y, float *rx, float *ry)
+void node_to_view(const bNode *node, float x, float y, float *rx, float *ry)
{
nodeToView(node, x, y, rx, ry);
*rx *= UI_DPI_FAC;
*ry *= UI_DPI_FAC;
}
-void node_to_updated_rect(struct bNode *node, rctf *r_rect)
+void node_to_updated_rect(const bNode *node, rctf *r_rect)
{
node_to_view(node, node->offsetx, node->offsety, &r_rect->xmin, &r_rect->ymax);
node_to_view(node,
@@ -334,7 +334,7 @@ void node_to_updated_rect(struct bNode *node, rctf *r_rect)
&r_rect->ymin);
}
-void node_from_view(struct bNode *node, float x, float y, float *rx, float *ry)
+void node_from_view(const bNode *node, float x, float y, float *rx, float *ry)
{
x /= UI_DPI_FAC;
y /= UI_DPI_FAC;
@@ -689,11 +689,11 @@ int node_get_colorid(bNode *node)
/* note: in cmp_util.c is similar code, for node_compo_pass_on()
* the same goes for shader and texture nodes. */
/* note: in node_edit.c is similar code, for untangle node */
-static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
+static void node_draw_mute_line(const View2D *v2d, const SpaceNode *snode, const bNode *node)
{
GPU_blend(GPU_BLEND_ALPHA);
- LISTBASE_FOREACH (bNodeLink *, link, &node->internal_links) {
+ LISTBASE_FOREACH (const bNodeLink *, link, &node->internal_links) {
node_draw_link_bezier(v2d, snode, link, TH_REDALERT, TH_REDALERT, -1);
}
@@ -947,14 +947,14 @@ static void node_toggle_button_cb(struct bContext *C, void *node_argv, void *op_
WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, NULL);
}
-void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
+void node_draw_shadow(const SpaceNode *snode, const bNode *node, float radius, float alpha)
{
- rctf *rct = &node->totr;
+ const rctf *rct = &node->totr;
UI_draw_roundbox_corner_set(UI_CNR_ALL);
ui_draw_dropshadow(rct, radius, snode->aspect, alpha, node->flag & SELECT);
}
-void node_draw_sockets(View2D *v2d,
+void node_draw_sockets(const View2D *v2d,
const bContext *C,
bNodeTree *ntree,
bNode *node,
@@ -1118,8 +1118,8 @@ void node_draw_sockets(View2D *v2d,
}
static void node_draw_basis(const bContext *C,
- ARegion *region,
- SpaceNode *snode,
+ const View2D *v2d,
+ const SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
bNodeInstanceKey key)
@@ -1127,8 +1127,6 @@ static void node_draw_basis(const bContext *C,
/* float socket_size = NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */
float iconbutw = 0.8f * UI_UNIT_X;
- View2D *v2d = &region->v2d;
-
/* skip if out of view */
if (BLI_rctf_isect(&node->totr, &v2d->cur, NULL) == false) {
UI_block_end(C, node->block);
@@ -1343,8 +1341,8 @@ static void node_draw_basis(const bContext *C,
}
static void node_draw_hidden(const bContext *C,
- ARegion *region,
- SpaceNode *snode,
+ const View2D *v2d,
+ const SpaceNode *snode,
bNodeTree *ntree,
bNode *node,
bNodeInstanceKey UNUSED(key))
@@ -1353,8 +1351,6 @@ static void node_draw_hidden(const bContext *C,
float centy = BLI_rctf_cent_y(rct);
float hiddenrad = BLI_rctf_size_y(rct) / 2.0f;
- View2D *v2d = &region->v2d;
-
float scale;
UI_view2d_scale_get(v2d, &scale, NULL);
@@ -1438,7 +1434,7 @@ static void node_draw_hidden(const bContext *C,
/* disable lines */
if (node->flag & NODE_MUTED) {
- node_draw_mute_line(&region->v2d, snode, node);
+ node_draw_mute_line(v2d, snode, node);
}
char showname[128]; /* 128 is used below */
@@ -1550,11 +1546,12 @@ void node_draw_default(const bContext *C,
bNode *node,
bNodeInstanceKey key)
{
+ const View2D *v2d = &region->v2d;
if (node->flag & NODE_HIDDEN) {
- node_draw_hidden(C, region, snode, ntree, node, key);
+ node_draw_hidden(C, v2d, snode, ntree, node, key);
}
else {
- node_draw_basis(C, region, snode, ntree, node, key);
+ node_draw_basis(C, v2d, snode, ntree, node, key);
}
}
@@ -1607,8 +1604,7 @@ void node_draw_nodetree(const bContext *C,
#endif
/* draw background nodes, last nodes in front */
- int a = 0;
- LISTBASE_FOREACH_INDEX (bNode *, node, &ntree->nodes, a) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
#ifdef USE_DRAW_TOT_UPDATE
/* unrelated to background nodes, update the v2d->tot,
* can be anywhere before we draw the scroll bars */
@@ -1635,8 +1631,7 @@ void node_draw_nodetree(const bContext *C,
GPU_blend(GPU_BLEND_NONE);
/* draw foreground nodes, last nodes in front */
- a = 0;
- LISTBASE_FOREACH_INDEX (bNode *, node, &ntree->nodes, a) {
+ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->flag & NODE_BACKGROUND) {
continue;
}
@@ -1686,8 +1681,8 @@ static void draw_nodetree(const bContext *C,
/* shade the parent node group and add a uiBlock to clip mouse events */
static void draw_group_overlay(const bContext *C, ARegion *region)
{
- View2D *v2d = &region->v2d;
- rctf rect = v2d->cur;
+ const View2D *v2d = &region->v2d;
+ const rctf rect = v2d->cur;
float color[4];
/* shade node groups to separate them visually */