Fix #143323: Material with "frame_current" attribute is not updated on frame change

Add a time dependency for "frame_current" attributes.

(4.5 backport candidate)

Pull Request: https://projects.blender.org/blender/blender/pulls/143572
This commit is contained in:
Miguel Pozo
2025-07-31 16:27:03 +02:00
parent 51b2c31c01
commit 4e99678bc5
2 changed files with 10 additions and 2 deletions

View File

@@ -3029,6 +3029,14 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
build_nodetree_socket(socket);
}
if (ntree->type == NTREE_SHADER && bnode->is_type("ShaderNodeAttribute")) {
NodeShaderAttribute *attr = static_cast<NodeShaderAttribute *>(bnode->storage);
if (attr->type == SHD_ATTRIBUTE_VIEW_LAYER && STREQ(attr->name, "frame_current")) {
TimeSourceKey time_src_key;
add_relation(time_src_key, ntree_output_key, "TimeSrc -> Node");
}
}
ID *id = bnode->id;
if (id == nullptr) {
continue;

View File

@@ -5050,12 +5050,12 @@ static void def_sh_attribute(BlenderRNA * /*brna*/, StructRNA *srna)
RNA_def_property_enum_sdna(prop, nullptr, "type");
RNA_def_property_enum_items(prop, prop_attribute_type);
RNA_def_property_ui_text(prop, "Attribute Type", "General type of the attribute");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, nullptr, "name");
RNA_def_property_ui_text(prop, "Attribute Name", "");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update_relations");
}
static void def_sh_tex(BlenderRNA * /*brna*/, StructRNA *srna)