Browse Source

Ensure node trees are upgraded properly

pull/56/head
Adam Johnson 7 years ago
parent
commit
d8dd3cc8b0
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 17
      korman/idprops.py

17
korman/idprops.py

@ -138,3 +138,20 @@ def poll_visregion_objects(self, value):
def poll_envmap_textures(self, value):
return isinstance(value, bpy.types.EnvironmentMapTexture)
@bpy.app.handlers.persistent
def _upgrade_node_trees(dummy):
"""
Logic node haxxor incoming!
Logic nodes appear to have issues with silently updating themselves. I expect that Blender is
doing something strange in the UI code that causes our metaprogramming tricks to be bypassed.
Therefore, we will loop through all Plasma node trees and forcibly update them on blend load.
"""
for tree in bpy.data.node_groups:
if tree.bl_idname != "PlasmaNodeTree":
continue
for node in tree.nodes:
if isinstance(node, IDPropMixin):
assert node._try_upgrade_idprops()
bpy.app.handlers.load_post.append(_upgrade_node_trees)

Loading…
Cancel
Save