Fix #115207: Dynamically typed Viewer node #115130
|
@ -50,6 +50,7 @@
|
||||||
#include "BLT_translation.h"
|
#include "BLT_translation.h"
|
||||||
|
|
||||||
#include "NOD_node_declaration.hh"
|
#include "NOD_node_declaration.hh"
|
||||||
|
#include "NOD_socket.hh"
|
||||||
#include "NOD_socket_declarations.hh"
|
#include "NOD_socket_declarations.hh"
|
||||||
#include "NOD_socket_declarations_geometry.hh"
|
#include "NOD_socket_declarations_geometry.hh"
|
||||||
|
|
||||||
|
@ -447,21 +448,24 @@ static bNodeSocket *node_link_viewer_get_socket(bNodeTree &ntree,
|
||||||
return (bNodeSocket *)viewer_node.inputs.first;
|
return (bNodeSocket *)viewer_node.inputs.first;
|
||||||
}
|
}
|
||||||
/* For the geometry nodes viewer, find the socket with the correct type. */
|
/* For the geometry nodes viewer, find the socket with the correct type. */
|
||||||
LISTBASE_FOREACH (bNodeSocket *, viewer_socket, &viewer_node.inputs) {
|
|
||||||
if (viewer_socket->type == src_socket.type) {
|
if (src_socket.type == SOCK_GEOMETRY) {
|
||||||
if (viewer_socket->type == SOCK_GEOMETRY) {
|
return static_cast<bNodeSocket *>(viewer_node.inputs.first);
|
||||||
return viewer_socket;
|
|
||||||
}
|
|
||||||
NodeGeometryViewer *storage = (NodeGeometryViewer *)viewer_node.storage;
|
|
||||||
const eCustomDataType data_type = *bke::socket_type_to_custom_data_type(
|
|
||||||
eNodeSocketDatatype(src_socket.type));
|
|
||||||
BLI_assert(data_type != CD_AUTO_FROM_NAME);
|
|
||||||
storage->data_type = data_type;
|
|
||||||
viewer_node.typeinfo->updatefunc(&ntree, &viewer_node);
|
|
||||||
return viewer_socket;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
|
||||||
|
ntree.ensure_topology_cache();
|
||||||
|
if (!socket_can_be_viewed(src_socket.owner_node(), src_socket)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeGeometryViewer &storage = *static_cast<NodeGeometryViewer *>(viewer_node.storage);
|
||||||
|
const eCustomDataType data_type = *bke::socket_type_to_custom_data_type(
|
||||||
|
eNodeSocketDatatype(src_socket.type));
|
||||||
|
BLI_assert(data_type != CD_AUTO_FROM_NAME);
|
||||||
|
storage.data_type = data_type;
|
||||||
|
nodes::update_node_declaration_and_sockets(ntree, viewer_node);
|
||||||
|
|
||||||
|
return static_cast<bNodeSocket *>(viewer_node.inputs.last);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_viewer_node(const bNode &node)
|
static bool is_viewer_node(const bNode &node)
|
||||||
|
|
Loading…
Reference in New Issue