Browse Source

Use OrderedDict for socket defs

This way things won't appear in random order based on hash values :)
pull/10/head
Adam Johnson 9 years ago
parent
commit
26b5edd3c2
  1. 17
      korman/nodes/node_avatar.py
  2. 77
      korman/nodes/node_conditions.py
  3. 9
      korman/nodes/node_messages.py
  4. 61
      korman/nodes/node_responder.py

17
korman/nodes/node_avatar.py

@ -15,6 +15,7 @@
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict
from PyHSPlasma import * from PyHSPlasma import *
from .node_core import PlasmaNodeBase, PlasmaNodeSocketBase from .node_core import PlasmaNodeBase, PlasmaNodeSocketBase
@ -32,19 +33,19 @@ class PlasmaSittingBehaviorNode(PlasmaNodeBase, bpy.types.Node):
default={"kApproachFront", "kApproachLeft", "kApproachRight"}, default={"kApproachFront", "kApproachLeft", "kApproachRight"},
options={"ENUM_FLAG"}) options={"ENUM_FLAG"})
input_sockets = { input_sockets = OrderedDict([
"condition": { ("condition", {
"text": "Condition", "text": "Condition",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
}, }),
} ])
output_sockets = { output_sockets = OrderedDict([
"satisfies": { ("satisfies", {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
col = layout.column() col = layout.column()

77
korman/nodes/node_conditions.py

@ -15,6 +15,7 @@
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict
import math import math
from PyHSPlasma import * from PyHSPlasma import *
@ -37,32 +38,32 @@ class PlasmaClickableNode(PlasmaNodeBase, bpy.types.Node):
items=bounds_types, items=bounds_types,
default="hull") default="hull")
input_sockets = { input_sockets = OrderedDict([
"region": { ("region", {
"text": "Avatar Inside Region", "text": "Avatar Inside Region",
"type": "PlasmaClickableRegionSocket", "type": "PlasmaClickableRegionSocket",
}, }),
"facing": { ("facing", {
"text": "Avatar Facing Target", "text": "Avatar Facing Target",
"type": "PlasmaFacingTargetSocket", "type": "PlasmaFacingTargetSocket",
}, }),
"enable_callback": { ("enable_callback", {
"text": "Local Reenable", "text": "Local Reenable",
"type": "PlasmaRespCommandSocket", "type": "PlasmaRespCommandSocket",
"spawn_empty": True, "spawn_empty": True,
} }),
} ])
output_sockets = { output_sockets = OrderedDict([
"keyref": { ("keyref", {
"text": "References", "text": "References",
"type": "PlasmaPythonReferenceNodeSocket", "type": "PlasmaPythonReferenceNodeSocket",
}, }),
"satisfies": { ("satisfies", {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop_search(self, "clickable", bpy.data, "objects", icon="MESH_DATA") layout.prop_search(self, "clickable", bpy.data, "objects", icon="MESH_DATA")
@ -155,12 +156,12 @@ class PlasmaClickableRegionNode(PlasmaNodeBase, bpy.types.Node):
items=bounds_types, items=bounds_types,
default="hull") default="hull")
output_sockets = { output_sockets = OrderedDict([
"satisfies": { ("satisfies", {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaClickableRegionSocket", "type": "PlasmaClickableRegionSocket",
} }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop_search(self, "region", bpy.data, "objects", icon="MESH_DATA") layout.prop_search(self, "region", bpy.data, "objects", icon="MESH_DATA")
@ -221,12 +222,12 @@ class PlasmaFacingTargetNode(PlasmaNodeBase, bpy.types.Node):
description="How far away from the target the avatar can turn (in degrees)", description="How far away from the target the avatar can turn (in degrees)",
min=-180, max=180, default=45) min=-180, max=180, default=45)
output_sockets = { output_sockets = OrderedDict([
"satisfies": { ("satisfies", {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaFacingTargetSocket", "type": "PlasmaFacingTargetSocket",
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "directional") layout.prop(self, "directional")
@ -296,13 +297,13 @@ class PlasmaVolumeReportNode(PlasmaNodeBase, bpy.types.Node):
description="How many objects should be in the region for it to trigger", description="How many objects should be in the region for it to trigger",
min=1) min=1)
output_sockets = { output_sockets = OrderedDict([
"settings": { ("settings", {
"text": "Trigger Settings", "text": "Trigger Settings",
"type": "PlasmaVolumeSettingsSocketOut", "type": "PlasmaVolumeSettingsSocketOut",
"valid_link_sockets": {"PlasmaVolumeSettingsSocketIn"}, "valid_link_sockets": {"PlasmaVolumeSettingsSocketIn"},
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "report_when") layout.prop(self, "report_when")
@ -336,30 +337,30 @@ class PlasmaVolumeSensorNode(PlasmaNodeBase, bpy.types.Node):
("dynamics", "Dynamics", "Any non-avatar dynamic physical object (eg kickables)")], ("dynamics", "Dynamics", "Any non-avatar dynamic physical object (eg kickables)")],
default={"avatar"}) default={"avatar"})
input_sockets = { input_sockets = OrderedDict([
"enter": { ("enter", {
"text": "Trigger on Enter", "text": "Trigger on Enter",
"type": "PlasmaVolumeSettingsSocketIn", "type": "PlasmaVolumeSettingsSocketIn",
"valid_link_sockets": {"PlasmaVolumeSettingsSocketOut"}, "valid_link_sockets": {"PlasmaVolumeSettingsSocketOut"},
}, }),
"exit": { ("exit", {
"text": "Trigger on Exit", "text": "Trigger on Exit",
"type": "PlasmaVolumeSettingsSocketIn", "type": "PlasmaVolumeSettingsSocketIn",
"valid_link_sockets": {"PlasmaVolumeSettingsSocketOut"}, "valid_link_sockets": {"PlasmaVolumeSettingsSocketOut"},
}, }),
} ])
output_sockets = { output_sockets = OrderedDict([
"keyref": { ("keyref", {
"text": "References", "text": "References",
"type": "PlasmaPythonReferenceNodeSocket", "type": "PlasmaPythonReferenceNodeSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"}, "valid_link_nodes": {"PlasmaPythonFileNode"},
}, }),
"satisfies": { ("satisfies", {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "report_on") layout.prop(self, "report_on")

9
korman/nodes/node_messages.py

@ -15,6 +15,7 @@
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict
from PyHSPlasma import * from PyHSPlasma import *
from .node_core import * from .node_core import *
@ -28,13 +29,13 @@ class PlasmaMessageSocket(PlasmaMessageSocketBase, bpy.types.NodeSocket):
class PlasmaMessageNode(PlasmaNodeBase): class PlasmaMessageNode(PlasmaNodeBase):
input_sockets = { input_sockets = OrderedDict([
"sender": { ("sender", {
"text": "Sender", "text": "Sender",
"type": "PlasmaMessageSocket", "type": "PlasmaMessageSocket",
"spawn_empty": True, "spawn_empty": True,
}, }),
} ])
@property @property
def has_callbacks(self): def has_callbacks(self):

61
korman/nodes/node_responder.py

@ -15,6 +15,7 @@
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict
from PyHSPlasma import * from PyHSPlasma import *
import uuid import uuid
@ -39,25 +40,25 @@ class PlasmaResponderNode(PlasmaNodeBase, bpy.types.Node):
description="When fast-forwarding, play sound effects", description="When fast-forwarding, play sound effects",
default=False) default=False)
input_sockets = { input_sockets = OrderedDict([
"condition": { ("condition", {
"text": "Condition", "text": "Condition",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"spawn_empty": True, "spawn_empty": True,
}, }),
} ])
output_sockets = { output_sockets = OrderedDict([
"keyref": { ("keyref", {
"text": "References", "text": "References",
"type": "PlasmaPythonReferenceNodeSocket", "type": "PlasmaPythonReferenceNodeSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"}, "valid_link_nodes": {"PlasmaPythonFileNode"},
}, }),
"states": { ("states", {
"text": "States", "text": "States",
"type": "PlasmaRespStateSocket", "type": "PlasmaRespStateSocket",
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "detect_trigger") layout.prop(self, "detect_trigger")
@ -115,25 +116,25 @@ class PlasmaResponderStateNode(PlasmaNodeBase, bpy.types.Node):
description="This state is the responder's default", description="This state is the responder's default",
default=False) default=False)
input_sockets = { input_sockets = OrderedDict([
"condition": { ("condition", {
"text": "Condition", "text": "Condition",
"type": "PlasmaRespStateSocket", "type": "PlasmaRespStateSocket",
"spawn_empty": True, "spawn_empty": True,
}, }),
} ])
output_sockets = { output_sockets = OrderedDict([
"cmds": { ("cmds", {
"text": "Commands", "text": "Commands",
"type": "PlasmaRespCommandSocket", "type": "PlasmaRespCommandSocket",
}, }),
"gotostate": { ("gotostate", {
"link_limit": 1, "link_limit": 1,
"text": "Trigger", "text": "Trigger",
"type": "PlasmaRespStateSocket", "type": "PlasmaRespStateSocket",
}, }),
} ])
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "default_state") layout.prop(self, "default_state")
@ -205,27 +206,27 @@ class PlasmaResponderCommandNode(PlasmaNodeBase, bpy.types.Node):
bl_idname = "PlasmaResponderCommandNode" bl_idname = "PlasmaResponderCommandNode"
bl_label = "Responder Command" bl_label = "Responder Command"
input_sockets = { input_sockets = OrderedDict([
"whodoneit": { ("whodoneit", {
"text": "Condition", "text": "Condition",
"type": "PlasmaRespCommandSocket", "type": "PlasmaRespCommandSocket",
# command sockets are on some unrelated outputs... # command sockets are on some unrelated outputs...
"valid_link_nodes": {"PlasmaResponderCommandNode", "PlasmaResponderStateNode"}, "valid_link_nodes": {"PlasmaResponderCommandNode", "PlasmaResponderStateNode"},
"valid_link_sockets": {"PlasmaRespCommandSocket"}, "valid_link_sockets": {"PlasmaRespCommandSocket"},
}, }),
} ])
output_sockets = { output_sockets = OrderedDict([
"msg": { ("msg", {
"link_limit": 1, "link_limit": 1,
"text": "Message", "text": "Message",
"type": "PlasmaMessageSocket", "type": "PlasmaMessageSocket",
}, }),
"trigger": { ("trigger", {
"text": "Trigger", "text": "Trigger",
"type": "PlasmaRespCommandSocket", "type": "PlasmaRespCommandSocket",
}, }),
} ])
def convert_command(self, exporter, so, responder, commandMgr, waitOn=-1): def convert_command(self, exporter, so, responder, commandMgr, waitOn=-1):
# If this command has no message, there is no need to export it... # If this command has no message, there is no need to export it...

Loading…
Cancel
Save