diff options
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc | 17 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.cc | 22 | ||||
-rw-r--r-- | source/blender/editors/space_node/space_node.cc | 2 |
3 files changed, 14 insertions, 27 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index df31a0342cb..c66b8ad4ff0 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1581,10 +1581,12 @@ void draw_nodespace_back_pix(const bContext &C, GPU_matrix_pop(); } -static float2 socket_link_connection_location(const bNodeSocket &socket, const bNodeLink &link) +static float2 socket_link_connection_location(const bNode &node, + const bNodeSocket &socket, + const bNodeLink &link) { const float2 socket_location(socket.locx, socket.locy); - if (socket.is_multi_input() && socket.is_input() && !(socket.owner_node().flag & NODE_HIDDEN)) { + if (socket.is_multi_input() && socket.is_input() && !(node.flag & NODE_HIDDEN)) { return node_link_calculate_multi_input_position( socket_location, link.multi_input_socket_index, socket.total_inputs); } @@ -1620,8 +1622,8 @@ static void calculate_inner_link_bezier_points(std::array<float2, 4> &points) static std::array<float2, 4> node_link_bezier_points(const bNodeLink &link) { std::array<float2, 4> points; - points[0] = socket_link_connection_location(*link.fromsock, link); - points[3] = socket_link_connection_location(*link.tosock, link); + points[0] = socket_link_connection_location(*link.fromnode, *link.fromsock, link); + points[3] = socket_link_connection_location(*link.tonode, *link.tosock, link); calculate_inner_link_bezier_points(points); return points; } @@ -2212,8 +2214,11 @@ static std::array<float2, 4> node_link_bezier_points_dragged(const SpaceNode &sn { const float2 cursor = snode.runtime->cursor * UI_DPI_FAC; std::array<float2, 4> points; - points[0] = link.fromsock ? socket_link_connection_location(*link.fromsock, link) : cursor; - points[3] = link.tosock ? socket_link_connection_location(*link.tosock, link) : cursor; + points[0] = link.fromsock ? + socket_link_connection_location(*link.fromnode, *link.fromsock, link) : + cursor; + points[3] = link.tosock ? socket_link_connection_location(*link.tonode, *link.tosock, link) : + cursor; calculate_inner_link_bezier_points(points); return points; } diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index e6eba45d45e..7982b47f363 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -502,6 +502,7 @@ void ED_node_shader_default(const bContext *C, ID *id) } ma->nodetree = ntreeCopyTree(bmain, ma_default->nodetree); + ma->nodetree->owner_id = &ma->id; BKE_ntree_update_main_tree(bmain, ma->nodetree, nullptr); } else if (ELEM(GS(id->name), ID_WO, ID_LA)) { @@ -736,26 +737,7 @@ void ED_node_set_active( * - current image is not a Render Result or ViewerNode (want to keep looking at these) */ if (node->id != nullptr && GS(node->id->name) == ID_IM) { Image *image = (Image *)node->id; - wmWindowManager *wm = (wmWindowManager *)bmain->wm.first; - LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { - const bScreen *screen = WM_window_get_active_screen(win); - LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { - LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { - if (sl->spacetype != SPACE_IMAGE) { - continue; - } - SpaceImage *sima = (SpaceImage *)sl; - if (sima->pin) { - continue; - } - if (sima->image && - ELEM(sima->image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) { - continue; - } - ED_space_image_set(bmain, sima, image, true); - } - } - } + ED_space_image_sync(bmain, image, true); } if (r_active_texture_changed) { diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index 5754e77399f..ce0273eec81 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -181,7 +181,7 @@ void ED_node_tree_path_get(SpaceNode *snode, char *value) value += strlen(path->display_name); } else { - sprintf(value, "/%s", path->display_name); + BLI_sprintf(value, "/%s", path->display_name); value += strlen(path->display_name) + 1; } } |