Merge branch 'blender-v3.2-release'

This commit is contained in:
2022-05-24 10:40:52 +02:00
4 changed files with 15 additions and 15 deletions

View File

@@ -371,6 +371,7 @@ static int node_add_group_exec(bContext *C, wmOperator *op)
nodeSetActive(ntree, group_node);
ED_node_tree_propagate_change(C, bmain, nullptr);
DEG_relations_tag_update(bmain);
return OPERATOR_FINISHED;
}

View File

@@ -487,7 +487,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node)
static fn::CustomMF_SI_SI_SI_SO<float3, float3, float, bool> fn{
"Not Equal - Element-wise",
[](float3 a, float3 b, float epsilon) {
return abs(a.x - b.x) > epsilon && abs(a.y - b.y) > epsilon &&
return abs(a.x - b.x) > epsilon || abs(a.y - b.y) > epsilon ||
abs(a.z - b.z) > epsilon;
},
exec_preset_first_two};
@@ -522,7 +522,7 @@ static const fn::MultiFunction *get_multi_function(bNode &node)
static fn::CustomMF_SI_SI_SI_SO<ColorGeometry4f, ColorGeometry4f, float, bool> fn{
"Not Equal",
[](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
return abs(a.r - b.r) > epsilon && abs(a.g - b.g) > epsilon &&
return abs(a.r - b.r) > epsilon || abs(a.g - b.g) > epsilon ||
abs(a.b - b.b) > epsilon;
},
exec_preset_first_two};

View File

@@ -15,19 +15,17 @@ static void fn_node_replace_string_declare(NodeDeclarationBuilder &b)
b.add_output<decl::String>(N_("String"));
}
static std::string replace_all(std::string str, const std::string &from, const std::string &to)
static std::string replace_all(const StringRefNull str,
const StringRefNull from,
const StringRefNull to)
{
if (from.length() <= 0) {
if (from.is_empty()) {
return str;
}
const size_t step = to.length() > 0 ? to.length() : 1;
size_t offset = 0;
while ((offset = str.find(from, offset)) != std::string::npos) {
str.replace(offset, from.length(), to);
offset += step;
}
return str;
char *new_str_ptr = BLI_str_replaceN(str.c_str(), from.c_str(), to.c_str());
std::string new_str{new_str_ptr};
MEM_freeN(new_str_ptr);
return new_str;
}
static void fn_node_replace_string_build_multi_function(NodeMultiFunctionBuilder &builder)

View File

@@ -587,10 +587,11 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree,
}
}
}
/* Recreate links between copied nodes. */
/* Recreate links between copied nodes AND incomming links to the copied nodes. */
LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) {
if (link->fromnode->tmp_flag >= 0 && link->tonode->tmp_flag >= 0) {
bNode *fromnode = nodes_copy[link->fromnode->tmp_flag];
if (link->tonode->tmp_flag >= 0) {
bool from_node_copied = link->fromnode->tmp_flag >= 0;
bNode *fromnode = from_node_copied ? nodes_copy[link->fromnode->tmp_flag] : link->fromnode;
bNode *tonode = nodes_copy[link->tonode->tmp_flag];
bNodeSocket *fromsock = ntree_shader_node_find_output(fromnode, link->fromsock->identifier);
bNodeSocket *tosock = ntree_shader_node_find_input(tonode, link->tosock->identifier);