Geometry Nodes: new repeat zone #109164
|
@ -1267,22 +1267,38 @@ void remap_node_pairing(bNodeTree &dst_tree, const Map<const bNode *, bNode *> &
|
|||
* so we have to build a map first to find copied output nodes in the new tree. */
|
||||
Map<int32_t, bNode *> dst_output_node_map;
|
||||
for (const auto &item : node_map.items()) {
|
||||
if (item.key->type == GEO_NODE_SIMULATION_OUTPUT) {
|
||||
if (ELEM(item.key->type, GEO_NODE_SIMULATION_OUTPUT, GEO_NODE_SERIAL_LOOP_OUTPUT)) {
|
||||
dst_output_node_map.add_new(item.key->identifier, item.value);
|
||||
}
|
||||
}
|
||||
|
||||
for (bNode *dst_node : node_map.values()) {
|
||||
if (dst_node->type == GEO_NODE_SIMULATION_INPUT) {
|
||||
NodeGeometrySimulationInput *data = static_cast<NodeGeometrySimulationInput *>(
|
||||
dst_node->storage);
|
||||
if (const bNode *output_node = dst_output_node_map.lookup_default(data->output_node_id,
|
||||
nullptr)) {
|
||||
data->output_node_id = output_node->identifier;
|
||||
switch (dst_node->type) {
|
||||
case GEO_NODE_SIMULATION_INPUT: {
|
||||
NodeGeometrySimulationInput *data = static_cast<NodeGeometrySimulationInput *>(
|
||||
dst_node->storage);
|
||||
if (const bNode *output_node = dst_output_node_map.lookup_default(data->output_node_id,
|
||||
nullptr)) {
|
||||
data->output_node_id = output_node->identifier;
|
||||
}
|
||||
else {
|
||||
data->output_node_id = 0;
|
||||
blender::nodes::update_node_declaration_and_sockets(dst_tree, *dst_node);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
data->output_node_id = 0;
|
||||
blender::nodes::update_node_declaration_and_sockets(dst_tree, *dst_node);
|
||||
case GEO_NODE_SERIAL_LOOP_INPUT: {
|
||||
NodeGeometrySerialLoopInput *data = static_cast<NodeGeometrySerialLoopInput *>(
|
||||
dst_node->storage);
|
||||
if (const bNode *output_node = dst_output_node_map.lookup_default(data->output_node_id,
|
||||
nullptr)) {
|
||||
data->output_node_id = output_node->identifier;
|
||||
}
|
||||
else {
|
||||
data->output_node_id = 0;
|
||||
blender::nodes::update_node_declaration_and_sockets(dst_tree, *dst_node);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,16 +144,32 @@ static void remap_pairing(bNodeTree &dst_tree,
|
|||
const Map<int32_t, int32_t> &identifier_map)
|
||||
{
|
||||
for (bNode *dst_node : nodes) {
|
||||
if (dst_node->type == GEO_NODE_SIMULATION_INPUT) {
|
||||
NodeGeometrySimulationInput *data = static_cast<NodeGeometrySimulationInput *>(
|
||||
dst_node->storage);
|
||||
if (data->output_node_id == 0) {
|
||||
continue;
|
||||
}
|
||||
switch (dst_node->type) {
|
||||
case GEO_NODE_SIMULATION_INPUT: {
|
||||
NodeGeometrySimulationInput *data = static_cast<NodeGeometrySimulationInput *>(
|
||||
dst_node->storage);
|
||||
if (data->output_node_id == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
data->output_node_id = identifier_map.lookup_default(data->output_node_id, 0);
|
||||
if (data->output_node_id == 0) {
|
||||
blender::nodes::update_node_declaration_and_sockets(dst_tree, *dst_node);
|
||||
data->output_node_id = identifier_map.lookup_default(data->output_node_id, 0);
|
||||
if (data->output_node_id == 0) {
|
||||
blender::nodes::update_node_declaration_and_sockets(dst_tree, *dst_node);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case GEO_NODE_SERIAL_LOOP_INPUT: {
|
||||
NodeGeometrySerialLoopInput *data = static_cast<NodeGeometrySerialLoopInput *>(
|
||||
dst_node->storage);
|
||||
if (data->output_node_id == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
data->output_node_id = identifier_map.lookup_default(data->output_node_id, 0);
|
||||
if (data->output_node_id == 0) {
|
||||
blender::nodes::update_node_declaration_and_sockets(dst_tree, *dst_node);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue