Browse Source

Use "requires_actor" in logic nodes as well

pull/9/head
Adam Johnson 10 years ago
parent
commit
1fe28cbd96
  1. 13
      korman/nodes/node_conditions.py
  2. 11
      korman/nodes/node_core.py
  3. 4
      korman/properties/modifiers/avatar.py
  4. 5
      korman/properties/modifiers/logic.py

13
korman/nodes/node_conditions.py

@ -97,6 +97,11 @@ class PlasmaClickableNode(PlasmaNodeBase, bpy.types.Node):
face_target = self.find_input_socket("facing") face_target = self.find_input_socket("facing")
face_target.convert_subcondition(exporter, tree, clickable_bo, clickable_so, logicmod) face_target.convert_subcondition(exporter, tree, clickable_bo, clickable_so, logicmod)
@property
def requires_actor(self):
face_target = self.find_input_socket("facing")
return face_target.enable_condition
class PlasmaClickableRegionNode(PlasmaNodeBase, bpy.types.Node): class PlasmaClickableRegionNode(PlasmaNodeBase, bpy.types.Node):
bl_category = "CONDITIONS" bl_category = "CONDITIONS"
@ -178,6 +183,10 @@ class PlasmaFacingTargetNode(PlasmaNodeBase, bpy.types.Node):
layout.prop(self, "directional") layout.prop(self, "directional")
layout.prop(self, "tolerance") layout.prop(self, "tolerance")
@property
def requires_actor(self):
return True
class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket):
bl_color = (0.0, 0.267, 0.247, 1.0) bl_color = (0.0, 0.267, 0.247, 1.0)
@ -210,10 +219,6 @@ class PlasmaFacingTargetSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket):
# This is a programmer failure, so we need a traceback. # This is a programmer failure, so we need a traceback.
raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket") raise RuntimeError("Tried to export an unused PlasmaFacingTargetSocket")
# Plasma internally depends on a CoordinateInterface. Since we're a node, we don't actually
# flag that in the exporter. Ensure it is generated now.
exporter.export_coordinate_interface(so, bo)
facing_key = exporter.mgr.find_create_key(plFacingConditionalObject, name=name, so=so) facing_key = exporter.mgr.find_create_key(plFacingConditionalObject, name=name, so=so)
facing = facing_key.object facing = facing_key.object
facing.directional = directional facing.directional = directional

11
korman/nodes/node_core.py

@ -111,6 +111,10 @@ class PlasmaNodeBase:
def poll(cls, context): def poll(cls, context):
return (context.bl_idname == "PlasmaNodeTree") return (context.bl_idname == "PlasmaNodeTree")
@property
def requires_actor(self):
return False
class PlasmaNodeVariableInput(PlasmaNodeBase): class PlasmaNodeVariableInput(PlasmaNodeBase):
def ensure_sockets(self, idname, name, identifier=None): def ensure_sockets(self, idname, name, identifier=None):
@ -149,3 +153,10 @@ class PlasmaNodeTree(bpy.types.NodeTree):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
return (context.scene.render.engine == "PLASMA_GAME") return (context.scene.render.engine == "PLASMA_GAME")
@property
def requires_actor(self):
for node in self.nodes:
if node.requires_actor:
return True
return False

4
korman/properties/modifiers/avatar.py

@ -102,3 +102,7 @@ class PlasmaSittingBehavior(PlasmaModifierProperties, PlasmaModifierLogicWiz):
# this socket must be explicitly disabled, otherwise it automatically generates a default # this socket must be explicitly disabled, otherwise it automatically generates a default
# facing target conditional for us. isn't that nice? # facing target conditional for us. isn't that nice?
clickable.find_input_socket("facing").allow_simple = False clickable.find_input_socket("facing").allow_simple = False
@property
def requires_actor(self):
return self.facing_enabled

5
korman/properties/modifiers/logic.py

@ -36,6 +36,11 @@ class PlasmaAdvancedLogic(PlasmaModifierProperties):
tree = bpy.data.node_groups[self.tree_name] tree = bpy.data.node_groups[self.tree_name]
tree.export(exporter, bo, so) tree.export(exporter, bo, so)
@property
def requires_actor(self):
tree = bpy.data.node_groups[self.tree_name]
return tree.requires_actor
class PlasmaSpawnPoint(PlasmaModifierProperties): class PlasmaSpawnPoint(PlasmaModifierProperties):
pl_id = "spawnpoint" pl_id = "spawnpoint"

Loading…
Cancel
Save