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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/drawnode.c101
-rw-r--r--source/blender/editors/space_node/node_add.c3
-rw-r--r--source/blender/editors/space_node/node_buttons.c4
-rw-r--r--source/blender/editors/space_node/node_draw.c34
-rw-r--r--source/blender/editors/space_node/node_edit.c78
-rw-r--r--source/blender/editors/space_node/node_group.c43
-rw-r--r--source/blender/editors/space_node/node_intern.h5
-rw-r--r--source/blender/editors/space_node/node_templates.c2
-rw-r--r--source/blender/editors/space_node/space_node.c2
9 files changed, 190 insertions, 82 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 0b02aef2fab..a413eb47140 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -114,18 +114,18 @@ static void node_add_menu_class(bContext *C, uiLayout *layout, void *arg_nodecla
continue;
switch (ntree->type) {
- case NTREE_COMPOSIT:
- ngroup_type = "CompositorNodeTree";
- node_type = "CompositorNodeGroup";
- break;
- case NTREE_SHADER:
- ngroup_type = "ShaderNodeTree";
- node_type = "ShaderNodeGroup";
- break;
- case NTREE_TEXTURE:
- ngroup_type = "TextureNodeTree";
- node_type = "TextureNodeGroup";
- break;
+ case NTREE_COMPOSIT:
+ ngroup_type = "CompositorNodeTree";
+ node_type = "CompositorNodeGroup";
+ break;
+ case NTREE_SHADER:
+ ngroup_type = "ShaderNodeTree";
+ node_type = "ShaderNodeGroup";
+ break;
+ case NTREE_TEXTURE:
+ ngroup_type = "TextureNodeTree";
+ node_type = "TextureNodeGroup";
+ break;
}
ptr = uiItemFullO(layout, "NODE_OT_group_make", "New Group", ntype->ui_icon, NULL, WM_OP_INVOKE_DEFAULT, UI_ITEM_O_RETURN_PROPS);
@@ -1165,7 +1165,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
if (!node->id) return;
col = uiLayoutColumn(layout, FALSE);
- row = uiLayoutRow(col, FALSE);
+ row = uiLayoutRow(col, TRUE);
uiItemR(row, ptr, "layer", 0, "", ICON_NONE);
prop = RNA_struct_find_property(ptr, "layer");
@@ -2708,8 +2708,57 @@ static void node_template_properties_update(bNodeType *ntype)
}
}
+static void node_socket_undefined_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr))
+{
+ uiItemL(layout, "Undefined Socket Type", ICON_ERROR);
+}
+
+static void node_socket_undefined_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PointerRNA *UNUSED(node_ptr), float *r_color)
+{
+ r_color[0] = 1.0f;
+ r_color[1] = 0.0f;
+ r_color[2] = 0.0f;
+ r_color[3] = 1.0f;
+}
+
+static void node_socket_undefined_interface_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *UNUSED(ptr))
+{
+ uiItemL(layout, "Undefined Socket Type", ICON_ERROR);
+}
+
+static void node_socket_undefined_interface_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), float *r_color)
+{
+ r_color[0] = 1.0f;
+ r_color[1] = 0.0f;
+ r_color[2] = 0.0f;
+ r_color[3] = 1.0f;
+}
+
void ED_node_init_butfuncs(void)
{
+ /* Fallback types for undefined tree, nodes, sockets
+ * Defined in blenkernel, but not registered in type hashes.
+ */
+ /*extern bNodeTreeType NodeTreeTypeUndefined;*/
+ extern bNodeType NodeTypeUndefined;
+ extern bNodeSocketType NodeSocketTypeUndefined;
+
+ /* default ui functions */
+ NodeTypeUndefined.drawfunc = node_draw_default;
+ NodeTypeUndefined.drawupdatefunc = node_update_default;
+ NodeTypeUndefined.select_area_func = node_select_area_default;
+ NodeTypeUndefined.tweak_area_func = node_tweak_area_default;
+ NodeTypeUndefined.uifunc = NULL;
+ NodeTypeUndefined.uifuncbut = NULL;
+ NodeTypeUndefined.drawinputfunc = node_draw_input_default;
+ NodeTypeUndefined.drawoutputfunc = node_draw_output_default;
+ NodeTypeUndefined.resize_area_func = node_resize_area_default;
+
+ NodeSocketTypeUndefined.draw = node_socket_undefined_draw;
+ NodeSocketTypeUndefined.draw_color = node_socket_undefined_draw_color;
+ NodeSocketTypeUndefined.interface_draw = node_socket_undefined_interface_draw;
+ NodeSocketTypeUndefined.interface_draw_color = node_socket_undefined_interface_draw_color;
+
/* node type ui functions */
NODE_TYPES_BEGIN(ntype)
/* default ui functions */
@@ -2762,14 +2811,14 @@ void ED_init_custom_node_socket_type(bNodeSocketType *stype)
/* maps standard socket integer type to a color */
static const float std_node_socket_colors[][4] = {
- {0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */
- {0.39, 0.39, 0.78, 1.0}, /* SOCK_VECTOR */
- {0.78, 0.78, 0.16, 1.0}, /* SOCK_RGBA */
- {0.39, 0.78, 0.39, 1.0}, /* SOCK_SHADER */
- {0.70, 0.65, 0.19, 1.0}, /* SOCK_BOOLEAN */
- {0.0, 0.0, 0.0, 1.0}, /*__SOCK_MESH (deprecated) */
- {0.06, 0.52, 0.15, 1.0}, /* SOCK_INT */
- {1.0, 1.0, 1.0, 1.0}, /* SOCK_STRING */
+ {0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */
+ {0.39, 0.39, 0.78, 1.0}, /* SOCK_VECTOR */
+ {0.78, 0.78, 0.16, 1.0}, /* SOCK_RGBA */
+ {0.39, 0.78, 0.39, 1.0}, /* SOCK_SHADER */
+ {0.70, 0.65, 0.19, 1.0}, /* SOCK_BOOLEAN */
+ {0.0, 0.0, 0.0, 1.0}, /*__SOCK_MESH (deprecated) */
+ {0.06, 0.52, 0.15, 1.0}, /* SOCK_INT */
+ {1.0, 1.0, 1.0, 1.0}, /* SOCK_STRING */
};
/* common color callbacks for standard types */
@@ -2786,7 +2835,7 @@ static void std_node_socket_interface_draw_color(bContext *UNUSED(C), PointerRNA
copy_v4_v4(r_color, std_node_socket_colors[type]);
}
-static void std_node_socket_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *ptr, PointerRNA *UNUSED(node_ptr))
+static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
{
bNodeSocket *sock = ptr->data;
int type = sock->typeinfo->type;
@@ -2816,6 +2865,10 @@ static void std_node_socket_draw(bContext *UNUSED(C), uiLayout *layout, PointerR
uiItemL(row, sock->name, 0);
break;
}
+
+ default:
+ node_socket_button_label(C, layout, ptr, node_ptr);
+ break;
}
}
@@ -2911,7 +2964,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPixelZoom(snode->zoom, snode->zoom);
- glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_LINEAR, display_buffer);
+ glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer);
glPixelZoom(1.0f, 1.0f);
glDisable(GL_BLEND);
@@ -2919,7 +2972,7 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode)
else {
glPixelZoom(snode->zoom, snode->zoom);
- glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_LINEAR, display_buffer);
+ glaDrawPixelsAuto(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer);
glPixelZoom(1.0f, 1.0f);
}
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 765f2b67549..fb9e1221c38 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -110,6 +110,9 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx
if (node->id)
id_us_plus(node->id);
+ if (snode->flag & SNODE_USE_HIDDEN_PREVIEW)
+ node->flag &= ~NODE_PREVIEW;
+
snode_update(snode, node);
if (snode->nodetree->type == NTREE_TEXTURE) {
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 688377c7f3b..efdb7c0d85d 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -62,7 +62,7 @@ static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
- return (snode && ntreeIsValid(snode->nodetree));
+ return (snode && snode->nodetree);
}
/* poll callback for active node */
@@ -70,7 +70,7 @@ static int active_node_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
- return (snode && ntreeIsValid(snode->edittree) && nodeGetActive(snode->edittree));
+ return (snode && snode->edittree && nodeGetActive(snode->edittree));
}
/* active node */
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 0636dee9bc5..f1915a82f69 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -148,7 +148,7 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
void ED_node_tag_update_nodetree(Main *bmain, bNodeTree *ntree)
{
- if (!ntreeIsValid(ntree))
+ if (!ntree)
return;
/* look through all datablocks, to support groups */
@@ -359,7 +359,10 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
nsock->locx = locx + NODE_WIDTH(node);
/* place the socket circle in the middle of the layout */
nsock->locy = 0.5f * (dy + buty);
+
dy = buty;
+ if (nsock->next)
+ dy -= NODE_SOCKDY;
}
node->prvr.xmin = locx + NODE_DYS;
@@ -443,7 +446,10 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
nsock->locx = locx;
/* place the socket circle in the middle of the layout */
nsock->locy = 0.5f * (dy + buty);
+
dy = buty;
+ if (nsock->next)
+ dy -= NODE_SOCKDY;
}
/* little bit space in end */
@@ -861,7 +867,9 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
NULL, 0, 0, 0, 0, "");
/* body */
- if (node->flag & NODE_CUSTOM_COLOR)
+ if (!nodeIsRegistered(node))
+ UI_ThemeColor4(TH_REDALERT); /* use warning color to indicate undefined types */
+ else if (node->flag & NODE_CUSTOM_COLOR)
glColor3fv(node->color);
else
UI_ThemeColor4(TH_NODE);
@@ -967,7 +975,19 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
}
-
+
+ /* custom color inline */
+ if (node->flag & NODE_CUSTOM_COLOR) {
+ glEnable(GL_BLEND);
+ glEnable(GL_LINE_SMOOTH);
+
+ glColor3fv(node->color);
+ uiDrawBox(GL_LINE_LOOP, rct->xmin + 1, rct->ymin + 1, rct->xmax -1, rct->ymax - 1, hiddenrad);
+
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_BLEND);
+ }
+
/* title */
if (node->flag & SELECT)
UI_ThemeColor(TH_SELECT);
@@ -1057,7 +1077,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode)
bNodeSocket *sock;
int cursor = CURSOR_STD;
- if (ntreeIsValid(ntree)) {
+ if (ntree) {
if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN | SOCK_OUT)) {
/* pass */
}
@@ -1112,7 +1132,6 @@ static void node_draw(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTre
void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNodeInstanceKey parent_key)
{
bNode *node;
- bNodeInstanceKey key;
bNodeLink *link;
int a;
@@ -1126,6 +1145,7 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
/* draw background nodes, last nodes in front */
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
+ bNodeInstanceKey key;
#ifdef USE_DRAW_TOT_UPDATE
/* unrelated to background nodes, update the v2d->tot,
@@ -1153,7 +1173,7 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
/* draw foreground nodes, last nodes in front */
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
- bNodeInstanceKey key = BKE_node_instance_key(parent_key, ntree, node);
+ bNodeInstanceKey key;
if (node->flag & NODE_BACKGROUND)
continue;
@@ -1271,7 +1291,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
for (curdepth = depth; curdepth >= 0; path = path->next, --curdepth) {
ntree = path->nodetree;
- if (ntreeIsValid(ntree)) {
+ if (ntree) {
snode_setup_v2d(snode, ar, ntree->view_center[0], ntree->view_center[1]);
if (curdepth == 0) {
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 256b02d3288..c74c160080c 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -90,6 +90,11 @@
/* ***************** composite job manager ********************** */
+enum {
+ COM_RECALC_COMPOSITE = 1,
+ COM_RECALC_VIEWER = 2
+};
+
typedef struct CompoJob {
Scene *scene;
bNodeTree *ntree;
@@ -98,8 +103,55 @@ typedef struct CompoJob {
short *do_update;
float *progress;
short need_sync;
+ int recalc_flags;
} CompoJob;
+static void compo_tag_output_nodes(bNodeTree *nodetree, int recalc_flags)
+{
+ bNode *node;
+
+ for (node = nodetree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_COMPOSITE) {
+ if (recalc_flags & COM_RECALC_COMPOSITE)
+ node->flag |= NODE_DO_OUTPUT_RECALC;
+ }
+ else if (node->type == CMP_NODE_VIEWER) {
+ if (recalc_flags & COM_RECALC_VIEWER)
+ node->flag |= NODE_DO_OUTPUT_RECALC;
+ }
+ else if (node->type == NODE_GROUP) {
+ if (node->id)
+ compo_tag_output_nodes((bNodeTree *)node->id, recalc_flags);
+ }
+ }
+}
+
+static int compo_get_recalc_flags(const bContext *C)
+{
+ bScreen *sc = CTX_wm_screen(C);
+ ScrArea *sa;
+ int recalc_flags = 0;
+
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = sa->spacedata.first;
+ if (sima->image) {
+ if (sima->image->type == IMA_TYPE_R_RESULT)
+ recalc_flags |= COM_RECALC_COMPOSITE;
+ else if (sima->image->type == IMA_TYPE_COMPOSITE)
+ recalc_flags |= COM_RECALC_VIEWER;
+ }
+ }
+ else if (sa->spacetype == SPACE_NODE) {
+ SpaceNode *snode = sa->spacedata.first;
+ if (snode->flag & SNODE_BACKDRAW)
+ recalc_flags |= COM_RECALC_VIEWER;
+ }
+ }
+
+ return recalc_flags;
+}
+
/* called by compo, only to check job 'stop' value */
static int compo_breakjob(void *cjv)
{
@@ -148,6 +200,9 @@ static void compo_initjob(void *cjv)
CompoJob *cj = cjv;
cj->localtree = ntreeLocalize(cj->ntree);
+
+ if (cj->recalc_flags)
+ compo_tag_output_nodes(cj->localtree, cj->recalc_flags);
}
/* called before redraw notifiers, it moves finished previews over */
@@ -234,6 +289,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
/* customdata for preview thread */
cj->scene = CTX_data_scene(C);
cj->ntree = nodetree;
+ cj->recalc_flags = compo_get_recalc_flags(C);
/* setup job */
WM_jobs_customdata_set(wm_job, cj, compo_freejob);
@@ -329,15 +385,11 @@ void ED_node_shader_default(const bContext *C, ID *id)
bNode *in, *out;
bNodeSocket *fromsock, *tosock, *sock;
bNodeTree *ntree;
- PointerRNA ptr;
int output_type, shader_type;
float color[4] = { 0.0f, 0.0f, 0.0f, 1.0f }, strength = 1.0f;
ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname);
- RNA_id_pointer_create((ID *)ntree, &ptr);
- RNA_boolean_set(&ptr, "is_local_tree", TRUE);
-
switch (GS(id->name)) {
case ID_MA:
{
@@ -425,7 +477,6 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce)
{
bNode *in, *out;
bNodeSocket *fromsock, *tosock;
- PointerRNA ptr;
/* but lets check it anyway */
if (sce->nodetree) {
@@ -436,9 +487,6 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce)
sce->nodetree = ntreeAddTree(NULL, "Compositing Nodetree", ntreeType_Composite->idname);
- RNA_id_pointer_create((ID *)sce->nodetree, &ptr);
- RNA_boolean_set(&ptr, "is_local_tree", TRUE);
-
sce->nodetree->chunksize = 256;
sce->nodetree->edit_quality = NTREE_QUALITY_HIGH;
sce->nodetree->render_quality = NTREE_QUALITY_HIGH;
@@ -470,7 +518,6 @@ void ED_node_texture_default(const bContext *C, Tex *tx)
{
bNode *in, *out;
bNodeSocket *fromsock, *tosock;
- PointerRNA ptr;
/* but lets check it anyway */
if (tx->nodetree) {
@@ -481,9 +528,6 @@ void ED_node_texture_default(const bContext *C, Tex *tx)
tx->nodetree = ntreeAddTree(NULL, "Texture Nodetree", ntreeType_Texture->idname);
- RNA_id_pointer_create((ID *)tx->nodetree, &ptr);
- RNA_boolean_set(&ptr, "is_local_tree", TRUE);
-
out = nodeAddStaticNode(C, tx->nodetree, TEX_NODE_OUTPUT);
out->locx = 300.0f; out->locy = 300.0f;
@@ -530,11 +574,17 @@ void snode_set_context(const bContext *C)
}
if (!(snode->flag & SNODE_PIN) || ntree == NULL) {
- if (treetype->get_from_context)
+ if (treetype->get_from_context) {
+ /* reset and update from context */
+ ntree = NULL;
+ id = NULL;
+ from = NULL;
+
treetype->get_from_context(C, treetype, &ntree, &id, &from);
+ }
}
- if (snode->nodetree != ntree || snode->id != id || snode->from != snode->from) {
+ if (snode->nodetree != ntree || snode->id != id || snode->from != from) {
ED_node_tree_start(snode, ntree, id, from);
}
}
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 10f9718f1b6..30ba4108143 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -552,7 +552,7 @@ typedef enum eNodeGroupSeparateType {
} eNodeGroupSeparateType;
/* Operator Property */
-EnumPropertyItem node_group_separate_types[] = {
+static EnumPropertyItem node_group_separate_types[] = {
{NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"},
{NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"},
{0, NULL, 0, NULL, NULL}
@@ -730,7 +730,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
float min[2], max[2], center[2];
int totselect;
int expose_all = FALSE;
- bNode *input_node = NULL, *output_node = NULL; /* lazy initialized, in case there are no external links */
+ bNode *input_node, *output_node;
/* XXX rough guess, not nice but we don't have access to UI constants here ... */
static const float offsetx = 200;
@@ -797,6 +797,16 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
/* node groups don't use internal cached data */
ntreeFreeCache(ngroup);
+ /* create input node */
+ input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
+ input_node->locx = min[0] - center[0] - offsetx;
+ input_node->locy = -offsety;
+
+ /* create output node */
+ output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
+ output_node->locx = max[0] - center[0] + offsetx;
+ output_node->locy = -offsety;
+
/* relink external sockets */
for (link = ntree->links.first; link; link = linkn) {
int fromselect = node_group_make_use_node(link->fromnode, gnode);
@@ -818,13 +828,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->tonode, link->tosock);
bNodeSocket *input_sock;
- /* lazy init */
- if (!input_node) {
- input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
-
- input_node->locx = min[0] - center[0] - offsetx;
- input_node->locy = -offsety;
- }
/* update the group node and interface node sockets,
* so the new interface socket can be linked.
*/
@@ -843,13 +846,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->fromnode, link->fromsock);
bNodeSocket *output_sock;
- /* lazy init */
- if (!output_node) {
- output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
-
- output_node->locx = max[0] - center[0] + offsetx;
- output_node->locy = -offsety;
- }
/* update the group node and interface node sockets,
* so the new interface socket can be linked.
*/
@@ -892,13 +888,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
iosock = ntreeAddSocketInterfaceFromSocket(ngroup, node, sock);
- /* lazy init */
- if (!input_node) {
- input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
-
- input_node->locx = min[0] - center[0] - offsetx;
- input_node->locy = -offsety;
- }
node_group_input_verify(ngroup, input_node, (ID *)ngroup);
/* create new internal link */
@@ -917,14 +906,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
iosock = ntreeAddSocketInterfaceFromSocket(ngroup, node, sock);
- /* lazy init */
- if (!output_node) {
- output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
-
- output_node->locx = max[0] - center[0] + offsetx;
- output_node->locy = -offsety;
- }
-
node_group_output_verify(ngroup, output_node, (ID *)ngroup);
/* create new internal link */
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index a24da7143f9..2f6090d67ce 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -230,13 +230,14 @@ extern const char *node_context_dir[];
#define BASIS_RAD (0.4f * U.widget_unit)
#define NODE_DYS (U.widget_unit / 2)
#define NODE_DY U.widget_unit
+#define NODE_SOCKDY (0.08f * U.widget_unit)
#define NODE_WIDTH(node) (node->width * UI_DPI_FAC)
#define NODE_MARGIN_X (0.75f * U.widget_unit)
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
#define NODE_LINK_RESOL 12
// XXX button events (butspace)
-enum {
+enum eNodeSpace_ButEvents {
B_NOP = 0,
B_REDR = 1,
B_NODE_USEMAT,
@@ -253,6 +254,6 @@ enum {
B_MATPRV,
B_NODE_LOADIMAGE,
B_NODE_SETIMAGE,
-} eNodeSpace_ButEvents;
+};
#endif /* __NODE_INTERN_H__ */
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 0bc2fba0d0b..527defb1f07 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -606,7 +606,7 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
{
bNode *tnode;
- if (!ntreeIsValid(ntree))
+ if (!ntree)
return;
/* clear for cycle check */
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 2d5207e69db..2075cc055e1 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -479,7 +479,7 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa)
snode_set_context(C);
- if (ntreeIsValid(snode->nodetree)) {
+ if (snode->nodetree) {
if (snode->nodetree->type == NTREE_SHADER) {
if (GS(snode->id->name) == ID_MA) {
Material *ma = (Material *)snode->id;