I’m trying to access and change Metadata Attributes from the Set Metadata Attributes node in Movie Render Graph using Python scripting.
I can access the array of Metadata Attributes and append to it but I don’t know how I can modify already existing attributes.
Here is how I’m trying to do it :
# Get Metadata Attribute Collection
metadata_attributes_node.set_editor_property("override_metadata_attribute_collection", True)
metadata_collection = metadata_attributes_node.get_editor_property("metadata_attribute_collection")
#Get Metadata Attribute Array From Collection
metadata_attributes = metadata_collection.get_editor_property("metadata_attributes")
# Check Actual Attributes
unreal.log("Attributes before change :")
for attribute in metadata_attributes:
unreal.log(attribute.get_editor_property("name"))
unreal.log(attribute.get_editor_property("value"))
metadata_attributes.append(unreal.MovieGraphMetadataAttribute("New Attribute", "2", True))
metadata_attributes[0].set_editor_property("name", "New Name")
metadata_attributes[0].set_editor_property("value", "New Value")
# Check Attributes After Change
unreal.log("Attributes after change :")
for attribute in metadata_attributes:
unreal.log(attribute.get_editor_property("name"))
unreal.log(attribute.get_editor_property("value"))
And what I get as a result :
LogPython: Attributes before change :
LogPython: First Attribute
LogPython: First Value
LogPython: Attributes after change :
LogPython: First Attribute
LogPython: First Value
LogPython: New Attribute
LogPython: 2
I’m new to Python and Unreal scripting so I thought it might be a basic error like accessing a copy instead of the object reference but I don’t know how to check.