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/drawnode.cc')
-rw-r--r--source/blender/editors/space_node/drawnode.cc62
1 files changed, 52 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index 8a63a1f3505..24f5decacdf 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -3619,7 +3619,39 @@ static void std_node_socket_draw(
break;
}
case SOCK_IMAGE: {
- uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
+ const bNodeTree *node_tree = (const bNodeTree *)node_ptr->owner_id;
+ if (node_tree->type == NTREE_GEOMETRY) {
+ if (text[0] == '\0') {
+ uiTemplateID(layout,
+ C,
+ ptr,
+ "default_value",
+ "image.new",
+ "image.open",
+ nullptr,
+ 0,
+ ICON_NONE,
+ nullptr);
+ }
+ else {
+ /* 0.3 split ratio is inconsistent, but use it here because the "New" button is large. */
+ uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
+ uiItemL(row, text, 0);
+ uiTemplateID(row,
+ C,
+ ptr,
+ "default_value",
+ "image.new",
+ "image.open",
+ nullptr,
+ 0,
+ ICON_NONE,
+ nullptr);
+ }
+ }
+ else {
+ uiItemR(layout, ptr, "default_value", DEFAULT_FLAGS, text, 0);
+ }
break;
}
case SOCK_COLLECTION: {
@@ -4297,6 +4329,25 @@ void node_draw_link_bezier(const View2D *v2d,
UI_GetThemeColor4fv(th_col2, colors[2]);
}
+ /* 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;
+ if (is_fromnode_selected || is_tonode_selected) {
+ float color_selected[4];
+ UI_GetThemeColor4fv(TH_EDGE_SELECT, color_selected);
+ const float alpha = color_selected[3];
+
+ /* Interpolate color if highlight color is not fully transparent. */
+ if (alpha != 0.0) {
+ if (is_fromnode_selected) {
+ interp_v3_v3v3(colors[1], colors[1], color_selected, alpha);
+ }
+ if (is_tonode_selected) {
+ interp_v3_v3v3(colors[2], colors[2], color_selected, alpha);
+ }
+ }
+ }
+
if (g_batch_link.enabled && !highlighted) {
/* Add link to batch. */
nodelink_batch_add_link(snode,
@@ -4370,15 +4421,6 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
else if (link->flag & NODE_LINK_MUTED) {
th_col1 = th_col2 = TH_REDALERT;
}
- else {
- /* Regular link, highlight if connected to selected node. */
- if (link->fromnode && link->fromnode->flag & SELECT) {
- th_col1 = TH_EDGE_SELECT;
- }
- if (link->tonode && link->tonode->flag & SELECT) {
- th_col2 = TH_EDGE_SELECT;
- }
- }
}
else {
/* Invalid link. */