Browse Source

Fix issue causing PFMs to crash in PotS

Recall that PFMs are added as modules to the global modules dict.
Therefore, module names must be valid Python 2.x identifiers. This is
handled well for age names, but we've been neglecting to handle it for
PFM names. So, when Blender adds ".001" as a suffix to a duplicated
object, any attached PFMs will go down in a firey dust explosion.
Generally, with the unhelpful error message: "NULL result without
error in PyObject_Call".
pull/152/head
Adam Johnson 5 years ago
parent
commit
12c2f8a33d
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 7
      korman/nodes/node_python.py

7
korman/nodes/node_python.py

@ -19,6 +19,7 @@ from contextlib import contextmanager
from pathlib import Path
from PyHSPlasma import *
from ..korlib import replace_python2_identifier
from .node_core import *
from .node_deprecated import PlasmaVersionedNode
from .. import idprops
@ -305,6 +306,12 @@ class PlasmaPythonFileNode(PlasmaVersionedNode, bpy.types.Node):
if i.attribute_id == idx:
yield i
@property
def key_name(self):
# PFM names ***must*** be valid Python identifiers, but Blender likes inserting
# periods into the object names "Foo.001" -- this causes bad internal chaos in PotS
return replace_python2_identifier("{}_{}".format(self.id_data.name, self.name))
def _make_attrib_socket(self, attrib, is_init=False):
new_pos = len(self.inputs)
if not is_init:

Loading…
Cancel
Save