Skip to content

Commit

Permalink
add check for version
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Nov 4, 2024
1 parent acc11a8 commit 1967b73
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions molecularnodes/bpyd/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,19 @@ def store_named_attribute(
# so we have to flatten it first
attribute.data.foreach_set(atype.value.value_name, data.reshape(-1))

# The updating of data doesn't work 100% of the time (see:
# https://projects.blender.org/blender/blender/issues/118507) so this resetting of a
# single vertex is the current fix. Not great as I can see it breaking when we are
# missing a vertex - but for now we shouldn't be dealing with any situations where this
# is the case For now we will set a single vert to it's own position, which triggers a
# proper refresh of the object data.
try:
obj.data.vertices[0].co = obj.data.vertices[0].co # type: ignore
except AttributeError:
obj.data.update() # type: ignore
# attribute bug is fixed in 4.3+
if bpy.app.version_string.startswith("4.2"):
# TODO remove in later updates
# The updating of data doesn't work 100% of the time (see:
# https://projects.blender.org/blender/blender/issues/118507) so this resetting of a
# single vertex is the current fix. Not great as I can see it breaking when we are
# missing a vertex - but for now we shouldn't be dealing with any situations where this
# is the case For now we will set a single vert to it's own position, which triggers a
# proper refresh of the object data.
try:
obj.data.vertices[0].co = obj.data.vertices[0].co # type: ignore
except AttributeError:
obj.data.update() # type: ignore

return attribute

Expand Down

0 comments on commit 1967b73

Please sign in to comment.