Fix #103785: Geometry Nodes attribute inputs aren't overridable
The "use attribute" and "attribute name" IDProperties were missing the overrideable status and the static type status. This was an oversight from when those tags were added. This commit fixes the flag on new modifier properties as they're created and applies versioning to old properties. It also fixes the poll of the toggle input attribute operator so that it isn't possible on non-editable objects. Pull Request: https://projects.blender.org/blender/blender/pulls/131768
This commit is contained in:
@@ -31,7 +31,7 @@ extern "C" {
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 12
|
||||
#define BLENDER_FILE_SUBVERSION 13
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
||||
@@ -5242,6 +5242,29 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 404, 13)) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, modifier, &object->modifiers) {
|
||||
if (modifier->type != eModifierType_Nodes) {
|
||||
continue;
|
||||
}
|
||||
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(modifier);
|
||||
if (!nmd->settings.properties) {
|
||||
continue;
|
||||
}
|
||||
LISTBASE_FOREACH (IDProperty *, idprop, &nmd->settings.properties->data.group) {
|
||||
if (idprop->type != IDP_STRING) {
|
||||
continue;
|
||||
}
|
||||
blender::StringRef prop_name(idprop->name);
|
||||
if (prop_name.endswith("_attribute_name") || prop_name.endswith("_use_attribute")) {
|
||||
idprop->flag |= IDP_FLAG_OVERRIDABLE_LIBRARY | IDP_FLAG_STATIC_TYPE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Always run this versioning; meshes are written with the legacy format which always needs to
|
||||
* be converted to the new format on file load. Can be moved to a subversion check in a larger
|
||||
* breaking release. */
|
||||
|
||||
@@ -3770,7 +3770,7 @@ void OBJECT_OT_geometry_nodes_input_attribute_toggle(wmOperatorType *ot)
|
||||
ot->idname = "OBJECT_OT_geometry_nodes_input_attribute_toggle";
|
||||
|
||||
ot->exec = geometry_nodes_input_attribute_toggle_exec;
|
||||
ot->poll = ED_operator_object_active;
|
||||
ot->poll = ED_operator_object_active_editable;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
|
||||
|
||||
|
||||
@@ -964,9 +964,11 @@ void update_input_properties_from_node_tree(const bNodeTree &tree,
|
||||
const std::string attribute_name_id = socket_identifier + input_attribute_name_suffix;
|
||||
|
||||
IDProperty *use_attribute_prop = bke::idprop::create_bool(use_attribute_id, false).release();
|
||||
use_attribute_prop->flag |= IDP_FLAG_OVERRIDABLE_LIBRARY | IDP_FLAG_STATIC_TYPE;
|
||||
IDP_AddToGroup(&properties, use_attribute_prop);
|
||||
|
||||
IDProperty *attribute_prop = bke::idprop::create(attribute_name_id, "").release();
|
||||
attribute_prop->flag |= IDP_FLAG_OVERRIDABLE_LIBRARY | IDP_FLAG_STATIC_TYPE;
|
||||
IDP_AddToGroup(&properties, attribute_prop);
|
||||
|
||||
if (old_properties == nullptr) {
|
||||
|
||||
Reference in New Issue
Block a user