Commit: 42f8f98ee12b2733554b58b7773dd163859b281a Author: Hans Goudey Date: Mon Jan 23 15:06:55 2023 -0600 Branches: master https://developer.blender.org/rB42f8f98ee12b2733554b58b7773dd163859b281a
Fix T104088: Geometry nodes modifier boolean lost on undo After object-mode undo (memfile undo), the value wan't lost, but the property would be temporarily converted back to integer type in order to be forward compatible. Now only use the forward compatible writing when writing undo steps. Auto-saves and similar files are currently not forward compatible anyway. =================================================================== M source/blender/modifiers/intern/MOD_nodes.cc =================================================================== diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index e487abc4248..a23156dd3c8 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1873,16 +1873,18 @@ static void blendWrite(BlendWriter *writer, const ID * /*id_owner*/, const Modif BLO_write_struct(writer, NodesModifierData, nmd); if (nmd->settings.properties != nullptr) { - /* Boolean properties are added automatically for boolean node group inputs. Integer properties - * are automatically converted to boolean sockets where applicable as well. However, boolean - * properties will crash old versions of Blender, so convert them to integer properties for - * writing. The actual value is stored in the same variable for both types */ Map<IDProperty *, IDPropertyUIDataBool *> boolean_props; - LISTBASE_FOREACH (IDProperty *, prop, &nmd->settings.properties->data.group) { - if (prop->type == IDP_BOOLEAN) { - boolean_props.add_new(prop, reinterpret_cast<IDPropertyUIDataBool *>(prop->ui_data)); - prop->type = IDP_INT; - prop->ui_data = nullptr; + if (!BLO_write_is_undo(writer)) { + /* Boolean properties are added automatically for boolean node group inputs. Integer + * properties are automatically converted to boolean sockets where applicable as well. + * However, boolean properties will crash old versions of Blender, so convert them to integer + * properties for writing. The actual value is stored in the same variable for both types */ + LISTBASE_FOREACH (IDProperty *, prop, &nmd->settings.properties->data.group) { + if (prop->type == IDP_BOOLEAN) { + boolean_props.add_new(prop, reinterpret_cast<IDPropertyUIDataBool *>(prop->ui_data)); + prop->type = IDP_INT; + prop->ui_data = nullptr; + } } } @@ -1890,12 +1892,14 @@ static void blendWrite(BlendWriter *writer, const ID * /*id_owner*/, const Modif * and don't necessarily need to be written, but we can't just free them. */ IDP_BlendWrite(writer, nmd->settings.properties); - LISTBASE_FOREACH (IDProperty *, prop, &nmd->settings.properties->data.group) { - if (prop->type == IDP_INT) { - if (IDPropertyUIDataBool **ui_data = boolean_props.lookup_ptr(prop)) { - prop->type = IDP_BOOLEAN; - if (ui_data) { - prop->ui_data = reinterpret_cast<IDPropertyUIData *>(*ui_data); + if (!BLO_write_is_undo(writer)) { + LISTBASE_FOREACH (IDProperty *, prop, &nmd->settings.properties->data.group) { + if (prop->type == IDP_INT) { + if (IDPropertyUIDataBool **ui_data = boolean_props.lookup_ptr(prop)) { + prop->type = IDP_BOOLEAN; + if (ui_data) { + prop->ui_data = reinterpret_cast<IDPropertyUIData *>(*ui_data); + } } } } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs