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

77
korman/nodes/node_conditions.py

@ -15,6 +15,7 @@
import bpy
from bpy.props import *
from collections import OrderedDict
import math
from PyHSPlasma import *
@ -37,32 +38,32 @@ class PlasmaClickableNode(PlasmaNodeBase, bpy.types.Node):
items=bounds_types,
default="hull")
input_sockets = {
"region": {
input_sockets = OrderedDict([
("region", {
"text": "Avatar Inside Region",
"type": "PlasmaClickableRegionSocket",
},
"facing": {
}),
("facing", {
"text": "Avatar Facing Target",
"type": "PlasmaFacingTargetSocket",
},
"enable_callback": {
}),
("enable_callback", {
"text": "Local Reenable",
"type": "PlasmaRespCommandSocket",
"spawn_empty": True,
}
}
}),
])
output_sockets = {
"keyref": {
output_sockets = OrderedDict([
("keyref", {
"text": "References",
"type": "PlasmaPythonReferenceNodeSocket",
},
"satisfies": {
}),
("satisfies", {
"text": "Satisfies",
"type": "PlasmaConditionSocket",
},
}
}),
])
def draw_buttons(self, context, layout):
layout.prop_search(self, "clickable", bpy.data, "objects", icon="MESH_DATA")
@ -155,12 +156,12 @@ class PlasmaClickableRegionNode(PlasmaNodeBase, bpy.types.Node):
items=bounds_types,
default="hull")
output_sockets = {
"satisfies": {
output_sockets = OrderedDict([
("satisfies", {
"text": "Satisfies",
"type": "PlasmaClickableRegionSocket",
}
}
}),
])
def draw_buttons(self, context, layout):
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)",
min=-180, max=180, default=45)
output_sockets = {
"satisfies": {
output_sockets = OrderedDict([
("satisfies", {
"text": "Satisfies",
"type": "PlasmaFacingTargetSocket",
},
}
}),
])
def draw_buttons(self, context, layout):
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",
min=1)
output_sockets = {
"settings": {
output_sockets = OrderedDict([
("settings", {
"text": "Trigger Settings",
"type": "PlasmaVolumeSettingsSocketOut",
"valid_link_sockets": {"PlasmaVolumeSettingsSocketIn"},
},
}
}),
])
def draw_buttons(self, context, layout):
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)")],
default={"avatar"})
input_sockets = {
"enter": {
input_sockets = OrderedDict([
("enter", {
"text": "Trigger on Enter",
"type": "PlasmaVolumeSettingsSocketIn",
"valid_link_sockets": {"PlasmaVolumeSettingsSocketOut"},
},
"exit": {
}),
("exit", {
"text": "Trigger on Exit",
"type": "PlasmaVolumeSettingsSocketIn",
"valid_link_sockets": {"PlasmaVolumeSettingsSocketOut"},
},
}
}),
])
output_sockets = {
"keyref": {
output_sockets = OrderedDict([
("keyref", {
"text": "References",
"type": "PlasmaPythonReferenceNodeSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"},
},
"satisfies": {
}),
("satisfies", {
"text": "Satisfies",
"type": "PlasmaConditionSocket",
},
}
}),
])
def draw_buttons(self, context, layout):
layout.prop(self, "report_on")

9
korman/nodes/node_messages.py

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

61
korman/nodes/node_responder.py

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

Loading…
Cancel
Save