Cleanup: Use references in node editor, other improvements
This helps to tell when a pointer is expected to be null, and avoid overly verbose code when dereferencing. This commit also includes a few other cleanups in this area: - Use const in a few places - Use `float2` instead of `float[2]` - Remove some unnecessary includes and old code The change can be continued further in the future.
This commit is contained in:
parent
ca0dbf8c26
commit
2d8606b360
|
@ -285,7 +285,7 @@ typedef struct bNodeType {
|
|||
*/
|
||||
void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
|
||||
/** Optional custom resize handle polling. */
|
||||
NodeResizeDirection (*resize_area_func)(struct bNode *node, int x, int y);
|
||||
NodeResizeDirection (*resize_area_func)(const struct bNode *node, int x, int y);
|
||||
/** Optional selection area polling. */
|
||||
int (*select_area_func)(struct bNode *node, int x, int y);
|
||||
/** Optional tweak area polling (for grabbing). */
|
||||
|
@ -555,7 +555,7 @@ void ntreeInterfaceTypeUpdate(struct bNodeTree *ntree);
|
|||
struct bNodeType *nodeTypeFind(const char *idname);
|
||||
void nodeRegisterType(struct bNodeType *ntype);
|
||||
void nodeUnregisterType(struct bNodeType *ntype);
|
||||
bool nodeTypeUndefined(struct bNode *node);
|
||||
bool nodeTypeUndefined(const struct bNode *node);
|
||||
struct GHashIterator *nodeTypeGetIterator(void);
|
||||
|
||||
/* Helper macros for iterating over node types. */
|
||||
|
|
|
@ -1455,7 +1455,7 @@ void nodeUnregisterType(bNodeType *nt)
|
|||
BLI_ghash_remove(nodetypes_hash, nt->idname, nullptr, node_free_type);
|
||||
}
|
||||
|
||||
bool nodeTypeUndefined(bNode *node)
|
||||
bool nodeTypeUndefined(const bNode *node)
|
||||
{
|
||||
return (node->typeinfo == &NodeTypeUndefined) ||
|
||||
((ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) && node->id &&
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
* \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
|
||||
*/
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_system.h"
|
||||
#include "BLI_threads.h"
|
||||
|
||||
|
@ -79,6 +77,8 @@
|
|||
#include "NOD_texture.h"
|
||||
#include "node_intern.hh" /* own include */
|
||||
|
||||
using blender::float2;
|
||||
|
||||
/* Default flags for uiItemR(). Name is kept short since this is used a lot in this file. */
|
||||
#define DEFAULT_FLAGS UI_ITEM_R_SPLIT_EMPTY_NAME
|
||||
|
||||
|
@ -250,7 +250,7 @@ static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
|
|||
uiItemR(layout, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static NodeResizeDirection node_resize_area_default(bNode *node, const int x, const int y)
|
||||
static NodeResizeDirection node_resize_area_default(const bNode *node, const int x, const int y)
|
||||
{
|
||||
if (node->flag & NODE_HIDDEN) {
|
||||
rctf totr = node->totr;
|
||||
|
@ -264,7 +264,7 @@ static NodeResizeDirection node_resize_area_default(bNode *node, const int x, co
|
|||
}
|
||||
|
||||
const float size = NODE_RESIZE_MARGIN;
|
||||
rctf totr = node->totr;
|
||||
const rctf &totr = node->totr;
|
||||
NodeResizeDirection dir = NODE_RESIZE_NONE;
|
||||
|
||||
if (x >= totr.xmax - size && x < totr.xmax && y >= totr.ymin && y < totr.ymax) {
|
||||
|
@ -295,9 +295,9 @@ static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree,
|
|||
|
||||
/* init rect from current frame size */
|
||||
rctf rect;
|
||||
node_to_view(node, node->offsetx, node->offsety, &rect.xmin, &rect.ymax);
|
||||
node_to_view(*node, node->offsetx, node->offsety, &rect.xmin, &rect.ymax);
|
||||
node_to_view(
|
||||
node, node->offsetx + node->width, node->offsety - node->height, &rect.xmax, &rect.ymin);
|
||||
*node, node->offsetx + node->width, node->offsety - node->height, &rect.xmax, &rect.ymin);
|
||||
|
||||
/* frame can be resized manually only if shrinking is disabled or no children are attached */
|
||||
data->flag |= NODE_FRAME_RESIZEABLE;
|
||||
|
@ -328,25 +328,25 @@ static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree,
|
|||
}
|
||||
|
||||
/* now adjust the frame size from view-space bounding box */
|
||||
node_from_view(node, rect.xmin, rect.ymax, &node->offsetx, &node->offsety);
|
||||
node_from_view(*node, rect.xmin, rect.ymax, &node->offsetx, &node->offsety);
|
||||
float xmax, ymax;
|
||||
node_from_view(node, rect.xmax, rect.ymin, &xmax, &ymax);
|
||||
node_from_view(*node, rect.xmax, rect.ymin, &xmax, &ymax);
|
||||
node->width = xmax - node->offsetx;
|
||||
node->height = -ymax + node->offsety;
|
||||
|
||||
node->totr = rect;
|
||||
}
|
||||
|
||||
static void node_draw_frame_label(bNodeTree *ntree, bNode *node, SpaceNode *snode)
|
||||
static void node_draw_frame_label(bNodeTree &ntree, bNode &node, SpaceNode &snode)
|
||||
{
|
||||
const float aspect = snode->runtime->aspect;
|
||||
const float aspect = snode.runtime->aspect;
|
||||
/* XXX font id is crap design */
|
||||
const int fontid = UI_style_get()->widgetlabel.uifont_id;
|
||||
NodeFrame *data = (NodeFrame *)node->storage;
|
||||
NodeFrame *data = (NodeFrame *)node.storage;
|
||||
const float font_size = data->label_size / aspect;
|
||||
|
||||
char label[MAX_NAME];
|
||||
nodeLabel(ntree, node, label, sizeof(label));
|
||||
nodeLabel(&ntree, &node, label, sizeof(label));
|
||||
|
||||
BLF_enable(fontid, BLF_ASPECT);
|
||||
BLF_aspect(fontid, aspect, aspect, 1.0f);
|
||||
|
@ -365,39 +365,39 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, SpaceNode *snod
|
|||
const int label_height = ((margin / aspect) + (ascender * aspect));
|
||||
|
||||
/* 'x' doesn't need aspect correction */
|
||||
rctf *rct = &node->totr;
|
||||
const rctf &rct = node.totr;
|
||||
/* XXX a bit hacky, should use separate align values for x and y */
|
||||
float x = BLI_rctf_cent_x(rct) - (0.5f * width);
|
||||
float y = rct->ymax - label_height;
|
||||
float x = BLI_rctf_cent_x(&rct) - (0.5f * width);
|
||||
float y = rct.ymax - label_height;
|
||||
|
||||
/* label */
|
||||
const bool has_label = node->label[0] != '\0';
|
||||
const bool has_label = node.label[0] != '\0';
|
||||
if (has_label) {
|
||||
BLF_position(fontid, x, y, 0);
|
||||
BLF_draw(fontid, label, BLF_DRAW_STR_DUMMY_MAX);
|
||||
}
|
||||
|
||||
/* draw text body */
|
||||
if (node->id) {
|
||||
Text *text = (Text *)node->id;
|
||||
if (node.id) {
|
||||
Text *text = (Text *)node.id;
|
||||
const int line_height_max = BLF_height_max(fontid);
|
||||
const float line_spacing = (line_height_max * aspect);
|
||||
const float line_width = (BLI_rctf_size_x(rct) - margin) / aspect;
|
||||
const float line_width = (BLI_rctf_size_x(&rct) - margin) / aspect;
|
||||
|
||||
/* 'x' doesn't need aspect correction */
|
||||
x = rct->xmin + margin;
|
||||
y = rct->ymax - label_height - (has_label ? line_spacing : 0);
|
||||
x = rct.xmin + margin;
|
||||
y = rct.ymax - label_height - (has_label ? line_spacing : 0);
|
||||
|
||||
/* early exit */
|
||||
int y_min = y + ((margin * 2) - (y - rct->ymin));
|
||||
int y_min = y + ((margin * 2) - (y - rct.ymin));
|
||||
|
||||
BLF_enable(fontid, BLF_CLIPPING | BLF_WORD_WRAP);
|
||||
BLF_clipping(fontid,
|
||||
rct->xmin,
|
||||
rct.xmin,
|
||||
/* round to avoid clipping half-way through a line */
|
||||
y - (floorf(((y - rct->ymin) - (margin * 2)) / line_spacing) * line_spacing),
|
||||
rct->xmin + line_width,
|
||||
rct->ymax);
|
||||
y - (floorf(((y - rct.ymin) - (margin * 2)) / line_spacing) * line_spacing),
|
||||
rct.xmin + line_width,
|
||||
rct.ymax);
|
||||
|
||||
BLF_wordwrap(fontid, line_width);
|
||||
|
||||
|
@ -442,7 +442,7 @@ static void node_draw_frame(const bContext *C,
|
|||
const float alpha = color[3];
|
||||
|
||||
/* shadow */
|
||||
node_draw_shadow(snode, node, BASIS_RAD, alpha);
|
||||
node_draw_shadow(*snode, *node, BASIS_RAD, alpha);
|
||||
|
||||
/* body */
|
||||
if (node->flag & NODE_CUSTOM_COLOR) {
|
||||
|
@ -452,9 +452,9 @@ static void node_draw_frame(const bContext *C,
|
|||
UI_GetThemeColor4fv(TH_NODE_FRAME, color);
|
||||
}
|
||||
|
||||
const rctf *rct = &node->totr;
|
||||
const rctf &rct = node->totr;
|
||||
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
||||
UI_draw_roundbox_4fv(rct, true, BASIS_RAD, color);
|
||||
UI_draw_roundbox_4fv(&rct, true, BASIS_RAD, color);
|
||||
|
||||
/* outline active and selected emphasis */
|
||||
if (node->flag & SELECT) {
|
||||
|
@ -465,20 +465,20 @@ static void node_draw_frame(const bContext *C,
|
|||
UI_GetThemeColorShadeAlpha4fv(TH_SELECT, 0, -40, color);
|
||||
}
|
||||
|
||||
UI_draw_roundbox_aa(rct, false, BASIS_RAD, color);
|
||||
UI_draw_roundbox_aa(&rct, false, BASIS_RAD, color);
|
||||
}
|
||||
|
||||
/* label and text */
|
||||
node_draw_frame_label(ntree, node, snode);
|
||||
node_draw_frame_label(*ntree, *node, *snode);
|
||||
|
||||
node_draw_extra_info_panel(snode, node);
|
||||
node_draw_extra_info_panel(*snode, *node);
|
||||
|
||||
UI_block_end(C, node->block);
|
||||
UI_block_draw(C, node->block);
|
||||
node->block = nullptr;
|
||||
}
|
||||
|
||||
static NodeResizeDirection node_resize_area_frame(bNode *node, const int x, const int y)
|
||||
static NodeResizeDirection node_resize_area_frame(const bNode *node, const int x, const int y)
|
||||
{
|
||||
const float size = 10.0f;
|
||||
NodeFrame *data = (NodeFrame *)node->storage;
|
||||
|
@ -522,7 +522,7 @@ static void node_draw_reroute_prepare(const bContext *UNUSED(C),
|
|||
{
|
||||
/* get "global" coords */
|
||||
float locx, locy;
|
||||
node_to_view(node, 0.0f, 0.0f, &locx, &locy);
|
||||
node_to_view(*node, 0.0f, 0.0f, &locx, &locy);
|
||||
|
||||
/* reroute node has exactly one input and one output, both in the same place */
|
||||
bNodeSocket *nsock = (bNodeSocket *)node->outputs.first;
|
||||
|
@ -549,46 +549,16 @@ static void node_draw_reroute(const bContext *C,
|
|||
bNodeInstanceKey UNUSED(key))
|
||||
{
|
||||
char showname[128]; /* 128 used below */
|
||||
rctf *rct = &node->totr;
|
||||
const rctf &rct = node->totr;
|
||||
|
||||
/* skip if out of view */
|
||||
if (node->totr.xmax < region->v2d.cur.xmin || node->totr.xmin > region->v2d.cur.xmax ||
|
||||
node->totr.ymax < region->v2d.cur.ymin || node->totr.ymin > region->v2d.cur.ymax) {
|
||||
if (rct.xmax < region->v2d.cur.xmin || rct.xmin > region->v2d.cur.xmax ||
|
||||
rct.ymax < region->v2d.cur.ymin || node->totr.ymin > region->v2d.cur.ymax) {
|
||||
UI_block_end(C, node->block);
|
||||
node->block = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
/* XXX only kept for debugging
|
||||
* selection state is indicated by socket outline below!
|
||||
*/
|
||||
#if 0
|
||||
float size = NODE_REROUTE_SIZE;
|
||||
|
||||
/* body */
|
||||
float debug_color[4];
|
||||
UI_draw_roundbox_corner_set(UI_CNR_ALL);
|
||||
UI_GetThemeColor4fv(TH_NODE, debug_color);
|
||||
UI_draw_roundbox_aa(true, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size, debug_color);
|
||||
|
||||
/* outline active and selected emphasis */
|
||||
if (node->flag & SELECT) {
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPU_line_smooth(true);
|
||||
/* Using different shades of #TH_TEXT_HI for the emphasis, like triangle. */
|
||||
if (node->flag & NODE_ACTIVE) {
|
||||
UI_GetThemeColorShadeAlpha4fv(TH_TEXT_HI, 0, -40, debug_color);
|
||||
}
|
||||
else {
|
||||
UI_GetThemeColorShadeAlpha4fv(TH_TEXT_HI, -20, -120, debug_color);
|
||||
}
|
||||
UI_draw_roundbox_4fv(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size, debug_color);
|
||||
|
||||
GPU_line_smooth(false);
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (node->label[0] != '\0') {
|
||||
/* draw title (node label) */
|
||||
BLI_strncpy(showname, node->label, sizeof(showname));
|
||||
|
@ -596,8 +566,8 @@ static void node_draw_reroute(const bContext *C,
|
|||
UI_BTYPE_LABEL,
|
||||
0,
|
||||
showname,
|
||||
(int)(rct->xmin - NODE_DYS),
|
||||
(int)(rct->ymax),
|
||||
(int)(rct.xmin - NODE_DYS),
|
||||
(int)(rct.ymax),
|
||||
(short)512,
|
||||
(short)NODE_DY,
|
||||
nullptr,
|
||||
|
@ -611,7 +581,7 @@ static void node_draw_reroute(const bContext *C,
|
|||
/* only draw input socket. as they all are placed on the same position.
|
||||
* highlight also if node itself is selected, since we don't display the node body separately!
|
||||
*/
|
||||
node_draw_sockets(®ion->v2d, C, ntree, node, false, node->flag & SELECT);
|
||||
node_draw_sockets(region->v2d, *C, *ntree, *node, false, node->flag & SELECT);
|
||||
|
||||
UI_block_end(C, node->block);
|
||||
UI_block_draw(C, node->block);
|
||||
|
@ -3615,7 +3585,7 @@ static void std_node_socket_draw(
|
|||
|
||||
if (socket_needs_attribute_search(*node, *sock)) {
|
||||
const bNodeTree *node_tree = (const bNodeTree *)node_ptr->owner_id;
|
||||
node_geometry_add_attribute_search_button(C, node_tree, node, ptr, row);
|
||||
node_geometry_add_attribute_search_button(*C, *node_tree, *node, *ptr, *row);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", 0);
|
||||
|
@ -3764,23 +3734,23 @@ void ED_init_node_socket_type_virtual(bNodeSocketType *stype)
|
|||
|
||||
/* ************** Generic drawing ************** */
|
||||
|
||||
void draw_nodespace_back_pix(const bContext *C,
|
||||
ARegion *region,
|
||||
SpaceNode *snode,
|
||||
void draw_nodespace_back_pix(const bContext &C,
|
||||
ARegion ®ion,
|
||||
SpaceNode &snode,
|
||||
bNodeInstanceKey parent_key)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
bNodeInstanceKey active_viewer_key = (snode->nodetree ? snode->nodetree->active_viewer_key :
|
||||
NODE_INSTANCE_KEY_NONE);
|
||||
Main *bmain = CTX_data_main(&C);
|
||||
bNodeInstanceKey active_viewer_key = (snode.nodetree ? snode.nodetree->active_viewer_key :
|
||||
NODE_INSTANCE_KEY_NONE);
|
||||
GPU_matrix_push_projection();
|
||||
GPU_matrix_push();
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
wmOrtho2_region_pixelspace(®ion);
|
||||
GPU_matrix_identity_set();
|
||||
ED_region_draw_cb_draw(C, region, REGION_DRAW_BACKDROP);
|
||||
ED_region_draw_cb_draw(&C, ®ion, REGION_DRAW_BACKDROP);
|
||||
GPU_matrix_pop_projection();
|
||||
GPU_matrix_pop();
|
||||
|
||||
if (!(snode->flag & SNODE_BACKDRAW) || !ED_node_is_compositor(snode)) {
|
||||
if (!(snode.flag & SNODE_BACKDRAW) || !ED_node_is_compositor(&snode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3795,7 +3765,7 @@ void draw_nodespace_back_pix(const bContext *C,
|
|||
GPUFrameBuffer *old_fb = GPU_framebuffer_active_get();
|
||||
GPU_framebuffer_restore();
|
||||
BLI_thread_lock(LOCK_DRAW_IMAGE);
|
||||
DRW_draw_view(C);
|
||||
DRW_draw_view(&C);
|
||||
BLI_thread_unlock(LOCK_DRAW_IMAGE);
|
||||
GPU_framebuffer_bind_no_srgb(old_fb);
|
||||
/* Draw manager changes the depth state. Set it back to NONE. Without this the node preview
|
||||
|
@ -3807,31 +3777,31 @@ void draw_nodespace_back_pix(const bContext *C,
|
|||
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock);
|
||||
if (ibuf) {
|
||||
/* somehow the offset has to be calculated inverse */
|
||||
wmOrtho2_region_pixelspace(region);
|
||||
const float x = (region->winx - snode->zoom * ibuf->x) / 2 + snode->xof;
|
||||
const float y = (region->winy - snode->zoom * ibuf->y) / 2 + snode->yof;
|
||||
wmOrtho2_region_pixelspace(®ion);
|
||||
const float x = (region.winx - snode.zoom * ibuf->x) / 2 + snode.xof;
|
||||
const float y = (region.winy - snode.zoom * ibuf->y) / 2 + snode.yof;
|
||||
|
||||
/** \note draw selected info on backdrop */
|
||||
if (snode->edittree) {
|
||||
bNode *node = (bNode *)snode->edittree->nodes.first;
|
||||
rctf *viewer_border = &snode->nodetree->viewer_border;
|
||||
if (snode.edittree) {
|
||||
bNode *node = (bNode *)snode.edittree->nodes.first;
|
||||
rctf *viewer_border = &snode.nodetree->viewer_border;
|
||||
while (node) {
|
||||
if (node->flag & NODE_SELECT) {
|
||||
if (node->typeinfo->draw_backdrop) {
|
||||
node->typeinfo->draw_backdrop(snode, ibuf, node, x, y);
|
||||
node->typeinfo->draw_backdrop(&snode, ibuf, node, x, y);
|
||||
}
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
if ((snode->nodetree->flag & NTREE_VIEWER_BORDER) &&
|
||||
if ((snode.nodetree->flag & NTREE_VIEWER_BORDER) &&
|
||||
viewer_border->xmin < viewer_border->xmax && viewer_border->ymin < viewer_border->ymax) {
|
||||
rcti pixel_border;
|
||||
BLI_rcti_init(&pixel_border,
|
||||
x + snode->zoom * viewer_border->xmin * ibuf->x,
|
||||
x + snode->zoom * viewer_border->xmax * ibuf->x,
|
||||
y + snode->zoom * viewer_border->ymin * ibuf->y,
|
||||
y + snode->zoom * viewer_border->ymax * ibuf->y);
|
||||
x + snode.zoom * viewer_border->xmin * ibuf->x,
|
||||
x + snode.zoom * viewer_border->xmax * ibuf->x,
|
||||
y + snode.zoom * viewer_border->ymin * ibuf->y,
|
||||
y + snode.zoom * viewer_border->ymax * ibuf->y);
|
||||
|
||||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
@ -3853,7 +3823,7 @@ void draw_nodespace_back_pix(const bContext *C,
|
|||
/* return quadratic beziers points for a given nodelink and clip if v2d is not nullptr. */
|
||||
bool node_link_bezier_handles(const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link,
|
||||
const bNodeLink &link,
|
||||
float vec[4][2])
|
||||
{
|
||||
float cursor[2] = {0.0f, 0.0f};
|
||||
|
@ -3867,17 +3837,17 @@ bool node_link_bezier_handles(const View2D *v2d,
|
|||
|
||||
/* in v0 and v3 we put begin/end points */
|
||||
int toreroute, fromreroute;
|
||||
if (link->fromsock) {
|
||||
vec[0][0] = link->fromsock->locx;
|
||||
vec[0][1] = link->fromsock->locy;
|
||||
if (link->fromsock->flag & SOCK_MULTI_INPUT) {
|
||||
node_link_calculate_multi_input_position(link->fromsock->locx,
|
||||
link->fromsock->locy,
|
||||
link->fromsock->total_inputs - 1,
|
||||
link->fromsock->total_inputs,
|
||||
if (link.fromsock) {
|
||||
vec[0][0] = link.fromsock->locx;
|
||||
vec[0][1] = link.fromsock->locy;
|
||||
if (link.fromsock->flag & SOCK_MULTI_INPUT) {
|
||||
node_link_calculate_multi_input_position(link.fromsock->locx,
|
||||
link.fromsock->locy,
|
||||
link.fromsock->total_inputs - 1,
|
||||
link.fromsock->total_inputs,
|
||||
vec[0]);
|
||||
}
|
||||
fromreroute = (link->fromnode && link->fromnode->type == NODE_REROUTE);
|
||||
fromreroute = (link.fromnode && link.fromnode->type == NODE_REROUTE);
|
||||
}
|
||||
else {
|
||||
if (snode == nullptr) {
|
||||
|
@ -3886,17 +3856,17 @@ bool node_link_bezier_handles(const View2D *v2d,
|
|||
copy_v2_v2(vec[0], cursor);
|
||||
fromreroute = 0;
|
||||
}
|
||||
if (link->tosock) {
|
||||
vec[3][0] = link->tosock->locx;
|
||||
vec[3][1] = link->tosock->locy;
|
||||
if (!(link->tonode->flag & NODE_HIDDEN) && link->tosock->flag & SOCK_MULTI_INPUT) {
|
||||
node_link_calculate_multi_input_position(link->tosock->locx,
|
||||
link->tosock->locy,
|
||||
link->multi_input_socket_index,
|
||||
link->tosock->total_inputs,
|
||||
if (link.tosock) {
|
||||
vec[3][0] = link.tosock->locx;
|
||||
vec[3][1] = link.tosock->locy;
|
||||
if (!(link.tonode->flag & NODE_HIDDEN) && link.tosock->flag & SOCK_MULTI_INPUT) {
|
||||
node_link_calculate_multi_input_position(link.tosock->locx,
|
||||
link.tosock->locy,
|
||||
link.multi_input_socket_index,
|
||||
link.tosock->total_inputs,
|
||||
vec[3]);
|
||||
}
|
||||
toreroute = (link->tonode && link->tonode->type == NODE_REROUTE);
|
||||
toreroute = (link.tonode && link.tonode->type == NODE_REROUTE);
|
||||
}
|
||||
else {
|
||||
if (snode == nullptr) {
|
||||
|
@ -3962,7 +3932,7 @@ bool node_link_bezier_handles(const View2D *v2d,
|
|||
/* if v2d not nullptr, it clips and returns 0 if not visible */
|
||||
bool node_link_bezier_points(const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link,
|
||||
const bNodeLink &link,
|
||||
float coord_array[][2],
|
||||
const int resol)
|
||||
{
|
||||
|
@ -4190,7 +4160,7 @@ static char nodelink_get_color_id(int th_col)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void nodelink_batch_draw(const SpaceNode *snode)
|
||||
static void nodelink_batch_draw(const SpaceNode &snode)
|
||||
{
|
||||
if (g_batch_link.count == 0) {
|
||||
return;
|
||||
|
@ -4210,7 +4180,7 @@ static void nodelink_batch_draw(const SpaceNode *snode)
|
|||
|
||||
GPU_batch_program_set_builtin(g_batch_link.batch, GPU_SHADER_2D_NODELINK_INST);
|
||||
GPU_batch_uniform_4fv_array(g_batch_link.batch, "colors", 6, colors);
|
||||
GPU_batch_uniform_1f(g_batch_link.batch, "expandSize", snode->runtime->aspect * LINK_WIDTH);
|
||||
GPU_batch_uniform_1f(g_batch_link.batch, "expandSize", snode.runtime->aspect * LINK_WIDTH);
|
||||
GPU_batch_uniform_1f(g_batch_link.batch, "arrowSize", ARROW_SIZE);
|
||||
GPU_batch_draw(g_batch_link.batch);
|
||||
|
||||
|
@ -4219,22 +4189,22 @@ static void nodelink_batch_draw(const SpaceNode *snode)
|
|||
GPU_blend(GPU_BLEND_NONE);
|
||||
}
|
||||
|
||||
void nodelink_batch_start(SpaceNode *UNUSED(snode))
|
||||
void nodelink_batch_start(SpaceNode &UNUSED(snode))
|
||||
{
|
||||
g_batch_link.enabled = true;
|
||||
}
|
||||
|
||||
void nodelink_batch_end(SpaceNode *snode)
|
||||
void nodelink_batch_end(SpaceNode &snode)
|
||||
{
|
||||
nodelink_batch_draw(snode);
|
||||
g_batch_link.enabled = false;
|
||||
}
|
||||
|
||||
static void nodelink_batch_add_link(const SpaceNode *snode,
|
||||
const float p0[2],
|
||||
const float p1[2],
|
||||
const float p2[2],
|
||||
const float p3[2],
|
||||
static void nodelink_batch_add_link(const SpaceNode &snode,
|
||||
const float2 &p0,
|
||||
const float2 &p1,
|
||||
const float2 &p2,
|
||||
const float2 &p3,
|
||||
int th_col1,
|
||||
int th_col2,
|
||||
int th_col3,
|
||||
|
@ -4277,13 +4247,13 @@ static void nodelink_batch_add_link(const SpaceNode *snode,
|
|||
}
|
||||
|
||||
/* don't do shadows if th_col3 is -1. */
|
||||
void node_draw_link_bezier(const bContext *C,
|
||||
const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link,
|
||||
int th_col1,
|
||||
int th_col2,
|
||||
int th_col3)
|
||||
void node_draw_link_bezier(const bContext &C,
|
||||
const View2D &v2d,
|
||||
const SpaceNode &snode,
|
||||
const bNodeLink &link,
|
||||
const int th_col1,
|
||||
const int th_col2,
|
||||
const int th_col3)
|
||||
{
|
||||
const float dim_factor = node_link_dim_factor(v2d, link);
|
||||
float thickness = 1.5f;
|
||||
|
@ -4292,8 +4262,8 @@ void node_draw_link_bezier(const bContext *C,
|
|||
bTheme *btheme = UI_GetTheme();
|
||||
const float dash_alpha = btheme->space_node.dash_alpha;
|
||||
|
||||
if (snode->edittree->type == NTREE_GEOMETRY) {
|
||||
if (link->fromsock && link->fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) {
|
||||
if (snode.edittree->type == NTREE_GEOMETRY) {
|
||||
if (link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) {
|
||||
/* Make field links a bit thinner. */
|
||||
thickness = 1.0f;
|
||||
/* Draw field as dashes. */
|
||||
|
@ -4302,11 +4272,11 @@ void node_draw_link_bezier(const bContext *C,
|
|||
}
|
||||
|
||||
float vec[4][2];
|
||||
const bool highlighted = link->flag & NODE_LINK_TEMP_HIGHLIGHT;
|
||||
if (node_link_bezier_handles(v2d, snode, link, vec)) {
|
||||
int drawarrow = ((link->tonode && (link->tonode->type == NODE_REROUTE)) &&
|
||||
(link->fromnode && (link->fromnode->type == NODE_REROUTE)));
|
||||
int drawmuted = (link->flag & NODE_LINK_MUTED);
|
||||
const bool highlighted = link.flag & NODE_LINK_TEMP_HIGHLIGHT;
|
||||
if (node_link_bezier_handles(&v2d, &snode, link, vec)) {
|
||||
int drawarrow = ((link.tonode && (link.tonode->type == NODE_REROUTE)) &&
|
||||
(link.fromnode && (link.fromnode->type == NODE_REROUTE)));
|
||||
int drawmuted = (link.flag & NODE_LINK_MUTED);
|
||||
if (g_batch_link.batch == nullptr) {
|
||||
nodelink_batch_init();
|
||||
}
|
||||
|
@ -4316,23 +4286,23 @@ void node_draw_link_bezier(const bContext *C,
|
|||
UI_GetThemeColor4fv(th_col3, colors[0]);
|
||||
}
|
||||
|
||||
if (snode->overlay.flag & SN_OVERLAY_SHOW_OVERLAYS &&
|
||||
snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS) {
|
||||
if (snode.overlay.flag & SN_OVERLAY_SHOW_OVERLAYS &&
|
||||
snode.overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS) {
|
||||
PointerRNA from_node_ptr, to_node_ptr;
|
||||
RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->fromnode, &from_node_ptr);
|
||||
RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->tonode, &to_node_ptr);
|
||||
if (link->fromsock) {
|
||||
node_socket_color_get(C, snode->edittree, &from_node_ptr, link->fromsock, colors[1]);
|
||||
RNA_pointer_create((ID *)snode.edittree, &RNA_Node, link.fromnode, &from_node_ptr);
|
||||
RNA_pointer_create((ID *)snode.edittree, &RNA_Node, link.tonode, &to_node_ptr);
|
||||
if (link.fromsock) {
|
||||
node_socket_color_get(C, *snode.edittree, from_node_ptr, *link.fromsock, colors[1]);
|
||||
}
|
||||
else {
|
||||
node_socket_color_get(C, snode->edittree, &to_node_ptr, link->tosock, colors[1]);
|
||||
node_socket_color_get(C, *snode.edittree, to_node_ptr, *link.tosock, colors[1]);
|
||||
}
|
||||
|
||||
if (link->tosock) {
|
||||
node_socket_color_get(C, snode->edittree, &to_node_ptr, link->tosock, colors[2]);
|
||||
if (link.tosock) {
|
||||
node_socket_color_get(C, *snode.edittree, to_node_ptr, *link.tosock, colors[2]);
|
||||
}
|
||||
else {
|
||||
node_socket_color_get(C, snode->edittree, &from_node_ptr, link->fromsock, colors[2]);
|
||||
node_socket_color_get(C, *snode.edittree, from_node_ptr, *link.fromsock, colors[2]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -4341,8 +4311,8 @@ void node_draw_link_bezier(const bContext *C,
|
|||
}
|
||||
|
||||
/* Highlight links connected to selected nodes. */
|
||||
const bool is_fromnode_selected = link->fromnode && link->fromnode->flag & SELECT;
|
||||
const bool is_tonode_selected = link->tonode && link->tonode->flag & SELECT;
|
||||
const bool is_fromnode_selected = link.fromnode && link.fromnode->flag & SELECT;
|
||||
const bool is_tonode_selected = link.tonode && link.tonode->flag & SELECT;
|
||||
if (is_fromnode_selected || is_tonode_selected) {
|
||||
float color_selected[4];
|
||||
UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected);
|
||||
|
@ -4389,7 +4359,7 @@ void node_draw_link_bezier(const bContext *C,
|
|||
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_NODELINK);
|
||||
GPU_batch_uniform_2fv_array(batch, "bezierPts", 4, vec);
|
||||
GPU_batch_uniform_4fv_array(batch, "colors", 3, colors);
|
||||
GPU_batch_uniform_1f(batch, "expandSize", snode->runtime->aspect * LINK_WIDTH);
|
||||
GPU_batch_uniform_1f(batch, "expandSize", snode.runtime->aspect * LINK_WIDTH);
|
||||
GPU_batch_uniform_1f(batch, "arrowSize", ARROW_SIZE);
|
||||
GPU_batch_uniform_1i(batch, "doArrow", drawarrow);
|
||||
GPU_batch_uniform_1i(batch, "doMuted", drawmuted);
|
||||
|
@ -4403,36 +4373,36 @@ void node_draw_link_bezier(const bContext *C,
|
|||
}
|
||||
|
||||
/* NOTE: this is used for fake links in groups too. */
|
||||
void node_draw_link(const bContext *C,
|
||||
const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link)
|
||||
void node_draw_link(const bContext &C,
|
||||
const View2D &v2d,
|
||||
const SpaceNode &snode,
|
||||
const bNodeLink &link)
|
||||
{
|
||||
int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE;
|
||||
|
||||
if (link->fromsock == nullptr && link->tosock == nullptr) {
|
||||
if (link.fromsock == nullptr && link.tosock == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* new connection */
|
||||
if (!link->fromsock || !link->tosock) {
|
||||
if (!link.fromsock || !link.tosock) {
|
||||
th_col1 = th_col2 = TH_ACTIVE;
|
||||
}
|
||||
else {
|
||||
/* going to give issues once... */
|
||||
if (link->tosock->flag & SOCK_UNAVAIL) {
|
||||
if (link.tosock->flag & SOCK_UNAVAIL) {
|
||||
return;
|
||||
}
|
||||
if (link->fromsock->flag & SOCK_UNAVAIL) {
|
||||
if (link.fromsock->flag & SOCK_UNAVAIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (link->flag & NODE_LINK_VALID) {
|
||||
if (link.flag & NODE_LINK_VALID) {
|
||||
/* special indicated link, on drop-node */
|
||||
if (link->flag & NODE_LINKFLAG_HILITE) {
|
||||
if (link.flag & NODE_LINKFLAG_HILITE) {
|
||||
th_col1 = th_col2 = TH_ACTIVE;
|
||||
}
|
||||
else if (link->flag & NODE_LINK_MUTED) {
|
||||
else if (link.flag & NODE_LINK_MUTED) {
|
||||
th_col1 = th_col2 = TH_REDALERT;
|
||||
}
|
||||
}
|
||||
|
@ -4443,9 +4413,9 @@ void node_draw_link(const bContext *C,
|
|||
}
|
||||
}
|
||||
/* Links from field to non-field sockets are not allowed. */
|
||||
if (snode->edittree->type == NTREE_GEOMETRY && !(link->flag & NODE_LINK_DRAGGED)) {
|
||||
if ((link->fromsock && link->fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) &&
|
||||
(link->tosock && link->tosock->display_shape == SOCK_DISPLAY_SHAPE_CIRCLE)) {
|
||||
if (snode.edittree->type == NTREE_GEOMETRY && !(link.flag & NODE_LINK_DRAGGED)) {
|
||||
if ((link.fromsock && link.fromsock->display_shape == SOCK_DISPLAY_SHAPE_DIAMOND) &&
|
||||
(link.tosock && link.tosock->display_shape == SOCK_DISPLAY_SHAPE_CIRCLE)) {
|
||||
th_col1 = th_col2 = th_col3 = TH_REDALERT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,19 +67,19 @@
|
|||
* Can be used with both custom and static nodes,
|
||||
* if `idname == nullptr` the static int type will be used instead.
|
||||
*/
|
||||
bNode *node_add_node(const bContext *C, const char *idname, int type, float locx, float locy)
|
||||
bNode *node_add_node(const bContext &C, const char *idname, int type, float locx, float locy)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode &snode = *CTX_wm_space_node(&C);
|
||||
Main &bmain = *CTX_data_main(&C);
|
||||
bNode *node = nullptr;
|
||||
|
||||
node_deselect_all(snode);
|
||||
|
||||
if (idname) {
|
||||
node = nodeAddNode(C, snode->edittree, idname);
|
||||
node = nodeAddNode(&C, snode.edittree, idname);
|
||||
}
|
||||
else {
|
||||
node = nodeAddStaticNode(C, snode->edittree, type);
|
||||
node = nodeAddStaticNode(&C, snode.edittree, type);
|
||||
}
|
||||
BLI_assert(node && node->typeinfo);
|
||||
|
||||
|
@ -89,13 +89,13 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx
|
|||
|
||||
nodeSetSelected(node, true);
|
||||
|
||||
ntreeUpdateTree(bmain, snode->edittree);
|
||||
ED_node_set_active(bmain, snode, snode->edittree, node, nullptr);
|
||||
ntreeUpdateTree(&bmain, snode.edittree);
|
||||
ED_node_set_active(&bmain, &snode, snode.edittree, node, nullptr);
|
||||
|
||||
snode_update(snode, node);
|
||||
|
||||
if (snode->nodetree->type == NTREE_TEXTURE) {
|
||||
ntreeTexCheckCyclics(snode->edittree);
|
||||
if (snode.nodetree->type == NTREE_TEXTURE) {
|
||||
ntreeTexCheckCyclics(snode.edittree);
|
||||
}
|
||||
|
||||
return node;
|
||||
|
@ -107,7 +107,7 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx
|
|||
/** \name Add Reroute Operator
|
||||
* \{ */
|
||||
|
||||
static bool add_reroute_intersect_check(bNodeLink *link,
|
||||
static bool add_reroute_intersect_check(const bNodeLink &link,
|
||||
float mcoords[][2],
|
||||
int tot,
|
||||
float result[2])
|
||||
|
@ -224,9 +224,9 @@ static bNodeSocketLink *add_reroute_do_socket_section(bContext *C,
|
|||
|
||||
static int add_reroute_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
bNodeTree *ntree = snode->edittree;
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
ARegion ®ion = *CTX_wm_region(C);
|
||||
bNodeTree &ntree = *snode.edittree;
|
||||
float mcoords[256][2];
|
||||
int i = 0;
|
||||
|
||||
|
@ -236,7 +236,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
|
|||
|
||||
RNA_float_get_array(&itemptr, "loc", loc);
|
||||
UI_view2d_region_to_view(
|
||||
®ion->v2d, (short)loc[0], (short)loc[1], &mcoords[i][0], &mcoords[i][1]);
|
||||
®ion.v2d, (short)loc[0], (short)loc[1], &mcoords[i][0], &mcoords[i][1]);
|
||||
i++;
|
||||
if (i >= 256) {
|
||||
break;
|
||||
|
@ -246,7 +246,6 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
|
|||
|
||||
if (i > 1) {
|
||||
ListBase output_links, input_links;
|
||||
bNodeLink *link;
|
||||
bNodeSocketLink *socklink;
|
||||
float insert_point[2];
|
||||
|
||||
|
@ -259,11 +258,11 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
|
|||
BLI_listbase_clear(&output_links);
|
||||
BLI_listbase_clear(&input_links);
|
||||
|
||||
for (link = (bNodeLink *)ntree->links.first; link; link = link->next) {
|
||||
if (node_link_is_hidden_or_dimmed(®ion->v2d, link)) {
|
||||
LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) {
|
||||
if (node_link_is_hidden_or_dimmed(region.v2d, *link)) {
|
||||
continue;
|
||||
}
|
||||
if (add_reroute_intersect_check(link, mcoords, i, insert_point)) {
|
||||
if (add_reroute_intersect_check(*link, mcoords, i, insert_point)) {
|
||||
add_reroute_insert_socket_link(&output_links, link->fromsock, link, insert_point);
|
||||
add_reroute_insert_socket_link(&input_links, link->tosock, link, insert_point);
|
||||
|
||||
|
@ -288,9 +287,9 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
|
|||
BLI_freelistN(&input_links);
|
||||
|
||||
/* always last */
|
||||
ntreeUpdateTree(CTX_data_main(C), ntree);
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
ntreeUpdateTree(CTX_data_main(C), &ntree);
|
||||
snode_notify(*C, snode);
|
||||
snode_dag_update(*C, snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -377,7 +376,7 @@ static int node_add_group_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
bNode *group_node = node_add_node(C,
|
||||
bNode *group_node = node_add_node(*C,
|
||||
node_group_idname(C),
|
||||
(node_group->type == NTREE_CUSTOM) ? NODE_CUSTOM_GROUP :
|
||||
NODE_GROUP,
|
||||
|
@ -395,8 +394,8 @@ static int node_add_group_exec(bContext *C, wmOperator *op)
|
|||
ntreeUpdateTree(bmain, node_group);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -469,7 +468,7 @@ static int node_add_object_exec(bContext *C, wmOperator *op)
|
|||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
bNode *object_node = node_add_node(
|
||||
C, nullptr, GEO_NODE_OBJECT_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]);
|
||||
*C, nullptr, GEO_NODE_OBJECT_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]);
|
||||
if (!object_node) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Could not add node object");
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -488,8 +487,8 @@ static int node_add_object_exec(bContext *C, wmOperator *op)
|
|||
nodeSetActive(ntree, object_node);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
ED_node_tag_update_nodetree(bmain, ntree, object_node);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
@ -580,7 +579,7 @@ static int node_add_texture_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
bNode *texture_node = node_add_node(C,
|
||||
bNode *texture_node = node_add_node(*C,
|
||||
nullptr,
|
||||
GEO_NODE_LEGACY_ATTRIBUTE_SAMPLE_TEXTURE,
|
||||
snode->runtime->cursor[0],
|
||||
|
@ -596,8 +595,8 @@ static int node_add_texture_exec(bContext *C, wmOperator *op)
|
|||
nodeSetActive(ntree, texture_node);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
ED_node_tag_update_nodetree(bmain, ntree, texture_node);
|
||||
|
@ -680,8 +679,8 @@ static Collection *node_add_collection_get_and_poll_collection_node_tree(Main *b
|
|||
static int node_add_collection_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNodeTree *ntree = snode->edittree;
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
bNodeTree *ntree = snode.edittree;
|
||||
Collection *collection;
|
||||
|
||||
if (!(collection = node_add_collection_get_and_poll_collection_node_tree(bmain, op))) {
|
||||
|
@ -691,7 +690,7 @@ static int node_add_collection_exec(bContext *C, wmOperator *op)
|
|||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
bNode *collection_node = node_add_node(
|
||||
C, nullptr, GEO_NODE_COLLECTION_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]);
|
||||
*C, nullptr, GEO_NODE_COLLECTION_INFO, snode.runtime->cursor[0], snode.runtime->cursor[1]);
|
||||
if (!collection_node) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Could not add node collection");
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -710,8 +709,8 @@ static int node_add_collection_exec(bContext *C, wmOperator *op)
|
|||
nodeSetActive(ntree, collection_node);
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, snode);
|
||||
snode_dag_update(*C, snode);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
ED_node_tag_update_nodetree(bmain, ntree, collection_node);
|
||||
|
@ -788,7 +787,7 @@ static bool node_add_file_poll(bContext *C)
|
|||
static int node_add_file_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
bNode *node;
|
||||
Image *ima;
|
||||
int type = 0;
|
||||
|
@ -798,7 +797,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
switch (snode->nodetree->type) {
|
||||
switch (snode.nodetree->type) {
|
||||
case NTREE_SHADER:
|
||||
type = SH_NODE_TEX_IMAGE;
|
||||
break;
|
||||
|
@ -817,7 +816,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
node = node_add_node(C, nullptr, type, snode->runtime->cursor[0], snode->runtime->cursor[1]);
|
||||
node = node_add_node(*C, nullptr, type, snode.runtime->cursor[0], snode.runtime->cursor[1]);
|
||||
|
||||
if (!node) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Could not add an image node");
|
||||
|
@ -841,8 +840,8 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
|
|||
WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, snode);
|
||||
snode_dag_update(*C, snode);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -923,7 +922,7 @@ static bool node_add_mask_poll(bContext *C)
|
|||
static int node_add_mask_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
bNode *node;
|
||||
|
||||
ID *mask = node_add_mask_get_and_poll_mask(bmain, op);
|
||||
|
@ -934,7 +933,7 @@ static int node_add_mask_exec(bContext *C, wmOperator *op)
|
|||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
node = node_add_node(
|
||||
C, nullptr, CMP_NODE_MASK, snode->runtime->cursor[0], snode->runtime->cursor[1]);
|
||||
*C, nullptr, CMP_NODE_MASK, snode.runtime->cursor[0], snode.runtime->cursor[1]);
|
||||
|
||||
if (!node) {
|
||||
BKE_report(op->reports, RPT_WARNING, "Could not add a mask node");
|
||||
|
@ -944,8 +943,8 @@ static int node_add_mask_exec(bContext *C, wmOperator *op)
|
|||
node->id = mask;
|
||||
id_us_plus(mask);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, snode);
|
||||
snode_dag_update(*C, snode);
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,9 +31,6 @@
|
|||
#include "DNA_text_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_image.h"
|
||||
|
@ -80,6 +77,8 @@
|
|||
|
||||
#define USE_ESC_COMPO
|
||||
|
||||
using blender::float2;
|
||||
|
||||
/* ***************** composite job manager ********************** */
|
||||
|
||||
enum {
|
||||
|
@ -103,11 +102,11 @@ struct CompoJob {
|
|||
float *progress;
|
||||
};
|
||||
|
||||
float node_socket_calculate_height(const bNodeSocket *socket)
|
||||
float node_socket_calculate_height(const bNodeSocket &socket)
|
||||
{
|
||||
float sock_height = NODE_SOCKSIZE * 2.0f;
|
||||
if (socket->flag & SOCK_MULTI_INPUT) {
|
||||
sock_height += max_ii(NODE_MULTI_INPUT_LINK_GAP * 0.5f * socket->total_inputs, NODE_SOCKSIZE);
|
||||
if (socket.flag & SOCK_MULTI_INPUT) {
|
||||
sock_height += max_ii(NODE_MULTI_INPUT_LINK_GAP * 0.5f * socket.total_inputs, NODE_SOCKSIZE);
|
||||
}
|
||||
return sock_height;
|
||||
}
|
||||
|
@ -394,31 +393,31 @@ bool composite_node_editable(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
void snode_dag_update(bContext *C, SpaceNode *snode)
|
||||
void snode_dag_update(bContext &C, SpaceNode &snode)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Main *bmain = CTX_data_main(&C);
|
||||
|
||||
/* for groups, update all ID's using this */
|
||||
if ((snode->edittree->id.flag & LIB_EMBEDDED_DATA) == 0) {
|
||||
if ((snode.edittree->id.flag & LIB_EMBEDDED_DATA) == 0) {
|
||||
FOREACH_NODETREE_BEGIN (bmain, tntree, id) {
|
||||
if (ntreeHasTree(tntree, snode->edittree)) {
|
||||
if (ntreeHasTree(tntree, snode.edittree)) {
|
||||
DEG_id_tag_update(id, 0);
|
||||
}
|
||||
}
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
DEG_id_tag_update(snode->id, 0);
|
||||
DEG_id_tag_update(&snode->nodetree->id, 0);
|
||||
DEG_id_tag_update(snode.id, 0);
|
||||
DEG_id_tag_update(&snode.nodetree->id, 0);
|
||||
}
|
||||
|
||||
void snode_notify(bContext *C, SpaceNode *snode)
|
||||
void snode_notify(bContext &C, SpaceNode &snode)
|
||||
{
|
||||
ID *id = snode->id;
|
||||
ID *id = snode.id;
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | NA_EDITED, nullptr);
|
||||
WM_event_add_notifier(&C, NC_NODE | NA_EDITED, nullptr);
|
||||
|
||||
if (ED_node_is_shader(snode)) {
|
||||
if (ED_node_is_shader(&snode)) {
|
||||
if (GS(id->name) == ID_MA) {
|
||||
WM_main_add_notifier(NC_MATERIAL | ND_SHADING, id);
|
||||
}
|
||||
|
@ -429,13 +428,13 @@ void snode_notify(bContext *C, SpaceNode *snode)
|
|||
WM_main_add_notifier(NC_WORLD | ND_WORLD, id);
|
||||
}
|
||||
}
|
||||
else if (ED_node_is_compositor(snode)) {
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_NODES, id);
|
||||
else if (ED_node_is_compositor(&snode)) {
|
||||
WM_event_add_notifier(&C, NC_SCENE | ND_NODES, id);
|
||||
}
|
||||
else if (ED_node_is_texture(snode)) {
|
||||
WM_event_add_notifier(C, NC_TEXTURE | ND_NODES, id);
|
||||
else if (ED_node_is_texture(&snode)) {
|
||||
WM_event_add_notifier(&C, NC_TEXTURE | ND_NODES, id);
|
||||
}
|
||||
else if (ED_node_is_geometry(snode)) {
|
||||
else if (ED_node_is_geometry(&snode)) {
|
||||
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, id);
|
||||
}
|
||||
}
|
||||
|
@ -604,15 +603,15 @@ void ED_node_texture_default(const bContext *C, Tex *tex)
|
|||
}
|
||||
|
||||
/* Here we set the active tree(s), even called for each redraw now, so keep it fast :) */
|
||||
void snode_set_context(const bContext *C)
|
||||
void snode_set_context(const bContext &C)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
SpaceNode *snode = CTX_wm_space_node(&C);
|
||||
bNodeTreeType *treetype = ntreeTypeFind(snode->tree_idname);
|
||||
bNodeTree *ntree = snode->nodetree;
|
||||
ID *id = snode->id, *from = snode->from;
|
||||
|
||||
/* check the tree type */
|
||||
if (!treetype || (treetype->poll && !treetype->poll(C, treetype))) {
|
||||
if (!treetype || (treetype->poll && !treetype->poll(&C, treetype))) {
|
||||
/* invalid tree type, skip
|
||||
* NOTE: not resetting the node path here, invalid #bNodeTreeType
|
||||
* may still be registered at a later point. */
|
||||
|
@ -633,7 +632,7 @@ void snode_set_context(const bContext *C)
|
|||
id = nullptr;
|
||||
from = nullptr;
|
||||
|
||||
treetype->get_from_context(C, treetype, &ntree, &id, &from);
|
||||
treetype->get_from_context(&C, treetype, &ntree, &id, &from);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,7 +642,7 @@ void snode_set_context(const bContext *C)
|
|||
}
|
||||
}
|
||||
|
||||
void snode_update(SpaceNode *snode, bNode *node)
|
||||
void snode_update(SpaceNode &snode, bNode *node)
|
||||
{
|
||||
/* XXX this only updates nodes in the current node space tree path.
|
||||
* The function supposedly should update any potential group node linking to changed tree,
|
||||
|
@ -651,7 +650,7 @@ void snode_update(SpaceNode *snode, bNode *node)
|
|||
*/
|
||||
|
||||
/* update all edited group nodes */
|
||||
bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last;
|
||||
bNodeTreePath *path = (bNodeTreePath *)snode.treepath.last;
|
||||
if (path) {
|
||||
bNodeTree *ngroup = path->nodetree;
|
||||
for (path = path->prev; path; path = path->prev) {
|
||||
|
@ -661,7 +660,7 @@ void snode_update(SpaceNode *snode, bNode *node)
|
|||
}
|
||||
|
||||
if (node) {
|
||||
nodeUpdate(snode->edittree, node);
|
||||
nodeUpdate(snode.edittree, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -918,10 +917,10 @@ static void edit_node_properties_get(
|
|||
/* ************************** Node generic ************** */
|
||||
|
||||
/* is rct in visible part of node? */
|
||||
static bNode *visible_node(SpaceNode *snode, const rctf *rct)
|
||||
static bNode *visible_node(SpaceNode &snode, const rctf &rct)
|
||||
{
|
||||
LISTBASE_FOREACH_BACKWARD (bNode *, node, &snode->edittree->nodes) {
|
||||
if (BLI_rctf_isect(&node->totr, rct, nullptr)) {
|
||||
LISTBASE_FOREACH_BACKWARD (bNode *, node, &snode.edittree->nodes) {
|
||||
if (BLI_rctf_isect(&node->totr, &rct, nullptr)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
@ -941,7 +940,7 @@ struct NodeSizeWidget {
|
|||
static void node_resize_init(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *UNUSED(event),
|
||||
bNode *node,
|
||||
const bNode *node,
|
||||
NodeResizeDirection dir)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
|
@ -1091,20 +1090,22 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
|||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
bNode *node = nodeGetActive(snode->edittree);
|
||||
const bNode *node = nodeGetActive(snode->edittree);
|
||||
|
||||
if (node) {
|
||||
float cursor[2];
|
||||
|
||||
/* convert mouse coordinates to v2d space */
|
||||
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
|
||||
const NodeResizeDirection dir = node->typeinfo->resize_area_func(node, cursor[0], cursor[1]);
|
||||
if (dir != NODE_RESIZE_NONE) {
|
||||
node_resize_init(C, op, event, node, dir);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
if (node == nullptr) {
|
||||
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
|
||||
|
||||
/* convert mouse coordinates to v2d space */
|
||||
float cursor[2];
|
||||
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
|
||||
const NodeResizeDirection dir = node->typeinfo->resize_area_func(node, cursor[0], cursor[1]);
|
||||
if (dir == NODE_RESIZE_NONE) {
|
||||
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
node_resize_init(C, op, event, node, dir);
|
||||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
static void node_resize_cancel(bContext *C, wmOperator *op)
|
||||
|
@ -1172,7 +1173,7 @@ void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set)
|
|||
}
|
||||
|
||||
/* checks snode->mouse position, and returns found node/socket */
|
||||
static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSocket *socket)
|
||||
static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSocket &socket)
|
||||
{
|
||||
const float node_socket_height = node_socket_calculate_height(socket);
|
||||
rctf multi_socket_rect;
|
||||
|
@ -1182,10 +1183,10 @@ static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSo
|
|||
* sometimes want to drag the link to the other side, if you may
|
||||
* accidentally pick the wrong link otherwise. */
|
||||
BLI_rctf_init(&multi_socket_rect,
|
||||
socket->locx - NODE_SOCKSIZE * 4.0f,
|
||||
socket->locx + NODE_SOCKSIZE * 2.0f,
|
||||
socket->locy - node_socket_height,
|
||||
socket->locy + node_socket_height);
|
||||
socket.locx - NODE_SOCKSIZE * 4.0f,
|
||||
socket.locx + NODE_SOCKSIZE * 2.0f,
|
||||
socket.locy - node_socket_height,
|
||||
socket.locy + node_socket_height);
|
||||
if (BLI_rctf_isect_pt(&multi_socket_rect, cursor[0], cursor[1])) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1193,8 +1194,11 @@ static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSo
|
|||
}
|
||||
|
||||
/* type is SOCK_IN and/or SOCK_OUT */
|
||||
bool node_find_indicated_socket(
|
||||
SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, const float cursor[2], int in_out)
|
||||
bool node_find_indicated_socket(SpaceNode &snode,
|
||||
bNode **nodep,
|
||||
bNodeSocket **sockp,
|
||||
const float2 &cursor,
|
||||
const eNodeSocketInOut in_out)
|
||||
{
|
||||
rctf rect;
|
||||
|
||||
|
@ -1202,7 +1206,7 @@ bool node_find_indicated_socket(
|
|||
*sockp = nullptr;
|
||||
|
||||
/* check if we click in a socket */
|
||||
LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) {
|
||||
LISTBASE_FOREACH (bNode *, node, &snode.edittree->nodes) {
|
||||
BLI_rctf_init_pt_radius(&rect, cursor, NODE_SOCKSIZE + 4);
|
||||
|
||||
if (!(node->flag & NODE_HIDDEN)) {
|
||||
|
@ -1221,8 +1225,8 @@ bool node_find_indicated_socket(
|
|||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
if (!nodeSocketIsHidden(sock)) {
|
||||
if (sock->flag & SOCK_MULTI_INPUT && !(node->flag & NODE_HIDDEN)) {
|
||||
if (cursor_isect_multi_input_socket(cursor, sock)) {
|
||||
if (node == visible_node(snode, &rect)) {
|
||||
if (cursor_isect_multi_input_socket(cursor, *sock)) {
|
||||
if (node == visible_node(snode, rect)) {
|
||||
*nodep = node;
|
||||
*sockp = sock;
|
||||
return true;
|
||||
|
@ -1230,7 +1234,7 @@ bool node_find_indicated_socket(
|
|||
}
|
||||
}
|
||||
else if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
|
||||
if (node == visible_node(snode, &rect)) {
|
||||
if (node == visible_node(snode, rect)) {
|
||||
*nodep = node;
|
||||
*sockp = sock;
|
||||
return true;
|
||||
|
@ -1243,7 +1247,7 @@ bool node_find_indicated_socket(
|
|||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) {
|
||||
if (!nodeSocketIsHidden(sock)) {
|
||||
if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
|
||||
if (node == visible_node(snode, &rect)) {
|
||||
if (node == visible_node(snode, rect)) {
|
||||
*nodep = node;
|
||||
*sockp = sock;
|
||||
return true;
|
||||
|
@ -1259,28 +1263,28 @@ bool node_find_indicated_socket(
|
|||
|
||||
/* ****************** Link Dimming *********************** */
|
||||
|
||||
float node_link_dim_factor(const View2D *v2d, const bNodeLink *link)
|
||||
float node_link_dim_factor(const View2D &v2d, const bNodeLink &link)
|
||||
{
|
||||
if (link->fromsock == nullptr || link->tosock == nullptr) {
|
||||
if (link.fromsock == nullptr || link.tosock == nullptr) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
const float min_endpoint_distance = std::min(
|
||||
std::max(BLI_rctf_length_x(&v2d->cur, link->fromsock->locx),
|
||||
BLI_rctf_length_y(&v2d->cur, link->fromsock->locy)),
|
||||
std::max(BLI_rctf_length_x(&v2d->cur, link->tosock->locx),
|
||||
BLI_rctf_length_y(&v2d->cur, link->tosock->locy)));
|
||||
std::max(BLI_rctf_length_x(&v2d.cur, link.fromsock->locx),
|
||||
BLI_rctf_length_y(&v2d.cur, link.fromsock->locy)),
|
||||
std::max(BLI_rctf_length_x(&v2d.cur, link.tosock->locx),
|
||||
BLI_rctf_length_y(&v2d.cur, link.tosock->locy)));
|
||||
|
||||
if (min_endpoint_distance == 0.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
const float viewport_width = BLI_rctf_size_x(&v2d->cur);
|
||||
const float viewport_width = BLI_rctf_size_x(&v2d.cur);
|
||||
return std::clamp(1.0f - min_endpoint_distance / viewport_width * 10.0f, 0.05f, 1.0f);
|
||||
}
|
||||
|
||||
bool node_link_is_hidden_or_dimmed(const View2D *v2d, const bNodeLink *link)
|
||||
bool node_link_is_hidden_or_dimmed(const View2D &v2d, const bNodeLink &link)
|
||||
{
|
||||
return nodeLinkIsHidden(link) || node_link_dim_factor(v2d, link) < 0.5f;
|
||||
return nodeLinkIsHidden(&link) || node_link_dim_factor(v2d, link) < 0.5f;
|
||||
}
|
||||
|
||||
/* ****************** Duplicate *********************** */
|
||||
|
@ -1390,7 +1394,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
|
|||
node->flag &= ~(NODE_ACTIVE | NODE_ACTIVE_TEXTURE);
|
||||
nodeSetSelected(newnode, true);
|
||||
|
||||
do_tag_update |= (do_tag_update || node_connected_to_output(bmain, ntree, newnode));
|
||||
do_tag_update |= (do_tag_update || node_connected_to_output(*bmain, *ntree, *newnode));
|
||||
}
|
||||
|
||||
/* make sure we don't copy new nodes again! */
|
||||
|
@ -1401,9 +1405,9 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ntreeUpdateTree(CTX_data_main(C), snode->edittree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
if (do_tag_update) {
|
||||
snode_dag_update(C, snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1496,8 +1500,8 @@ static int node_read_viewlayers_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1664,7 +1668,7 @@ static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
node_flag_toggle_exec(snode, NODE_PREVIEW);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1778,14 +1782,15 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) {
|
||||
if ((node->flag & SELECT) && !node->typeinfo->no_muting) {
|
||||
node->flag ^= NODE_MUTED;
|
||||
snode_update(snode, node);
|
||||
do_tag_update |= (do_tag_update || node_connected_to_output(bmain, snode->edittree, node));
|
||||
snode_update(*snode, node);
|
||||
do_tag_update |= (do_tag_update ||
|
||||
node_connected_to_output(*bmain, *snode->edittree, *node));
|
||||
}
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
if (do_tag_update) {
|
||||
snode_dag_update(C, snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1818,16 +1823,17 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
LISTBASE_FOREACH_MUTABLE (bNode *, node, &snode->edittree->nodes) {
|
||||
if (node->flag & SELECT) {
|
||||
do_tag_update |= (do_tag_update || node_connected_to_output(bmain, snode->edittree, node));
|
||||
do_tag_update |= (do_tag_update ||
|
||||
node_connected_to_output(*bmain, *snode->edittree, *node));
|
||||
nodeRemoveNode(bmain, snode->edittree, node, true);
|
||||
}
|
||||
}
|
||||
|
||||
ntreeUpdateTree(CTX_data_main(C), snode->edittree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
if (do_tag_update) {
|
||||
snode_dag_update(C, snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -1874,8 +1880,8 @@ static int node_switch_view_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
ntreeUpdateTree(CTX_data_main(C), snode->edittree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1912,8 +1918,8 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
ntreeUpdateTree(CTX_data_main(C), snode->edittree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1960,7 +1966,7 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op)
|
|||
RNA_string_get(op->ptr, "file_path", file_path);
|
||||
ntreeCompositOutputFileAddSocket(ntree, node, file_path, &scene->r.im_format);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -2009,7 +2015,7 @@ static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *U
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -2076,7 +2082,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
|
|||
nimf->active_input++;
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -2286,7 +2292,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
|
|||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
/* deselect old nodes */
|
||||
node_deselect_all(snode);
|
||||
node_deselect_all(*snode);
|
||||
|
||||
/* calculate "barycenter" for placing on mouse cursor */
|
||||
float center[2] = {0.0f, 0.0f};
|
||||
|
@ -2324,8 +2330,8 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
|
|||
Main *bmain = CTX_data_main(C);
|
||||
ntreeUpdateTree(bmain, snode->edittree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
/* Pasting nodes can create arbitrary new relations, because nodes can reference IDs. */
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
||||
|
@ -2395,8 +2401,8 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ntreeUpdateTree(CTX_data_main(C), ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
|
||||
|
||||
|
@ -2445,8 +2451,8 @@ static int ntree_socket_remove_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ntreeUpdateTree(CTX_data_main(C), ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
|
||||
|
||||
|
@ -2508,8 +2514,8 @@ static int ntree_socket_change_type_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ntreeUpdateTree(main, ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
|
||||
|
||||
|
@ -2623,8 +2629,8 @@ static int ntree_socket_move_exec(bContext *C, wmOperator *op)
|
|||
ntree->update |= NTREE_UPDATE_GROUP;
|
||||
ntreeUpdateTree(CTX_data_main(C), ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
|
||||
|
||||
|
@ -2855,7 +2861,7 @@ static int viewer_border_exec(bContext *C, wmOperator *op)
|
|||
btree->flag |= NTREE_VIEWER_BORDER;
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
|
||||
}
|
||||
else {
|
||||
|
@ -2895,7 +2901,7 @@ static int clear_viewer_border_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
bNodeTree *btree = snode->nodetree;
|
||||
|
||||
btree->flag &= ~NTREE_VIEWER_BORDER;
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
@ -2940,7 +2946,7 @@ static int node_cryptomatte_add_socket_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
ntreeCompositCryptomatteAddSocket(ntree, node);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -2986,7 +2992,7 @@ static int node_cryptomatte_remove_socket_exec(bContext *C, wmOperator *UNUSED(o
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
|
|
@ -100,13 +100,13 @@ static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v)
|
|||
ED_undo_push(C, "Assign Attribute Name");
|
||||
}
|
||||
|
||||
void node_geometry_add_attribute_search_button(const bContext *UNUSED(C),
|
||||
const bNodeTree *node_tree,
|
||||
const bNode *node,
|
||||
PointerRNA *socket_ptr,
|
||||
uiLayout *layout)
|
||||
void node_geometry_add_attribute_search_button(const bContext &UNUSED(C),
|
||||
const bNodeTree &node_tree,
|
||||
const bNode &node,
|
||||
PointerRNA &socket_ptr,
|
||||
uiLayout &layout)
|
||||
{
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
uiBlock *block = uiLayoutGetBlock(&layout);
|
||||
uiBut *but = uiDefIconTextButR(block,
|
||||
UI_BTYPE_SEARCH_MENU,
|
||||
0,
|
||||
|
@ -116,7 +116,7 @@ void node_geometry_add_attribute_search_button(const bContext *UNUSED(C),
|
|||
0,
|
||||
10 * UI_UNIT_X, /* Dummy value, replaced by layout system. */
|
||||
UI_UNIT_Y,
|
||||
socket_ptr,
|
||||
&socket_ptr,
|
||||
"default_value",
|
||||
0,
|
||||
0.0f,
|
||||
|
@ -126,7 +126,7 @@ void node_geometry_add_attribute_search_button(const bContext *UNUSED(C),
|
|||
"");
|
||||
|
||||
AttributeSearchData *data = OBJECT_GUARDED_NEW(
|
||||
AttributeSearchData, {node_tree, node, (bNodeSocket *)socket_ptr->data});
|
||||
AttributeSearchData, {&node_tree, &node, (bNodeSocket *)socket_ptr.data});
|
||||
|
||||
UI_but_func_search_set_results_are_suggestions(but, true);
|
||||
UI_but_func_search_set_sep_string(but, UI_MENU_ARROW_SEP);
|
||||
|
|
|
@ -419,8 +419,8 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -616,8 +616,8 @@ static int node_group_separate_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ntreeUpdateTree(CTX_data_main(C), snode->nodetree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -663,16 +663,16 @@ void NODE_OT_group_separate(wmOperatorType *ot)
|
|||
/** \name Make Group Operator
|
||||
* \{ */
|
||||
|
||||
static bool node_group_make_use_node(bNode *node, bNode *gnode)
|
||||
static bool node_group_make_use_node(bNode &node, bNode *gnode)
|
||||
{
|
||||
return (node != gnode && !ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT) &&
|
||||
(node->flag & NODE_SELECT));
|
||||
return (&node != gnode && !ELEM(node.type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT) &&
|
||||
(node.flag & NODE_SELECT));
|
||||
}
|
||||
|
||||
static bool node_group_make_test_selected(bNodeTree *ntree,
|
||||
static bool node_group_make_test_selected(bNodeTree &ntree,
|
||||
bNode *gnode,
|
||||
const char *ntree_idname,
|
||||
struct ReportList *reports)
|
||||
struct ReportList &reports)
|
||||
{
|
||||
int ok = true;
|
||||
|
||||
|
@ -680,20 +680,20 @@ static bool node_group_make_test_selected(bNodeTree *ntree,
|
|||
bNodeTree *ngroup = ntreeAddTree(nullptr, "Pseudo Node Group", ntree_idname);
|
||||
|
||||
/* check poll functions for selected nodes */
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node_group_make_use_node(node, gnode)) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree.nodes) {
|
||||
if (node_group_make_use_node(*node, gnode)) {
|
||||
const char *disabled_hint = nullptr;
|
||||
if (node->typeinfo->poll_instance &&
|
||||
!node->typeinfo->poll_instance(node, ngroup, &disabled_hint)) {
|
||||
if (disabled_hint) {
|
||||
BKE_reportf(reports,
|
||||
BKE_reportf(&reports,
|
||||
RPT_WARNING,
|
||||
"Can not add node '%s' in a group:\n %s",
|
||||
node->name,
|
||||
disabled_hint);
|
||||
}
|
||||
else {
|
||||
BKE_reportf(reports, RPT_WARNING, "Can not add node '%s' in a group", node->name);
|
||||
BKE_reportf(&reports, RPT_WARNING, "Can not add node '%s' in a group", node->name);
|
||||
}
|
||||
ok = false;
|
||||
break;
|
||||
|
@ -712,15 +712,15 @@ static bool node_group_make_test_selected(bNodeTree *ntree,
|
|||
|
||||
/* check if all connections are OK, no unselected node has both
|
||||
* inputs and outputs to a selection */
|
||||
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
|
||||
if (node_group_make_use_node(link->fromnode, gnode)) {
|
||||
LISTBASE_FOREACH (bNodeLink *, link, &ntree.links) {
|
||||
if (node_group_make_use_node(*link->fromnode, gnode)) {
|
||||
link->tonode->done |= 1;
|
||||
}
|
||||
if (node_group_make_use_node(link->tonode, gnode)) {
|
||||
if (node_group_make_use_node(*link->tonode, gnode)) {
|
||||
link->fromnode->done |= 2;
|
||||
}
|
||||
}
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree.nodes) {
|
||||
if (!(node->flag & NODE_SELECT) && node != gnode && node->done == 3) {
|
||||
return false;
|
||||
}
|
||||
|
@ -729,13 +729,13 @@ static bool node_group_make_test_selected(bNodeTree *ntree,
|
|||
}
|
||||
|
||||
static int node_get_selected_minmax(
|
||||
bNodeTree *ntree, bNode *gnode, float *min, float *max, bool use_size)
|
||||
bNodeTree &ntree, bNode *gnode, float2 &min, float2 &max, bool use_size)
|
||||
{
|
||||
int totselect = 0;
|
||||
|
||||
INIT_MINMAX2(min, max);
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
if (node_group_make_use_node(node, gnode)) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree.nodes) {
|
||||
if (node_group_make_use_node(*node, gnode)) {
|
||||
float loc[2];
|
||||
nodeToView(node, node->offsetx, node->offsety, &loc[0], &loc[1]);
|
||||
minmax_v2v2_v2(min, max, loc);
|
||||
|
@ -756,9 +756,9 @@ static int node_get_selected_minmax(
|
|||
return totselect;
|
||||
}
|
||||
|
||||
static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, bNode *gnode)
|
||||
static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree, bNode *gnode)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Main *bmain = CTX_data_main(&C);
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
bool expose_visible = false;
|
||||
|
||||
|
@ -771,12 +771,12 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
nodeSetSelected(node, false);
|
||||
}
|
||||
|
||||
float center[2], min[2], max[2];
|
||||
float2 center, min, max;
|
||||
const int totselect = node_get_selected_minmax(ntree, gnode, min, max, false);
|
||||
add_v2_v2v2(center, min, max);
|
||||
mul_v2_fl(center, 0.5f);
|
||||
|
||||
float real_min[2], real_max[2];
|
||||
float2 real_min, real_max;
|
||||
node_get_selected_minmax(ntree, gnode, real_min, real_max, true);
|
||||
|
||||
/* auto-add interface for "solo" nodes */
|
||||
|
@ -787,16 +787,16 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
ListBase anim_basepaths = {nullptr, nullptr};
|
||||
|
||||
/* move nodes over */
|
||||
LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) {
|
||||
if (node_group_make_use_node(node, gnode)) {
|
||||
LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree.nodes) {
|
||||
if (node_group_make_use_node(*node, gnode)) {
|
||||
/* keep track of this node's RNA "base" path (the part of the pat identifying the node)
|
||||
* if the old nodetree has animation data which potentially covers this node
|
||||
*/
|
||||
if (ntree->adt) {
|
||||
if (ntree.adt) {
|
||||
PointerRNA ptr;
|
||||
char *path;
|
||||
|
||||
RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
|
||||
RNA_pointer_create(&ntree.id, &RNA_Node, node, &ptr);
|
||||
path = RNA_path_from_ID_to_struct(&ptr);
|
||||
|
||||
if (path) {
|
||||
|
@ -810,7 +810,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
}
|
||||
|
||||
/* change node-collection membership */
|
||||
BLI_remlink(&ntree->nodes, node);
|
||||
BLI_remlink(&ntree.nodes, node);
|
||||
BLI_addtail(&ngroup->nodes, node);
|
||||
|
||||
/* ensure unique node name in the ngroup */
|
||||
|
@ -819,8 +819,8 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
}
|
||||
|
||||
/* move animation data over */
|
||||
if (ntree->adt) {
|
||||
BKE_animdata_transfer_by_basepath(bmain, &ntree->id, &ngroup->id, &anim_basepaths);
|
||||
if (ntree.adt) {
|
||||
BKE_animdata_transfer_by_basepath(bmain, &ntree.id, &ngroup->id, &anim_basepaths);
|
||||
|
||||
/* paths + their wrappers need to be freed */
|
||||
LISTBASE_FOREACH_MUTABLE (AnimationBasePathChange *, basepath_change, &anim_basepaths) {
|
||||
|
@ -832,36 +832,36 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
ntreeFreeCache(ngroup);
|
||||
|
||||
/* create input node */
|
||||
bNode *input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
|
||||
bNode *input_node = nodeAddStaticNode(&C, ngroup, NODE_GROUP_INPUT);
|
||||
input_node->locx = real_min[0] - center[0] - offsetx;
|
||||
input_node->locy = -offsety;
|
||||
|
||||
/* create output node */
|
||||
bNode *output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
|
||||
bNode *output_node = nodeAddStaticNode(&C, ngroup, NODE_GROUP_OUTPUT);
|
||||
output_node->locx = real_max[0] - center[0] + offsetx * 0.25f;
|
||||
output_node->locy = -offsety;
|
||||
|
||||
/* relink external sockets */
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
|
||||
int fromselect = node_group_make_use_node(link->fromnode, gnode);
|
||||
int toselect = node_group_make_use_node(link->tonode, gnode);
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree.links) {
|
||||
int fromselect = node_group_make_use_node(*link->fromnode, gnode);
|
||||
int toselect = node_group_make_use_node(*link->tonode, gnode);
|
||||
|
||||
if ((fromselect && link->tonode == gnode) || (toselect && link->fromnode == gnode)) {
|
||||
/* remove all links to/from the gnode.
|
||||
* this can remove link information, but there's no general way to preserve it.
|
||||
*/
|
||||
nodeRemLink(ntree, link);
|
||||
nodeRemLink(&ntree, link);
|
||||
}
|
||||
else if (toselect && !fromselect) {
|
||||
bNodeSocket *link_sock;
|
||||
bNode *link_node;
|
||||
node_socket_skip_reroutes(&ntree->links, link->tonode, link->tosock, &link_node, &link_sock);
|
||||
node_socket_skip_reroutes(&ntree.links, link->tonode, link->tosock, &link_node, &link_sock);
|
||||
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link_node, link_sock);
|
||||
|
||||
/* update the group node and interface node sockets,
|
||||
* so the new interface socket can be linked.
|
||||
*/
|
||||
node_group_update(ntree, gnode);
|
||||
node_group_update(&ntree, gnode);
|
||||
node_group_input_update(ngroup, input_node);
|
||||
|
||||
/* create new internal link */
|
||||
|
@ -890,13 +890,13 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
bNodeSocket *link_sock;
|
||||
bNode *link_node;
|
||||
node_socket_skip_reroutes(
|
||||
&ntree->links, link->fromnode, link->fromsock, &link_node, &link_sock);
|
||||
&ntree.links, link->fromnode, link->fromsock, &link_node, &link_sock);
|
||||
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link_node, link_sock);
|
||||
|
||||
/* update the group node and interface node sockets,
|
||||
* so the new interface socket can be linked.
|
||||
*/
|
||||
node_group_update(ntree, gnode);
|
||||
node_group_update(&ntree, gnode);
|
||||
node_group_output_update(ngroup, output_node);
|
||||
|
||||
/* create new internal link */
|
||||
|
@ -911,19 +911,19 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
}
|
||||
|
||||
/* move internal links */
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
|
||||
int fromselect = node_group_make_use_node(link->fromnode, gnode);
|
||||
int toselect = node_group_make_use_node(link->tonode, gnode);
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree.links) {
|
||||
int fromselect = node_group_make_use_node(*link->fromnode, gnode);
|
||||
int toselect = node_group_make_use_node(*link->tonode, gnode);
|
||||
|
||||
if (fromselect && toselect) {
|
||||
BLI_remlink(&ntree->links, link);
|
||||
BLI_remlink(&ntree.links, link);
|
||||
BLI_addtail(&ngroup->links, link);
|
||||
}
|
||||
}
|
||||
|
||||
/* move nodes in the group to the center */
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
if (node_group_make_use_node(node, gnode) && !node->parent) {
|
||||
if (node_group_make_use_node(*node, gnode) && !node->parent) {
|
||||
node->locx -= center[0];
|
||||
node->locy -= center[1];
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
/* Expose all unlinked sockets too but only the visible ones. */
|
||||
if (expose_visible) {
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
if (node_group_make_use_node(node, gnode)) {
|
||||
if (node_group_make_use_node(*node, gnode)) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) {
|
||||
bool skip = false;
|
||||
LISTBASE_FOREACH (bNodeLink *, link, &ngroup->links) {
|
||||
|
@ -987,17 +987,17 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
|
|||
/* update of the group tree */
|
||||
ngroup->update |= NTREE_UPDATE | NTREE_UPDATE_LINKS;
|
||||
/* update of the tree containing the group instance node */
|
||||
ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS;
|
||||
ntree.update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS;
|
||||
}
|
||||
|
||||
static bNode *node_group_make_from_selected(const bContext *C,
|
||||
bNodeTree *ntree,
|
||||
static bNode *node_group_make_from_selected(const bContext &C,
|
||||
bNodeTree &ntree,
|
||||
const char *ntype,
|
||||
const char *ntreetype)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Main *bmain = CTX_data_main(&C);
|
||||
|
||||
float min[2], max[2];
|
||||
float2 min, max;
|
||||
const int totselect = node_get_selected_minmax(ntree, nullptr, min, max, false);
|
||||
/* don't make empty group */
|
||||
if (totselect == 0) {
|
||||
|
@ -1008,7 +1008,7 @@ static bNode *node_group_make_from_selected(const bContext *C,
|
|||
bNodeTree *ngroup = ntreeAddTree(bmain, "NodeGroup", ntreetype);
|
||||
|
||||
/* make group node */
|
||||
bNode *gnode = nodeAddNode(C, ntree, ntype);
|
||||
bNode *gnode = nodeAddNode(&C, &ntree, ntype);
|
||||
gnode->id = (ID *)ngroup;
|
||||
|
||||
gnode->locx = 0.5f * (min[0] + max[0]);
|
||||
|
@ -1017,44 +1017,44 @@ static bNode *node_group_make_from_selected(const bContext *C,
|
|||
node_group_make_insert_selected(C, ntree, gnode);
|
||||
|
||||
/* update of the tree containing the group instance node */
|
||||
ntree->update |= NTREE_UPDATE_NODES;
|
||||
ntree.update |= NTREE_UPDATE_NODES;
|
||||
|
||||
return gnode;
|
||||
}
|
||||
|
||||
static int node_group_make_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
bNodeTree *ntree = snode->edittree;
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
bNodeTree &ntree = *snode.edittree;
|
||||
const char *ntree_idname = group_ntree_idname(C);
|
||||
const char *node_idname = node_group_idname(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
|
||||
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
|
||||
|
||||
if (!node_group_make_test_selected(ntree, nullptr, ntree_idname, op->reports)) {
|
||||
if (!node_group_make_test_selected(ntree, nullptr, ntree_idname, *op->reports)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
bNode *gnode = node_group_make_from_selected(C, ntree, node_idname, ntree_idname);
|
||||
bNode *gnode = node_group_make_from_selected(*C, ntree, node_idname, ntree_idname);
|
||||
|
||||
if (gnode) {
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
|
||||
nodeSetActive(ntree, gnode);
|
||||
nodeSetActive(&ntree, gnode);
|
||||
if (ngroup) {
|
||||
ED_node_tree_push(snode, ngroup, gnode);
|
||||
ED_node_tree_push(&snode, ngroup, gnode);
|
||||
LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) {
|
||||
sort_multi_input_socket_links(snode, node, nullptr, nullptr);
|
||||
sort_multi_input_socket_links(snode, *node, nullptr, nullptr);
|
||||
}
|
||||
ntreeUpdateTree(bmain, ngroup);
|
||||
}
|
||||
}
|
||||
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
ntreeUpdateTree(bmain, &ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, snode);
|
||||
snode_dag_update(*C, snode);
|
||||
|
||||
/* We broke relations in node tree, need to rebuild them in the graphs. */
|
||||
DEG_relations_tag_update(bmain);
|
||||
|
@ -1099,11 +1099,11 @@ static int node_group_insert_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
bNodeTree *ngroup = (bNodeTree *)gnode->id;
|
||||
if (!node_group_make_test_selected(ntree, gnode, ngroup->idname, op->reports)) {
|
||||
if (!node_group_make_test_selected(*ntree, gnode, ngroup->idname, *op->reports)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
node_group_make_insert_selected(C, ntree, gnode);
|
||||
node_group_make_insert_selected(*C, *ntree, gnode);
|
||||
|
||||
nodeSetActive(ntree, gnode);
|
||||
ED_node_tree_push(snode, ngroup, gnode);
|
||||
|
@ -1111,8 +1111,8 @@ static int node_group_insert_exec(bContext *C, wmOperator *op)
|
|||
|
||||
ntreeUpdateTree(bmain, ntree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
snode_dag_update(C, snode);
|
||||
snode_notify(*C, *snode);
|
||||
snode_dag_update(*C, *snode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ struct SpaceNode_Runtime {
|
|||
float aspect;
|
||||
|
||||
/** Mouse position for drawing socket-less links and adding nodes. */
|
||||
float cursor[2];
|
||||
blender::float2 cursor;
|
||||
|
||||
/** For auto compositing. */
|
||||
bool recalc;
|
||||
|
@ -83,62 +83,62 @@ struct SpaceNode_Runtime {
|
|||
/* Transform between View2Ds in the tree path. */
|
||||
blender::float2 space_node_group_offset(const SpaceNode &snode);
|
||||
|
||||
float node_socket_calculate_height(const bNodeSocket *socket);
|
||||
float node_socket_calculate_height(const bNodeSocket &socket);
|
||||
void node_link_calculate_multi_input_position(const float socket_x,
|
||||
const float socket_y,
|
||||
const int index,
|
||||
const int total_inputs,
|
||||
float r[2]);
|
||||
|
||||
int node_get_colorid(bNode *node);
|
||||
void node_draw_extra_info_panel(const SpaceNode *snode, const bNode *node);
|
||||
int node_get_colorid(bNode &node);
|
||||
void node_draw_extra_info_panel(const SpaceNode &snode, const bNode &node);
|
||||
int node_get_resize_cursor(NodeResizeDirection directions);
|
||||
void node_draw_shadow(const SpaceNode *snode, const bNode *node, float radius, float alpha);
|
||||
void node_draw_shadow(const SpaceNode &snode, const bNode &node, float radius, float alpha);
|
||||
void node_draw_default(const bContext *C,
|
||||
ARegion *region,
|
||||
SpaceNode *snode,
|
||||
bNodeTree *ntree,
|
||||
bNode *node,
|
||||
bNodeInstanceKey key);
|
||||
void node_draw_sockets(const View2D *v2d,
|
||||
const bContext *C,
|
||||
bNodeTree *ntree,
|
||||
bNode *node,
|
||||
bool draw_outputs,
|
||||
bool select_all);
|
||||
void node_draw_sockets(const View2D &v2d,
|
||||
const bContext &C,
|
||||
bNodeTree &ntree,
|
||||
bNode &node,
|
||||
const bool draw_outputs,
|
||||
const bool select_all);
|
||||
void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node);
|
||||
int node_select_area_default(bNode *node, int x, int y);
|
||||
int node_tweak_area_default(bNode *node, int x, int y);
|
||||
void node_socket_color_get(const bContext *C,
|
||||
bNodeTree *ntree,
|
||||
PointerRNA *node_ptr,
|
||||
bNodeSocket *sock,
|
||||
void node_socket_color_get(const bContext &C,
|
||||
const bNodeTree &ntree,
|
||||
PointerRNA &node_ptr,
|
||||
const bNodeSocket &sock,
|
||||
float r_color[4]);
|
||||
void node_update_nodetree(const bContext *C, bNodeTree *ntree);
|
||||
void node_draw_nodetree(const bContext *C,
|
||||
ARegion *region,
|
||||
SpaceNode *snode,
|
||||
bNodeTree *ntree,
|
||||
void node_update_nodetree(const bContext &C, bNodeTree &ntree);
|
||||
void node_draw_nodetree(const bContext &C,
|
||||
ARegion ®ion,
|
||||
SpaceNode &snode,
|
||||
bNodeTree &ntree,
|
||||
bNodeInstanceKey parent_key);
|
||||
void node_draw_space(const bContext *C, ARegion *region);
|
||||
void node_draw_space(const bContext &C, ARegion ®ion);
|
||||
|
||||
void node_set_cursor(wmWindow *win, SpaceNode *snode, float cursor[2]);
|
||||
void node_set_cursor(wmWindow &win, SpaceNode &snode, const blender::float2 &cursor);
|
||||
/* DPI scaled coords */
|
||||
void node_to_view(const bNode *node, float x, float y, float *rx, float *ry);
|
||||
void node_to_updated_rect(const bNode *node, rctf *r_rect);
|
||||
void node_from_view(const 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);
|
||||
void node_to_updated_rect(const bNode &node, rctf &r_rect);
|
||||
void node_from_view(const bNode &node, float x, float y, float *rx, float *ry);
|
||||
|
||||
void node_toolbar_register(ARegionType *art);
|
||||
|
||||
void node_operatortypes(void);
|
||||
void node_keymap(wmKeyConfig *keyconf);
|
||||
|
||||
void node_deselect_all(SpaceNode *snode);
|
||||
void node_socket_select(bNode *node, bNodeSocket *sock);
|
||||
void node_socket_deselect(bNode *node, bNodeSocket *sock, const bool deselect_node);
|
||||
void node_deselect_all_input_sockets(SpaceNode *snode, const bool deselect_nodes);
|
||||
void node_deselect_all_output_sockets(SpaceNode *snode, const bool deselect_nodes);
|
||||
void node_select_single(bContext *C, bNode *node);
|
||||
void node_deselect_all(SpaceNode &snode);
|
||||
void node_socket_select(bNode *node, bNodeSocket &sock);
|
||||
void node_socket_deselect(bNode *node, bNodeSocket &sock, const bool deselect_node);
|
||||
void node_deselect_all_input_sockets(SpaceNode &snode, const bool deselect_nodes);
|
||||
void node_deselect_all_output_sockets(SpaceNode &snode, const bool deselect_nodes);
|
||||
void node_select_single(bContext &C, bNode &node);
|
||||
|
||||
void NODE_OT_select(wmOperatorType *ot);
|
||||
void NODE_OT_select_all(wmOperatorType *ot);
|
||||
|
@ -151,8 +151,8 @@ void NODE_OT_select_grouped(wmOperatorType *ot);
|
|||
void NODE_OT_select_same_type_step(wmOperatorType *ot);
|
||||
void NODE_OT_find_node(wmOperatorType *ot);
|
||||
|
||||
int space_node_view_flag(
|
||||
bContext *C, SpaceNode *snode, ARegion *region, const int node_flag, const int smooth_viewtx);
|
||||
bool space_node_view_flag(
|
||||
bContext &C, SpaceNode &snode, ARegion ®ion, int node_flag, int smooth_viewtx);
|
||||
|
||||
void NODE_OT_view_all(wmOperatorType *ot);
|
||||
void NODE_OT_view_selected(wmOperatorType *ot);
|
||||
|
@ -163,35 +163,35 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot);
|
|||
void NODE_OT_backimage_fit(wmOperatorType *ot);
|
||||
void NODE_OT_backimage_sample(wmOperatorType *ot);
|
||||
|
||||
void nodelink_batch_start(SpaceNode *snode);
|
||||
void nodelink_batch_end(SpaceNode *snode);
|
||||
void nodelink_batch_start(SpaceNode &snode);
|
||||
void nodelink_batch_end(SpaceNode &snode);
|
||||
|
||||
void node_draw_link(const bContext *C,
|
||||
const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link);
|
||||
void node_draw_link_bezier(const bContext *C,
|
||||
const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link,
|
||||
void node_draw_link(const bContext &C,
|
||||
const View2D &v2d,
|
||||
const SpaceNode &snode,
|
||||
const bNodeLink &link);
|
||||
void node_draw_link_bezier(const bContext &C,
|
||||
const View2D &v2d,
|
||||
const SpaceNode &snode,
|
||||
const bNodeLink &link,
|
||||
int th_col1,
|
||||
int th_col2,
|
||||
int th_col3);
|
||||
bool node_link_bezier_points(const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link,
|
||||
const bNodeLink &link,
|
||||
float coord_array[][2],
|
||||
const int resol);
|
||||
bool node_link_bezier_handles(const View2D *v2d,
|
||||
const SpaceNode *snode,
|
||||
const bNodeLink *link,
|
||||
const bNodeLink &ink,
|
||||
float vec[4][2]);
|
||||
void draw_nodespace_back_pix(const bContext *C,
|
||||
ARegion *region,
|
||||
SpaceNode *snode,
|
||||
void draw_nodespace_back_pix(const bContext &C,
|
||||
ARegion ®ion,
|
||||
SpaceNode &snode,
|
||||
bNodeInstanceKey parent_key);
|
||||
|
||||
bNode *node_add_node(const bContext *C, const char *idname, int type, float locx, float locy);
|
||||
bNode *node_add_node(const bContext &C, const char *idname, int type, float locx, float locy);
|
||||
void NODE_OT_add_reroute(wmOperatorType *ot);
|
||||
void NODE_OT_add_group(wmOperatorType *ot);
|
||||
void NODE_OT_add_object(wmOperatorType *ot);
|
||||
|
@ -208,11 +208,11 @@ void NODE_OT_group_ungroup(wmOperatorType *ot);
|
|||
void NODE_OT_group_separate(wmOperatorType *ot);
|
||||
void NODE_OT_group_edit(wmOperatorType *ot);
|
||||
|
||||
void sort_multi_input_socket_links(SpaceNode *snode,
|
||||
bNode *node,
|
||||
void sort_multi_input_socket_links(SpaceNode &snode,
|
||||
bNode &node,
|
||||
bNodeLink *drag_link,
|
||||
float cursor[2]);
|
||||
bool node_connected_to_output(Main *bmain, bNodeTree *ntree, bNode *node);
|
||||
const blender::float2 *cursor);
|
||||
bool node_connected_to_output(Main &bmain, bNodeTree &ntree, bNode &node);
|
||||
|
||||
void NODE_OT_link(wmOperatorType *ot);
|
||||
void NODE_OT_link_make(wmOperatorType *ot);
|
||||
|
@ -229,21 +229,24 @@ void NODE_OT_link_viewer(wmOperatorType *ot);
|
|||
|
||||
void NODE_OT_insert_offset(wmOperatorType *ot);
|
||||
|
||||
void snode_notify(bContext *C, SpaceNode *snode);
|
||||
void snode_dag_update(bContext *C, SpaceNode *snode);
|
||||
void snode_set_context(const bContext *C);
|
||||
void snode_notify(bContext &C, SpaceNode &snode);
|
||||
void snode_dag_update(bContext &C, SpaceNode &snode);
|
||||
void snode_set_context(const bContext &C);
|
||||
|
||||
void snode_update(SpaceNode *snode, bNode *node);
|
||||
void snode_update(SpaceNode &snode, bNode *node);
|
||||
bool composite_node_active(bContext *C);
|
||||
bool composite_node_editable(bContext *C);
|
||||
|
||||
bool node_has_hidden_sockets(bNode *node);
|
||||
void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
|
||||
int node_render_changed_exec(bContext *, wmOperator *);
|
||||
bool node_find_indicated_socket(
|
||||
SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, const float cursor[2], int in_out);
|
||||
float node_link_dim_factor(const View2D *v2d, const bNodeLink *link);
|
||||
bool node_link_is_hidden_or_dimmed(const View2D *v2d, const bNodeLink *link);
|
||||
bool node_find_indicated_socket(SpaceNode &snode,
|
||||
bNode **nodep,
|
||||
bNodeSocket **sockp,
|
||||
const blender::float2 &cursor,
|
||||
eNodeSocketInOut in_out);
|
||||
float node_link_dim_factor(const View2D &v2d, const bNodeLink &link);
|
||||
bool node_link_is_hidden_or_dimmed(const View2D &v2d, const bNodeLink &link);
|
||||
|
||||
void NODE_OT_duplicate(wmOperatorType *ot);
|
||||
void NODE_OT_delete(wmOperatorType *ot);
|
||||
|
@ -288,11 +291,11 @@ void NODE_GGT_backdrop_corner_pin(wmGizmoGroupType *gzgt);
|
|||
void NODE_OT_cryptomatte_layer_add(wmOperatorType *ot);
|
||||
void NODE_OT_cryptomatte_layer_remove(wmOperatorType *ot);
|
||||
|
||||
void node_geometry_add_attribute_search_button(const bContext *C,
|
||||
const bNodeTree *node_tree,
|
||||
const bNode *node,
|
||||
PointerRNA *socket_ptr,
|
||||
uiLayout *layout);
|
||||
void node_geometry_add_attribute_search_button(const bContext &C,
|
||||
const bNodeTree &node_tree,
|
||||
const bNode &node,
|
||||
PointerRNA &socket_ptr,
|
||||
uiLayout &layout);
|
||||
|
||||
extern const char *node_context_dir[];
|
||||
|
||||
|
@ -302,8 +305,8 @@ extern const char *node_context_dir[];
|
|||
#define NODE_DYS (U.widget_unit / 2)
|
||||
#define NODE_DY U.widget_unit
|
||||
#define NODE_SOCKDY (0.1f * U.widget_unit)
|
||||
#define NODE_WIDTH(node) (node->width * UI_DPI_FAC)
|
||||
#define NODE_HEIGHT(node) (node->height * UI_DPI_FAC)
|
||||
#define NODE_WIDTH(node) (node.width * UI_DPI_FAC)
|
||||
#define NODE_HEIGHT(node) (node.height * UI_DPI_FAC)
|
||||
#define NODE_MARGIN_X (1.2f * U.widget_unit)
|
||||
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
|
||||
#define NODE_MULTI_INPUT_LINK_GAP (0.25f * U.widget_unit)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -63,6 +63,8 @@
|
|||
|
||||
#include "node_intern.hh" /* own include */
|
||||
|
||||
using blender::float2;
|
||||
|
||||
/**
|
||||
* Function to detect if there is a visible view3d that uses workbench in texture mode.
|
||||
* This function is for fixing T76970 for Blender 2.83. The actual fix should add a mechanism in
|
||||
|
@ -98,11 +100,11 @@ static bool has_workbench_in_texture_color(const wmWindowManager *wm,
|
|||
/** \name Public Node Selection API
|
||||
* \{ */
|
||||
|
||||
static bNode *node_under_mouse_select(bNodeTree *ntree, int mx, int my)
|
||||
static bNode *node_under_mouse_select(bNodeTree &ntree, int mx, int my)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for (node = (bNode *)ntree->nodes.last; node; node = node->prev) {
|
||||
for (node = (bNode *)ntree.nodes.last; node; node = node->prev) {
|
||||
if (node->typeinfo->select_area_func) {
|
||||
if (node->typeinfo->select_area_func(node, mx, my)) {
|
||||
return node;
|
||||
|
@ -112,13 +114,13 @@ static bNode *node_under_mouse_select(bNodeTree *ntree, int mx, int my)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bNode *node_under_mouse_tweak(bNodeTree *ntree, int mx, int my)
|
||||
static bNode *node_under_mouse_tweak(bNodeTree &ntree, const float2 &mouse)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for (node = (bNode *)ntree->nodes.last; node; node = node->prev) {
|
||||
for (node = (bNode *)ntree.nodes.last; node; node = node->prev) {
|
||||
if (node->typeinfo->tweak_area_func) {
|
||||
if (node->typeinfo->tweak_area_func(node, mx, my)) {
|
||||
if (node->typeinfo->tweak_area_func(node, (int)mouse.x, (int)mouse.y)) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
@ -126,15 +128,16 @@ static bNode *node_under_mouse_tweak(bNodeTree *ntree, int mx, int my)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool is_position_over_node_or_socket(SpaceNode *snode, float mouse[2])
|
||||
static bool is_position_over_node_or_socket(SpaceNode &snode, const float2 &mouse)
|
||||
{
|
||||
if (node_under_mouse_tweak(snode->edittree, mouse[0], mouse[1])) {
|
||||
if (node_under_mouse_tweak(*snode.edittree, mouse)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
if (node_find_indicated_socket(snode, &node, &sock, mouse, SOCK_IN | SOCK_OUT)) {
|
||||
if (node_find_indicated_socket(
|
||||
snode, &node, &sock, mouse, (eNodeSocketInOut)(SOCK_IN | SOCK_OUT))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -145,9 +148,9 @@ static bool is_event_over_node_or_socket(bContext *C, const wmEvent *event)
|
|||
{
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
float mouse[2];
|
||||
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &mouse[0], &mouse[1]);
|
||||
return is_position_over_node_or_socket(snode, mouse);
|
||||
float2 mouse;
|
||||
UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &mouse.x, &mouse.y);
|
||||
return is_position_over_node_or_socket(*snode, mouse);
|
||||
}
|
||||
|
||||
static void node_toggle(bNode *node)
|
||||
|
@ -155,9 +158,9 @@ static void node_toggle(bNode *node)
|
|||
nodeSetSelected(node, !(node->flag & SELECT));
|
||||
}
|
||||
|
||||
void node_socket_select(bNode *node, bNodeSocket *sock)
|
||||
void node_socket_select(bNode *node, bNodeSocket &sock)
|
||||
{
|
||||
sock->flag |= SELECT;
|
||||
sock.flag |= SELECT;
|
||||
|
||||
/* select node too */
|
||||
if (node) {
|
||||
|
@ -165,22 +168,22 @@ void node_socket_select(bNode *node, bNodeSocket *sock)
|
|||
}
|
||||
}
|
||||
|
||||
void node_socket_deselect(bNode *node, bNodeSocket *sock, const bool deselect_node)
|
||||
void node_socket_deselect(bNode *node, bNodeSocket &sock, const bool deselect_node)
|
||||
{
|
||||
sock->flag &= ~SELECT;
|
||||
sock.flag &= ~SELECT;
|
||||
|
||||
if (node && deselect_node) {
|
||||
bool sel = false;
|
||||
|
||||
/* if no selected sockets remain, also deselect the node */
|
||||
for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) {
|
||||
if (sock->flag & SELECT) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, input, &node->inputs) {
|
||||
if (input->flag & SELECT) {
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (sock = (bNodeSocket *)node->outputs.first; sock; sock = sock->next) {
|
||||
if (sock->flag & SELECT) {
|
||||
LISTBASE_FOREACH (bNodeSocket *, output, &node->outputs) {
|
||||
if (output->flag & SELECT) {
|
||||
sel = true;
|
||||
break;
|
||||
}
|
||||
|
@ -192,9 +195,9 @@ void node_socket_deselect(bNode *node, bNodeSocket *sock, const bool deselect_no
|
|||
}
|
||||
}
|
||||
|
||||
static void node_socket_toggle(bNode *node, bNodeSocket *sock, int deselect_node)
|
||||
static void node_socket_toggle(bNode *node, bNodeSocket &sock, bool deselect_node)
|
||||
{
|
||||
if (sock->flag & SELECT) {
|
||||
if (sock.flag & SELECT) {
|
||||
node_socket_deselect(node, sock, deselect_node);
|
||||
}
|
||||
else {
|
||||
|
@ -202,17 +205,14 @@ static void node_socket_toggle(bNode *node, bNodeSocket *sock, int deselect_node
|
|||
}
|
||||
}
|
||||
|
||||
/* no undo here! */
|
||||
void node_deselect_all(SpaceNode *snode)
|
||||
void node_deselect_all(SpaceNode &snode)
|
||||
{
|
||||
bNode *node;
|
||||
|
||||
for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) {
|
||||
LISTBASE_FOREACH (bNode *, node, &snode.edittree->nodes) {
|
||||
nodeSetSelected(node, false);
|
||||
}
|
||||
}
|
||||
|
||||
void node_deselect_all_input_sockets(SpaceNode *snode, const bool deselect_nodes)
|
||||
void node_deselect_all_input_sockets(SpaceNode &snode, const bool deselect_nodes)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
|
@ -222,7 +222,7 @@ void node_deselect_all_input_sockets(SpaceNode *snode, const bool deselect_nodes
|
|||
* We can do that more efficiently here.
|
||||
*/
|
||||
|
||||
for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) {
|
||||
for (node = (bNode *)snode.edittree->nodes.first; node; node = node->next) {
|
||||
int sel = 0;
|
||||
|
||||
for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) {
|
||||
|
@ -245,7 +245,7 @@ void node_deselect_all_input_sockets(SpaceNode *snode, const bool deselect_nodes
|
|||
}
|
||||
}
|
||||
|
||||
void node_deselect_all_output_sockets(SpaceNode *snode, const bool deselect_nodes)
|
||||
void node_deselect_all_output_sockets(SpaceNode &snode, const bool deselect_nodes)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *sock;
|
||||
|
@ -255,7 +255,7 @@ void node_deselect_all_output_sockets(SpaceNode *snode, const bool deselect_node
|
|||
* We can do that more efficiently here.
|
||||
*/
|
||||
|
||||
for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) {
|
||||
for (node = (bNode *)snode.edittree->nodes.first; node; node = node->next) {
|
||||
bool sel = false;
|
||||
|
||||
for (sock = (bNodeSocket *)node->outputs.first; sock; sock = sock->next) {
|
||||
|
@ -455,24 +455,24 @@ void NODE_OT_select_grouped(wmOperatorType *ot)
|
|||
/** \name Select (Cursor Pick) Operator
|
||||
* \{ */
|
||||
|
||||
void node_select_single(bContext *C, bNode *node)
|
||||
void node_select_single(bContext &C, bNode &node)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
const Object *ob = CTX_data_active_object(C);
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const wmWindowManager *wm = CTX_wm_manager(C);
|
||||
Main *bmain = CTX_data_main(&C);
|
||||
SpaceNode *snode = CTX_wm_space_node(&C);
|
||||
const Object *ob = CTX_data_active_object(&C);
|
||||
const Scene *scene = CTX_data_scene(&C);
|
||||
const wmWindowManager *wm = CTX_wm_manager(&C);
|
||||
bool active_texture_changed = false;
|
||||
bNode *tnode;
|
||||
|
||||
for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
if (tnode != node) {
|
||||
if (tnode != &node) {
|
||||
nodeSetSelected(tnode, false);
|
||||
}
|
||||
}
|
||||
nodeSetSelected(node, true);
|
||||
nodeSetSelected(&node, true);
|
||||
|
||||
ED_node_set_active(bmain, snode, snode->edittree, node, &active_texture_changed);
|
||||
ED_node_set_active(bmain, snode, snode->edittree, &node, &active_texture_changed);
|
||||
ED_node_set_active_viewer_key(snode);
|
||||
|
||||
ED_node_sort(snode->edittree);
|
||||
|
@ -480,7 +480,7 @@ void node_select_single(bContext *C, bNode *node)
|
|||
DEG_id_tag_update(&snode->edittree->id, ID_RECALC_COPY_ON_WRITE);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr);
|
||||
WM_event_add_notifier(&C, NC_NODE | NA_SELECTED, nullptr);
|
||||
}
|
||||
|
||||
static int node_mouse_select(bContext *C,
|
||||
|
@ -488,9 +488,9 @@ static int node_mouse_select(bContext *C,
|
|||
const int mval[2],
|
||||
bool wait_to_deselect_others)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
Main &bmain = *CTX_data_main(C);
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
ARegion ®ion = *CTX_wm_region(C);
|
||||
const Object *ob = CTX_data_active_object(C);
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
const wmWindowManager *wm = CTX_wm_manager(C);
|
||||
|
@ -511,20 +511,20 @@ static int node_mouse_select(bContext *C,
|
|||
}
|
||||
|
||||
/* get mouse coordinates in view2d space */
|
||||
UI_view2d_region_to_view(®ion->v2d, mval[0], mval[1], &cursor[0], &cursor[1]);
|
||||
UI_view2d_region_to_view(®ion.v2d, mval[0], mval[1], &cursor[0], &cursor[1]);
|
||||
|
||||
/* first do socket selection, these generally overlap with nodes. */
|
||||
if (socket_select) {
|
||||
if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN)) {
|
||||
/* NOTE: SOCK_IN does not take into account the extend case...
|
||||
* This feature is not really used anyway currently? */
|
||||
node_socket_toggle(node, sock, true);
|
||||
node_socket_toggle(node, *sock, true);
|
||||
ret_value = OPERATOR_FINISHED;
|
||||
}
|
||||
else if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_OUT)) {
|
||||
if (sock->flag & SELECT) {
|
||||
if (extend) {
|
||||
node_socket_deselect(node, sock, true);
|
||||
node_socket_deselect(node, *sock, true);
|
||||
}
|
||||
else {
|
||||
ret_value = OPERATOR_FINISHED;
|
||||
|
@ -538,20 +538,20 @@ static int node_mouse_select(bContext *C,
|
|||
if (tsock == sock) {
|
||||
continue;
|
||||
}
|
||||
node_socket_deselect(node, tsock, true);
|
||||
node_socket_deselect(node, *tsock, true);
|
||||
}
|
||||
}
|
||||
if (!extend) {
|
||||
for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
for (tnode = (bNode *)snode.edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
if (tnode == node) {
|
||||
continue;
|
||||
}
|
||||
for (tsock = (bNodeSocket *)tnode->outputs.first; tsock; tsock = tsock->next) {
|
||||
node_socket_deselect(tnode, tsock, true);
|
||||
node_socket_deselect(tnode, *tsock, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
node_socket_select(node, sock);
|
||||
node_socket_select(node, *sock);
|
||||
ret_value = OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ static int node_mouse_select(bContext *C,
|
|||
|
||||
if (!sock) {
|
||||
/* find the closest visible node */
|
||||
node = node_under_mouse_select(snode->edittree, (int)cursor[0], (int)cursor[1]);
|
||||
node = node_under_mouse_select(*snode.edittree, (int)cursor[0], (int)cursor[1]);
|
||||
|
||||
if (extend) {
|
||||
if (node != nullptr) {
|
||||
|
@ -580,7 +580,7 @@ static int node_mouse_select(bContext *C,
|
|||
}
|
||||
else {
|
||||
/* Deselect in empty space. */
|
||||
for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
for (tnode = (bNode *)snode.edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
nodeSetSelected(tnode, false);
|
||||
}
|
||||
ret_value = OPERATOR_FINISHED;
|
||||
|
@ -595,7 +595,7 @@ static int node_mouse_select(bContext *C,
|
|||
else {
|
||||
nodeSetSelected(node, true);
|
||||
|
||||
for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
for (tnode = (bNode *)snode.edittree->nodes.first; tnode; tnode = tnode->next) {
|
||||
if (tnode != node) {
|
||||
nodeSetSelected(tnode, false);
|
||||
}
|
||||
|
@ -612,16 +612,16 @@ static int node_mouse_select(bContext *C,
|
|||
bool viewer_node_changed = false;
|
||||
if (node != nullptr && ret_value != OPERATOR_RUNNING_MODAL) {
|
||||
viewer_node_changed = (node->flag & NODE_DO_OUTPUT) == 0 && node->type == GEO_NODE_VIEWER;
|
||||
ED_node_set_active(bmain, snode, snode->edittree, node, &active_texture_changed);
|
||||
ED_node_set_active(&bmain, &snode, snode.edittree, node, &active_texture_changed);
|
||||
}
|
||||
else if (node != nullptr && node->type == GEO_NODE_VIEWER) {
|
||||
ED_spreadsheet_context_paths_set_geometry_node(bmain, snode, node);
|
||||
ED_spreadsheet_context_paths_set_geometry_node(&bmain, &snode, node);
|
||||
}
|
||||
ED_node_set_active_viewer_key(snode);
|
||||
ED_node_sort(snode->edittree);
|
||||
ED_node_set_active_viewer_key(&snode);
|
||||
ED_node_sort(snode.edittree);
|
||||
if ((active_texture_changed && has_workbench_in_texture_color(wm, scene, ob)) ||
|
||||
viewer_node_changed) {
|
||||
DEG_id_tag_update(&snode->edittree->id, ID_RECALC_COPY_ON_WRITE);
|
||||
DEG_id_tag_update(&snode.edittree->id, ID_RECALC_COPY_ON_WRITE);
|
||||
}
|
||||
|
||||
WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr);
|
||||
|
@ -1149,13 +1149,13 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
}
|
||||
|
||||
node_select_single(C, active);
|
||||
node_select_single(*C, *active);
|
||||
|
||||
/* is note outside view? */
|
||||
if (active->totr.xmax < region->v2d.cur.xmin || active->totr.xmin > region->v2d.cur.xmax ||
|
||||
active->totr.ymax < region->v2d.cur.ymin || active->totr.ymin > region->v2d.cur.ymax) {
|
||||
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
|
||||
space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx);
|
||||
space_node_view_flag(*C, *snode, *region, NODE_SELECT, smooth_viewtx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1239,12 +1239,12 @@ static void node_find_exec_fn(struct bContext *C, void *UNUSED(arg1), void *arg2
|
|||
|
||||
if (active) {
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
node_select_single(C, active);
|
||||
node_select_single(*C, *active);
|
||||
|
||||
/* is note outside view? */
|
||||
if (active->totr.xmax < region->v2d.cur.xmin || active->totr.xmin > region->v2d.cur.xmax ||
|
||||
active->totr.ymax < region->v2d.cur.ymin || active->totr.ymin > region->v2d.cur.ymax) {
|
||||
space_node_view_flag(C, snode, region, NODE_SELECT, U.smooth_viewtx);
|
||||
space_node_view_flag(*C, *snode, *region, NODE_SELECT, U.smooth_viewtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -709,7 +709,7 @@ void uiTemplateNodeLink(
|
|||
|
||||
PointerRNA node_ptr;
|
||||
RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
|
||||
node_socket_color_get(C, ntree, &node_ptr, input, socket_col);
|
||||
node_socket_color_get(*C, *ntree, node_ptr, *input, socket_col);
|
||||
|
||||
UI_block_layout_set_current(block, layout);
|
||||
|
||||
|
@ -769,7 +769,6 @@ static void ui_node_draw_input(
|
|||
PointerRNA inputptr, nodeptr;
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
uiLayout *row = nullptr;
|
||||
bNode *lnode;
|
||||
bool dependency_loop;
|
||||
|
||||
if (input->flag & SOCK_UNAVAIL) {
|
||||
|
@ -778,7 +777,7 @@ static void ui_node_draw_input(
|
|||
|
||||
/* to avoid eternal loops on cyclic dependencies */
|
||||
node->flag |= NODE_TEST;
|
||||
lnode = (input->link) ? input->link->fromnode : nullptr;
|
||||
bNode *lnode = (input->link) ? input->link->fromnode : nullptr;
|
||||
|
||||
dependency_loop = (lnode && (lnode->flag & NODE_TEST));
|
||||
if (dependency_loop) {
|
||||
|
@ -868,7 +867,7 @@ static void ui_node_draw_input(
|
|||
if (node_tree->type == NTREE_GEOMETRY && snode != nullptr) {
|
||||
/* Only add the attribute search in the node editor, in other places there is not
|
||||
* enough context. */
|
||||
node_geometry_add_attribute_search_button(C, node_tree, node, &inputptr, row);
|
||||
node_geometry_add_attribute_search_button(*C, *node_tree, *node, inputptr, *row);
|
||||
}
|
||||
else {
|
||||
uiItemR(sub, &inputptr, "default_value", 0, "", ICON_NONE);
|
||||
|
|
|
@ -62,25 +62,21 @@ using blender::StringRef;
|
|||
/** \name View All Operator
|
||||
* \{ */
|
||||
|
||||
int space_node_view_flag(
|
||||
bContext *C, SpaceNode *snode, ARegion *region, const int node_flag, const int smooth_viewtx)
|
||||
bool space_node_view_flag(
|
||||
bContext &C, SpaceNode &snode, ARegion ®ion, const int node_flag, const int smooth_viewtx)
|
||||
{
|
||||
bNode *node;
|
||||
const float oldwidth = BLI_rctf_size_x(®ion.v2d.cur);
|
||||
const float oldheight = BLI_rctf_size_y(®ion.v2d.cur);
|
||||
|
||||
const float old_aspect = oldwidth / oldheight;
|
||||
|
||||
rctf cur_new;
|
||||
float oldwidth, oldheight, width, height;
|
||||
float oldasp, asp;
|
||||
int tot = 0;
|
||||
bool has_frame = false;
|
||||
|
||||
oldwidth = BLI_rctf_size_x(®ion->v2d.cur);
|
||||
oldheight = BLI_rctf_size_y(®ion->v2d.cur);
|
||||
|
||||
oldasp = oldwidth / oldheight;
|
||||
|
||||
BLI_rctf_init_minmax(&cur_new);
|
||||
|
||||
if (snode->edittree) {
|
||||
for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) {
|
||||
int tot = 0;
|
||||
bool has_frame = false;
|
||||
if (snode.edittree) {
|
||||
LISTBASE_FOREACH (const bNode *, node, &snode.edittree->nodes) {
|
||||
if ((node->flag & node_flag) == node_flag) {
|
||||
BLI_rctf_union(&cur_new, &node->totr);
|
||||
tot++;
|
||||
|
@ -92,37 +88,39 @@ int space_node_view_flag(
|
|||
}
|
||||
}
|
||||
|
||||
if (tot) {
|
||||
width = BLI_rctf_size_x(&cur_new);
|
||||
height = BLI_rctf_size_y(&cur_new);
|
||||
asp = width / height;
|
||||
|
||||
/* for single non-frame nodes, don't zoom in, just pan view,
|
||||
* but do allow zooming out, this allows for big nodes to be zoomed out */
|
||||
if ((tot == 1) && (has_frame == false) && ((oldwidth * oldheight) > (width * height))) {
|
||||
/* center, don't zoom */
|
||||
BLI_rctf_resize(&cur_new, oldwidth, oldheight);
|
||||
}
|
||||
else {
|
||||
if (oldasp < asp) {
|
||||
const float height_new = width / oldasp;
|
||||
cur_new.ymin = cur_new.ymin - height_new / 2.0f;
|
||||
cur_new.ymax = cur_new.ymax + height_new / 2.0f;
|
||||
}
|
||||
else {
|
||||
const float width_new = height * oldasp;
|
||||
cur_new.xmin = cur_new.xmin - width_new / 2.0f;
|
||||
cur_new.xmax = cur_new.xmax + width_new / 2.0f;
|
||||
}
|
||||
|
||||
/* add some padding */
|
||||
BLI_rctf_scale(&cur_new, 1.1f);
|
||||
}
|
||||
|
||||
UI_view2d_smooth_view(C, region, &cur_new, smooth_viewtx);
|
||||
if (tot == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (tot != 0);
|
||||
const float width = BLI_rctf_size_x(&cur_new);
|
||||
const float height = BLI_rctf_size_y(&cur_new);
|
||||
const float new_aspect = width / height;
|
||||
|
||||
/* for single non-frame nodes, don't zoom in, just pan view,
|
||||
* but do allow zooming out, this allows for big nodes to be zoomed out */
|
||||
if ((tot == 1) && (has_frame == false) && ((oldwidth * oldheight) > (width * height))) {
|
||||
/* center, don't zoom */
|
||||
BLI_rctf_resize(&cur_new, oldwidth, oldheight);
|
||||
}
|
||||
else {
|
||||
if (old_aspect < new_aspect) {
|
||||
const float height_new = width / old_aspect;
|
||||
cur_new.ymin = cur_new.ymin - height_new / 2.0f;
|
||||
cur_new.ymax = cur_new.ymax + height_new / 2.0f;
|
||||
}
|
||||
else {
|
||||
const float width_new = height * old_aspect;
|
||||
cur_new.xmin = cur_new.xmin - width_new / 2.0f;
|
||||
cur_new.xmax = cur_new.xmax + width_new / 2.0f;
|
||||
}
|
||||
|
||||
/* add some padding */
|
||||
BLI_rctf_scale(&cur_new, 1.1f);
|
||||
}
|
||||
|
||||
UI_view2d_smooth_view(&C, ®ion, &cur_new, smooth_viewtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int node_view_all_exec(bContext *C, wmOperator *op)
|
||||
|
@ -135,7 +133,7 @@ static int node_view_all_exec(bContext *C, wmOperator *op)
|
|||
snode->xof = 0;
|
||||
snode->yof = 0;
|
||||
|
||||
if (space_node_view_flag(C, snode, region, 0, smooth_viewtx)) {
|
||||
if (space_node_view_flag(*C, *snode, *region, 0, smooth_viewtx)) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -168,7 +166,7 @@ static int node_view_selected_exec(bContext *C, wmOperator *op)
|
|||
SpaceNode *snode = CTX_wm_space_node(C);
|
||||
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
|
||||
|
||||
if (space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx)) {
|
||||
if (space_node_view_flag(*C, *snode, *region, NODE_SELECT, smooth_viewtx)) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -738,7 +736,7 @@ static int space_node_view_geometry_nodes_legacy(bContext *C, SpaceNode *snode,
|
|||
}
|
||||
|
||||
const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
|
||||
if (space_node_view_flag(C, snode, region, NODE_SELECT, smooth_viewtx)) {
|
||||
if (space_node_view_flag(*C, *snode, *region, NODE_SELECT, smooth_viewtx)) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
return OPERATOR_CANCELLED;
|
||||
|
|
|
@ -479,7 +479,7 @@ static void node_area_refresh(const struct bContext *C, ScrArea *area)
|
|||
/* default now: refresh node is starting preview */
|
||||
SpaceNode *snode = (SpaceNode *)area->spacedata.first;
|
||||
|
||||
snode_set_context(C);
|
||||
snode_set_context(*C);
|
||||
|
||||
if (snode->nodetree) {
|
||||
if (snode->nodetree->type == NTREE_SHADER) {
|
||||
|
@ -595,7 +595,7 @@ static void node_cursor(wmWindow *win, ScrArea *area, ARegion *region)
|
|||
&snode->runtime->cursor[1]);
|
||||
|
||||
/* here snode->runtime->cursor is used to detect the node edge for sizing */
|
||||
node_set_cursor(win, snode, snode->runtime->cursor);
|
||||
node_set_cursor(*win, *snode, snode->runtime->cursor);
|
||||
|
||||
/* XXX snode->runtime->cursor is in placing new nodes space */
|
||||
snode->runtime->cursor[0] /= UI_DPI_FAC;
|
||||
|
@ -629,7 +629,7 @@ static void node_main_region_init(wmWindowManager *wm, ARegion *region)
|
|||
|
||||
static void node_main_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
node_draw_space(C, region);
|
||||
node_draw_space(*C, *region);
|
||||
}
|
||||
|
||||
/* ************* dropboxes ************* */
|
||||
|
@ -752,7 +752,7 @@ static void node_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region
|
|||
static void node_header_region_draw(const bContext *C, ARegion *region)
|
||||
{
|
||||
/* find and set the context */
|
||||
snode_set_context(C);
|
||||
snode_set_context(*C);
|
||||
|
||||
ED_region_header(C, region);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue