Browse Source

More improper linkage protection

pull/10/head
Adam Johnson 9 years ago
parent
commit
da254af886
  1. 6
      korman/nodes/node_conditions.py
  2. 16
      korman/nodes/node_python.py
  3. 3
      korman/nodes/node_responder.py

6
korman/nodes/node_conditions.py

@ -27,6 +27,9 @@ class PlasmaClickableNode(PlasmaNodeVariableInput, bpy.types.Node):
bl_label = "Clickable"
bl_width_default = 160
# These are the Python attributes we can fill in
pl_attrib = {"ptAttribActivator", "ptAttribActivatorList", "ptAttribNamedActivator"}
clickable = StringProperty(name="Clickable",
description="Mesh that is clickable")
bounds = EnumProperty(name="Bounds",
@ -285,6 +288,9 @@ class PlasmaVolumeSensorNode(PlasmaNodeBase, bpy.types.Node):
bl_label = "Region Sensor"
bl_width_default = 190
# These are the Python attributes we can fill in
pl_attrib = {"ptAttribActivator", "ptAttribActivatorList", "ptAttribNamedActivator"}
# Region Mesh
region = StringProperty(name="Region",
description="Object that defines the region mesh")

16
korman/nodes/node_python.py

@ -220,6 +220,20 @@ class PlasmaPythonFileNode(PlasmaNodeBase, bpy.types.Node):
if self.no_update:
return
with self._NoUpdate(self) as _no_recurse:
# First, we really want to make sure our junk matches up. Yes, this does dupe what
# happens in PlasmaAttribNodeBase, but we can link much more than those node types...
toasty_sockets = []
input_nodes = (i for i in self.inputs if i.is_linked and i.links)
for i in input_nodes:
link = i.links[0]
allowed_attribs = getattr(link.from_node, "pl_attrib", set())
if i.attribute_type not in allowed_attribs:
self.id_data.links.remove(link)
# Bad news, old chap... Even though we're doing this before we figure out
# how many socket we need, the changes won't be committed to the socket's links
# until later. damn. We'll have to track it manually
toasty_sockets.append(i)
attribs = self.attribute_map
empty = not self.inputs
for idx in sorted(attribs):
@ -235,7 +249,7 @@ class PlasmaPythonFileNode(PlasmaNodeBase, bpy.types.Node):
if not inputs:
self._make_attrib_socket(attrib, empty)
elif attrib.attribute_type not in _single_user_attribs:
unconnected = [socket for socket in inputs if not socket.is_linked]
unconnected = [socket for socket in inputs if not socket.is_linked or socket in toasty_sockets]
if not unconnected:
self._make_attrib_socket(attrib, empty)
while len(unconnected) > 1:

3
korman/nodes/node_responder.py

@ -26,6 +26,9 @@ class PlasmaResponderNode(PlasmaNodeVariableInput, bpy.types.Node):
bl_label = "Responder"
bl_width_default = 145
# These are the Python attributes we can fill in
pl_attrib = {"ptAttribResponder", "ptAttribResponderList", "ptAttribNamedResponder"}
detect_trigger = BoolProperty(name="Detect Trigger",
description="When notified, trigger the Responder",
default=True)

Loading…
Cancel
Save