Page MenuHome

Fix: Add versioning for geometry nodes attribute input toggle
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Sep 17 2021, 7:11 AM.

Details

Summary

rB8e21d528cab98 neglected to add versioning to add the new
"use_attribute" and "attribute_name_ properties to the modifier input
list. Though they are added if the modifier's interface is updated, that
doesn't happen when the file is loaded, so patch adds them manually.
Another (simpler) solution would be calling MOD_nodes_update_interface,
but I'm not sure if that's okay to do here.

Diff Detail

Repository
rB Blender
Branch
fix-geometry-nodes-attribute-input-toggle (branched from master)
Build Status
Buildable 17175
Build 17175: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Sep 17 2021, 7:11 AM
Hans Goudey (HooglyBoogly) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Sep 17 2021, 1:54 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenloader/intern/versioning_300.c
1334

Feels like this might do the wrong thing for id properties that already have the corresponding _use_attribute property. At least it will probably lead to a memory leak when IDP_AddToGroup does not add the new id property because the name exists already.

I think it would be best to just skip the versioning when there already is a property with the _use_attribute suffix in the modifier.

This revision now requires changes to proceed.Sep 17 2021, 1:54 PM
  • Merge branch 'master' into fix-geometry-nodes-attribute-input-toggle
  • Add a check to make sure the versioning hasn't already run
source/blender/blenloader/intern/versioning_300.c
1347

You shouldn't return out of this function.

Hans Goudey (HooglyBoogly) marked 2 inline comments as done.Sep 21 2021, 1:25 AM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/blenloader/intern/versioning_300.c
1347

Oof, yikes, sorry about that.

Hans Goudey (HooglyBoogly) marked an inline comment as done.
  • Merge branch 'master' into fix-geometry-nodes-attribute-input-toggle
  • Split the versioning to a separate function
  • Add IDP_ARRAY check
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenloader/intern/versioning_300.c
1334

Make sure you don't mix up subversion numbers. 25 has been used above already.
Generally, if the versioning code is idempotent, maybe just don't increase the subversion. That can be done when actually necessary.

This revision is now accepted and ready to land.Sep 21 2021, 6:57 PM
Hans Goudey (HooglyBoogly) marked an inline comment as done.Sep 21 2021, 7:40 PM