Shader Nodes: Default to 0 iterations for invalid Repeat Zones

Previously, Repeat Zones with non-static iterations would be fully
disconnected.
With this patch, they behave as if they have 0 iterations.

Co-authored-by: Jacques Lucke

Pull Request: https://projects.blender.org/blender/blender/pulls/147211
This commit is contained in:
Miguel Pozo
2025-10-03 11:49:39 +02:00
parent c5db31272e
commit ce29226a6c
5 changed files with 11 additions and 12 deletions

View File

@@ -617,12 +617,11 @@ class ShaderNodesInliner {
const std::optional<PrimitiveSocketValue> iterations_value_opt =
iterations_socket_value->to_primitive(*iterations_input->typeinfo);
if (!iterations_value_opt) {
/* Number of iterations is not a primitive value. */
this->store_socket_value_fallback(socket);
this->add_dynamic_repeat_zone_iterations_error(*repeat_input_node);
return;
}
const int iterations = std::get<int>(iterations_value_opt->value);
const int iterations = iterations_value_opt.has_value() ?
std::get<int>(iterations_value_opt->value) :
0;
if (iterations <= 0) {
/* If the number of iterations is zero, the values are copied directly from the repeat input
* node. */

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.