Browse Source

Removed the `OrderedDict`s (#400)

* Removed the `OrderedDict`s

* Changed some stuff from the code review

* Fixed a typo

* Added these imports: `from __future__ import annotations`
and `from typing import *`

* Moved `from __future__ import annotations` to the top.

* Changed type annotation `any`s to `Any`
pull/399/head
1Codealot 4 months ago committed by GitHub
parent
commit
969911b117
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 98
      korman/nodes/node_avatar.py
  2. 77
      korman/nodes/node_conditions.py
  3. 28
      korman/nodes/node_deprecated.py
  4. 24
      korman/nodes/node_logic.py
  5. 50
      korman/nodes/node_messages.py
  6. 58
      korman/nodes/node_responder.py
  7. 72
      korman/nodes/node_softvolume.py

98
korman/nodes/node_avatar.py

@ -13,9 +13,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>. # along with Korman. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict from typing import *
from PyHSPlasma import * from PyHSPlasma import *
from .node_core import PlasmaNodeBase, PlasmaNodeSocketBase from .node_core import PlasmaNodeBase, PlasmaNodeSocketBase
@ -36,20 +38,20 @@ class PlasmaSittingBehaviorNode(PlasmaNodeBase, bpy.types.Node):
default={"kApproachFront", "kApproachLeft", "kApproachRight"}, default={"kApproachFront", "kApproachLeft", "kApproachRight"},
options={"ENUM_FLAG"}) options={"ENUM_FLAG"})
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, str]] = {
("condition", { "condition": {
"text": "Condition", "text": "Condition",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("satisfies", { "satisfies": {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"valid_link_sockets": {"PlasmaConditionSocket", "PlasmaPythonFileNodeSocket"}, "valid_link_sockets": {"PlasmaConditionSocket", "PlasmaPythonFileNodeSocket"},
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
col = layout.column() col = layout.column()
@ -170,31 +172,31 @@ class PlasmaAnimStageSettingsNode(PlasmaNodeBase, bpy.types.Node):
default={"kNotifyEnter"}, default={"kNotifyEnter"},
options={"ENUM_FLAG"}) options={"ENUM_FLAG"})
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, Any]] = {
("advance_to", { "advance_to": {
"text": "Advance to Stage", "text": "Advance to Stage",
"type": "PlasmaAnimStageAdvanceSocketIn", "type": "PlasmaAnimStageAdvanceSocketIn",
"valid_link_nodes": "PlasmaAnimStageNode", "valid_link_nodes": "PlasmaAnimStageNode",
"valid_link_sockets": "PlasmaAnimStageOrderSocketOut", "valid_link_sockets": "PlasmaAnimStageOrderSocketOut",
"link_limit": 1, "link_limit": 1,
}), },
("regress_to", { "regress_to": {
"text": "Regress to Stage", "text": "Regress to Stage",
"type": "PlasmaAnimStageRegressSocketIn", "type": "PlasmaAnimStageRegressSocketIn",
"valid_link_nodes": "PlasmaAnimStageNode", "valid_link_nodes": "PlasmaAnimStageNode",
"valid_link_sockets": "PlasmaAnimStageOrderSocketOut", "valid_link_sockets": "PlasmaAnimStageOrderSocketOut",
"link_limit": 1, "link_limit": 1,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, str]] = {
("stage", { "stage": {
"text": "Stage", "text": "Stage",
"type": "PlasmaAnimStageSettingsSocket", "type": "PlasmaAnimStageSettingsSocket",
"valid_link_nodes": "PlasmaAnimStageNode", "valid_link_nodes": "PlasmaAnimStageNode",
"valid_link_sockets": "PlasmaAnimStageSettingsSocket", "valid_link_sockets": "PlasmaAnimStageSettingsSocket",
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "forward") layout.prop(self, "forward")
@ -230,30 +232,30 @@ class PlasmaAnimStageNode(PlasmaNodeBase, bpy.types.Node):
description="Number of times to loop animation", description="Number of times to loop animation",
default=0) default=0)
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, Any]] = {
("stage_settings", { "stage_settings": {
"text": "Stage Settings", "text": "Stage Settings",
"type": "PlasmaAnimStageSettingsSocket", "type": "PlasmaAnimStageSettingsSocket",
"valid_link_nodes": "PlasmaAnimStageSettingsNode", "valid_link_nodes": "PlasmaAnimStageSettingsNode",
"valid_link_sockets": "PlasmaAnimStageSettingsSocket", "valid_link_sockets": "PlasmaAnimStageSettingsSocket",
"link_limit": 1, "link_limit": 1,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, Any] = {
("stage", { "stage": {
"text": "Behavior", "text": "Behavior",
"type": "PlasmaAnimStageRefSocket", "type": "PlasmaAnimStageRefSocket",
"valid_link_nodes": "PlasmaMultiStageBehaviorNode", "valid_link_nodes": "PlasmaMultiStageBehaviorNode",
"valid_link_sockets": "PlasmaAnimStageRefSocket", "valid_link_sockets": "PlasmaAnimStageRefSocket",
}), },
("stage_reference", { "stage_reference": {
"text": "Stage Progression", "text": "Stage Progression",
"type": "PlasmaAnimStageOrderSocketOut", "type": "PlasmaAnimStageOrderSocketOut",
"valid_link_nodes": "PlasmaAnimStageSettingsNode", "valid_link_nodes": "PlasmaAnimStageSettingsNode",
"valid_link_sockets": {"PlasmaAnimStageAdvanceSocketIn", "PlasmaAnimStageRegressSocketIn"} , "valid_link_sockets": {"PlasmaAnimStageAdvanceSocketIn", "PlasmaAnimStageRegressSocketIn"} ,
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "anim_name") layout.prop(self, "anim_name")
@ -293,39 +295,39 @@ class PlasmaMultiStageBehaviorNode(PlasmaNodeBase, bpy.types.Node):
description="Reverse forward/back controls at end", description="Reverse forward/back controls at end",
default=False) default=False)
input_sockets = OrderedDict([ input_sockets: dict[str, Any] = {
("seek_target", { "seek_target": {
"text": "Seek Target", "text": "Seek Target",
"type": "PlasmaSeekTargetSocketIn", "type": "PlasmaSeekTargetSocketIn",
"valid_link_sockets": "PlasmaSeekTargetSocketOut", "valid_link_sockets": "PlasmaSeekTargetSocketOut",
}), },
("stage_refs", { "stage_refs": {
"text": "Stage", "text": "Stage",
"type": "PlasmaAnimStageRefSocket", "type": "PlasmaAnimStageRefSocket",
"valid_link_nodes": "PlasmaAnimStageNode", "valid_link_nodes": "PlasmaAnimStageNode",
"valid_link_sockets": "PlasmaAnimStageRefSocket", "valid_link_sockets": "PlasmaAnimStageRefSocket",
"link_limit": 1, "link_limit": 1,
"spawn_empty": True, "spawn_empty": True,
}), },
("condition", { "condition": {
"text": "Triggered By", "text": "Triggered By",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, Any] = {
("hosts", { "hosts": {
"text": "Host Script", "text": "Host Script",
"type": "PlasmaBehaviorSocket", "type": "PlasmaBehaviorSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"}, "valid_link_nodes": "PlasmaPythonFileNode",
"spawn_empty": True, "spawn_empty": True,
}), },
("satisfies", { "satisfies": {
"text": "Trigger", "text": "Trigger",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
}) }
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "freeze_phys") layout.prop(self, "freeze_phys")
@ -463,14 +465,14 @@ class PlasmaSeekTargetNode(PlasmaNodeBase, bpy.types.Node):
description="Object defining the Seek Point's position", description="Object defining the Seek Point's position",
type=bpy.types.Object) type=bpy.types.Object)
output_sockets = OrderedDict([ output_sockets: dict[str, Any] = {
("seekers", { "seekers": {
"text": "Seekers", "text": "Seekers",
"type": "PlasmaSeekTargetSocketOut", "type": "PlasmaSeekTargetSocketOut",
"valid_link_nodes": {"PlasmaMultiStageBehaviorNode", "PlasmaOneShotMsgNode"}, "valid_link_nodes": {"PlasmaMultiStageBehaviorNode", "PlasmaOneShotMsgNode"},
"valid_link_sockets": {"PlasmaSeekTargetSocketIn"}, "valid_link_sockets": {"PlasmaSeekTargetSocketIn"},
}) },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
col = layout.column() col = layout.column()

77
korman/nodes/node_conditions.py

@ -17,7 +17,6 @@ from __future__ import annotations
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 *
from typing import * from typing import *
@ -44,29 +43,29 @@ class PlasmaClickableNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.types.N
items=bounds_types, items=bounds_types,
default="hull") default="hull")
input_sockets = OrderedDict([ input_sockets: dict[str, Any] = {
("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",
}), },
("message", { "message": {
"text": "Message", "text": "Message",
"type": "PlasmaEnableMessageSocket", "type": "PlasmaEnableMessageSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("satisfies", { "satisfies": {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"valid_link_sockets": {"PlasmaConditionSocket", "PlasmaPythonFileNodeSocket"}, "valid_link_sockets": {"PlasmaConditionSocket", "PlasmaPythonFileNodeSocket"},
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "clickable_object", icon="MESH_DATA") layout.prop(self, "clickable_object", icon="MESH_DATA")
@ -168,12 +167,12 @@ class PlasmaClickableRegionNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.t
items=bounds_types, items=bounds_types,
default="hull") default="hull")
output_sockets = OrderedDict([ output_sockets = {
("satisfies", { "satisfies": {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaClickableRegionSocket", "type": "PlasmaClickableRegionSocket",
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "region_object", icon="MESH_DATA") layout.prop(self, "region_object", icon="MESH_DATA")
@ -280,13 +279,13 @@ class PlasmaFacingTargetNode(PlasmaNodeBase, bpy.types.Node):
get=_get_tolerance, set=_set_tolerance, get=_get_tolerance, set=_set_tolerance,
subtype="ANGLE", options=set()) subtype="ANGLE", options=set())
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("satisfies", { "satisfies": {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaFacingTargetSocket", "type": "PlasmaFacingTargetSocket",
"link_limit": 1, "link_limit": 1,
}), },
]) }
def _draw_sub_prop(self, layout, prop_name, *, active=True, sidebar=False, **kwargs): def _draw_sub_prop(self, layout, prop_name, *, active=True, sidebar=False, **kwargs):
sub = layout.row() if sidebar else layout.column() sub = layout.row() if sidebar else layout.column()
@ -380,13 +379,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=0) min=0)
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("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")
@ -433,35 +432,35 @@ class PlasmaVolumeSensorNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.type
default={"kGroupAvatar"}, default={"kGroupAvatar"},
update=_update_report_on) update=_update_report_on)
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, Any]] = {
("facing", { "facing": {
"text": "Avatar Facing Target", "text": "Avatar Facing Target",
"type": "PlasmaFacingTargetSocket", "type": "PlasmaFacingTargetSocket",
}), },
("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"},
}), },
("message", { "message": {
"text": "Message", "text": "Message",
"type": "PlasmaEnableMessageSocket", "type": "PlasmaEnableMessageSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("satisfies", { "satisfies": {
"text": "Satisfies", "text": "Satisfies",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"valid_link_sockets": {"PlasmaConditionSocket", "PlasmaPythonFileNodeSocket"}, "valid_link_sockets": {"PlasmaConditionSocket", "PlasmaPythonFileNodeSocket"},
}), },
]) }
def init(self, context): def init(self, context):
# The default value for the facing socket is a bit silly for this node type. # The default value for the facing socket is a bit silly for this node type.

28
korman/nodes/node_deprecated.py

@ -13,10 +13,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>. # along with Korman. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import abc import abc
import bpy import bpy
from typing import *
from bpy.props import * from bpy.props import *
from collections import OrderedDict
from .node_core import * from .node_core import *
@ -53,28 +55,28 @@ class PlasmaResponderCommandNode(PlasmaDeprecatedNode, bpy.types.Node):
bl_idname = "PlasmaResponderCommandNode" bl_idname = "PlasmaResponderCommandNode"
bl_label = "Responder Command" bl_label = "Responder Command"
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, str]] = {
("whodoneit", { "whodoneit": {
"text": "Condition", "text": "Condition",
"type": "PlasmaRespCommandSocket", "type": "PlasmaRespCommandSocket",
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, Any] = {
("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",
}), },
("reenable", { "reenable": {
"text": "Local Reenable", "text": "Local Reenable",
"type": "PlasmaEnableMessageSocket", "type": "PlasmaEnableMessageSocket",
}), },
]) }
def _find_message_sender_node(self, parentCmdNode=None): def _find_message_sender_node(self, parentCmdNode=None):
if parentCmdNode is None: if parentCmdNode is None:

24
korman/nodes/node_logic.py

@ -13,9 +13,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>. # along with Korman. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict from typing import *
from PyHSPlasma import * from PyHSPlasma import *
from .node_core import * from .node_core import *
@ -51,28 +53,28 @@ class PlasmaExcludeRegionNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bpy.typ
block_cameras = BoolProperty(name="Block Cameras", block_cameras = BoolProperty(name="Block Cameras",
description="The region blocks cameras when it has been cleared") description="The region blocks cameras when it has been cleared")
input_sockets = OrderedDict([ input_sockets:dict[str, dict[str, Any]] = {
("safe_point", { "safe_point": {
"type": "PlasmaExcludeSafePointSocket", "type": "PlasmaExcludeSafePointSocket",
"text": "Safe Point", "text": "Safe Point",
"spawn_empty": True, "spawn_empty": True,
# This never links to anything... # This never links to anything...
"valid_link_sockets": frozenset(), "valid_link_sockets": frozenset(),
}), },
("msg", { "msg": {
"type": "PlasmaExcludeMessageSocket", "type": "PlasmaExcludeMessageSocket",
"text": "Message", "text": "Message",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("keyref", { "keyref": {
"text": "References", "text": "References",
"type": "PlasmaPythonReferenceNodeSocket", "type": "PlasmaPythonReferenceNodeSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"}, "valid_link_nodes": {"PlasmaPythonFileNode"},
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "region_object", icon="MESH_DATA") layout.prop(self, "region_object", icon="MESH_DATA")

50
korman/nodes/node_messages.py

@ -19,7 +19,6 @@ import bpy
from bpy.props import * from bpy.props import *
from PyHSPlasma import * from PyHSPlasma import *
from collections import OrderedDict
from typing import * from typing import *
from .node_core import * from .node_core import *
@ -38,14 +37,15 @@ class PlasmaMessageSocket(PlasmaMessageSocketBase, bpy.types.NodeSocket):
class PlasmaMessageNode(PlasmaNodeBase): class PlasmaMessageNode(PlasmaNodeBase):
input_sockets = OrderedDict([
("sender", { input_sockets: dict[str, dict[str, Any]] = {
"sender": {
"text": "Sender", "text": "Sender",
"type": "PlasmaMessageSocket", "type": "PlasmaMessageSocket",
"valid_link_sockets": "PlasmaMessageSocket", "valid_link_sockets": "PlasmaMessageSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
@property @property
def has_callbacks(self): def has_callbacks(self):
@ -54,14 +54,14 @@ class PlasmaMessageNode(PlasmaNodeBase):
class PlasmaMessageWithCallbacksNode(PlasmaMessageNode): class PlasmaMessageWithCallbacksNode(PlasmaMessageNode):
output_sockets = OrderedDict([ soutput_sockets: dict[str, dict[str, str]] = {
("msgs", { "msgs": {
"can_link": "can_link_callback", "can_link": "can_link_callback",
"text": "Send On Completion", "text": "Send On Completion",
"type": "PlasmaMessageSocket", "type": "PlasmaMessageSocket",
"valid_link_sockets": "PlasmaMessageSocket", "valid_link_sockets": "PlasmaMessageSocket",
}), },
]) }
@property @property
def can_link_callback(self): def can_link_callback(self):
@ -404,13 +404,13 @@ class PlasmaEnableMsgNode(PlasmaMessageNode, bpy.types.Node):
bl_idname = "PlasmaEnableMsgNode" bl_idname = "PlasmaEnableMsgNode"
bl_label = "Enable/Disable" bl_label = "Enable/Disable"
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("receivers", { "receivers": {
"text": "Send To", "text": "Send To",
"type": "PlasmaEnableMessageSocket", "type": "PlasmaEnableMessageSocket",
"valid_link_sockets": {"PlasmaEnableMessageSocket", "PlasmaNodeSocketInputGeneral"}, "valid_link_sockets": {"PlasmaEnableMessageSocket", "PlasmaNodeSocketInputGeneral"},
}), },
]) }
cmd = EnumProperty(name="Command", cmd = EnumProperty(name="Command",
description="How should we affect the object's state?", description="How should we affect the object's state?",
@ -499,12 +499,12 @@ class PlasmaExcludeRegionMsg(PlasmaMessageNode, bpy.types.Node):
bl_idname = "PlasmaExcludeRegionMsg" bl_idname = "PlasmaExcludeRegionMsg"
bl_label = "Exclude Region" bl_label = "Exclude Region"
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, str]] = {
("region", { "region": {
"text": "Region", "text": "Region",
"type": "PlasmaExcludeMessageSocket" "type": "PlasmaExcludeMessageSocket"
}), },
]) }
cmd = EnumProperty(name="Command", cmd = EnumProperty(name="Command",
description="Exclude Region State", description="Exclude Region State",
@ -703,14 +703,14 @@ class PlasmaSceneObjectMsgRcvrNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bp
bl_label = "Send To Object" bl_label = "Send To Object"
bl_width_default = 190 bl_width_default = 190
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, Any]]= {
("message", { "message": {
"text": "Message", "text": "Message",
"type": "PlasmaNodeSocketInputGeneral", "type": "PlasmaNodeSocketInputGeneral",
"valid_link_sockets": {"PlasmaEnableMessageSocket"}, "valid_link_sockets": {"PlasmaEnableMessageSocket"},
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
target_object = PointerProperty(name="Object", target_object = PointerProperty(name="Object",
description="Object to send the message to", description="Object to send the message to",
@ -1030,15 +1030,15 @@ class PlasmaTriggerMultiStageMsgNode(PlasmaMessageNode, bpy.types.Node):
bl_idname = "PlasmaTriggerMultiStageMsgNode" bl_idname = "PlasmaTriggerMultiStageMsgNode"
bl_label = "Trigger MultiStage" bl_label = "Trigger MultiStage"
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("satisfies", { "satisfies": {
"text": "Trigger", "text": "Trigger",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"valid_link_nodes": "PlasmaMultiStageBehaviorNode", "valid_link_nodes": "PlasmaMultiStageBehaviorNode",
"valid_link_sockets": "PlasmaConditionSocket", "valid_link_sockets": "PlasmaConditionSocket",
"link_limit": 1, "link_limit": 1,
}) }
]) }
def convert_message(self, exporter, so): def convert_message(self, exporter, so):
# Yeah, this is not a REAL Plasma message, but the Korman way is to try to hide these little # Yeah, this is not a REAL Plasma message, but the Korman way is to try to hide these little

58
korman/nodes/node_responder.py

@ -17,7 +17,7 @@ from __future__ import annotations
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict from typing import *
import inspect import inspect
from PyHSPlasma import * from PyHSPlasma import *
import uuid import uuid
@ -46,38 +46,38 @@ class PlasmaResponderNode(PlasmaVersionedNode, bpy.types.Node):
default_state = IntProperty(name="Default State Index", default_state = IntProperty(name="Default State Index",
options=set()) options=set())
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, Any]] = {
("condition", { "condition": {
"text": "Condition", "text": "Condition",
"type": "PlasmaConditionSocket", "type": "PlasmaConditionSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, Any]] = {
("keyref", { "keyref": {
"text": "References", "text": "References",
"type": "PlasmaPythonReferenceNodeSocket", "type": "PlasmaPythonReferenceNodeSocket",
"valid_link_nodes": {"PlasmaPythonFileNode"}, "valid_link_nodes": {"PlasmaPythonFileNode"},
}), },
("state_refs", { "state_refs": {
"text": "State", "text": "State",
"type": "PlasmaRespStateRefSocket", "type": "PlasmaRespStateRefSocket",
"valid_link_nodes": "PlasmaResponderStateNode", "valid_link_nodes": "PlasmaResponderStateNode",
"valid_link_sockets": "PlasmaRespStateRefSocket", "valid_link_sockets": "PlasmaRespStateRefSocket",
"link_limit": 1, "link_limit": 1,
"spawn_empty": True, "spawn_empty": True,
}), },
# This version of the states socket has been deprecated. # This version of the states socket has been deprecated.
# We need to be able to track 1 socket -> 1 state to manage # We need to be able to track 1 socket -> 1 state to manage
# responder state IDs # responder state IDs
("states", { "states": {
"text": "States", "text": "States",
"type": "PlasmaRespStateSocket", "type": "PlasmaRespStateSocket",
"hidden": True, "hidden": True,
}), }
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.prop(self, "detect_trigger") layout.prop(self, "detect_trigger")
@ -227,40 +227,40 @@ class PlasmaResponderStateNode(PlasmaNodeBase, bpy.types.Node):
set=_set_default_state, set=_set_default_state,
options=set()) options=set())
input_sockets = OrderedDict([ input_sockets: dict[str, Any] = {
("condition", { "condition": {
"text": "Triggers State", "text": "Triggers State",
"type": "PlasmaRespStateSocket", "type": "PlasmaRespStateSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
("resp", { "resp": {
"text": "Responder", "text": "Responder",
"type": "PlasmaRespStateRefSocket", "type": "PlasmaRespStateRefSocket",
"valid_link_nodes": "PlasmaResponderNode", "valid_link_nodes": "PlasmaResponderNode",
"valid_link_sockets": "PlasmaRespStateRefSocket", "valid_link_sockets": "PlasmaRespStateRefSocket",
}), },
]) }
output_sockets = OrderedDict([ output_sockets = {
# This socket has been deprecated. # This socket has been deprecated.
("cmds", { # While this is deprecated I might as well also convert it.
"cmds": {
"text": "Commands", "text": "Commands",
"type": "PlasmaRespCommandSocket", "type": "PlasmaRespCommandSocket",
"hidden": True, "hidden": True,
}), },
# These ones are valid.
# These sockets are valid. "msgs": {
("msgs", {
"text": "Send Message", "text": "Send Message",
"type": "PlasmaMessageSocket", "type": "PlasmaMessageSocket",
"valid_link_sockets": "PlasmaMessageSocket", "valid_link_sockets": "PlasmaMessageSocket",
}), },
("gotostate", { "gotostate": {
"link_limit": 1, "link_limit": 1,
"text": "Triggers State", "text": "Triggers State",
"type": "PlasmaRespStateSocket", "type": "PlasmaRespStateSocket",
}), },
]) }
def draw_buttons(self, context, layout): def draw_buttons(self, context, layout):
layout.active = self.find_input("resp") is not None layout.active = self.find_input("resp") is not None

72
korman/nodes/node_softvolume.py

@ -13,9 +13,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Korman. If not, see <http://www.gnu.org/licenses/>. # along with Korman. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import bpy import bpy
from bpy.props import * from bpy.props import *
from collections import OrderedDict from typing import *
from PyHSPlasma import * from PyHSPlasma import *
from .node_core import PlasmaNodeBase, PlasmaNodeSocketBase, PlasmaTreeOutputNodeBase from .node_core import PlasmaNodeBase, PlasmaNodeSocketBase, PlasmaTreeOutputNodeBase
@ -26,12 +28,12 @@ class PlasmaSoftVolumeOutputNode(PlasmaTreeOutputNodeBase, bpy.types.Node):
bl_idname = "PlasmaSoftVolumeOutputNode" bl_idname = "PlasmaSoftVolumeOutputNode"
bl_label = "Soft Volume Output" bl_label = "Soft Volume Output"
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, str]] = {
("input", { "input": {
"text": "Final Volume", "text": "Final Volume",
"type": "PlasmaSoftVolumeNodeSocket", "type": "PlasmaSoftVolumeNodeSocket",
}), },
]) }
def get_key(self, exporter, so): def get_key(self, exporter, so):
svNode = self.find_input("input") svNode = self.find_input("input")
@ -51,12 +53,12 @@ class PlasmaSoftVolumePropertiesNode(PlasmaNodeBase, bpy.types.Node):
bl_idname = "PlasmaSoftVolumePropertiesNode" bl_idname = "PlasmaSoftVolumePropertiesNode"
bl_label = "Soft Volume Properties" bl_label = "Soft Volume Properties"
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, str]] = {
("target", { "target": {
"text": "Volume", "text": "Volume",
"type": "PlasmaSoftVolumePropertiesNodeSocket" "type": "PlasmaSoftVolumePropertiesNodeSocket"
}), },
]) }
inside_strength = IntProperty(name="Inside", description="Strength inside the region", inside_strength = IntProperty(name="Inside", description="Strength inside the region",
subtype="PERCENTAGE", default=100, min=0, max=100) subtype="PERCENTAGE", default=100, min=0, max=100)
@ -78,12 +80,12 @@ class PlasmaSoftVolumeReferenceNode(idprops.IDPropObjectMixin, PlasmaNodeBase, b
bl_label = "Soft Region" bl_label = "Soft Region"
bl_width_default = 150 bl_width_default = 150
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, str]] = {
("output", { "output": {
"text": "Volume", "text": "Volume",
"type": "PlasmaSoftVolumeNodeSocket" "type": "PlasmaSoftVolumeNodeSocket"
}), },
]) }
soft_volume = PointerProperty(name="Soft Volume", soft_volume = PointerProperty(name="Soft Volume",
description="Object whose Soft Volume modifier we should use", description="Object whose Soft Volume modifier we should use",
@ -111,23 +113,23 @@ class PlasmaSoftVolumeInvertNode(PlasmaNodeBase, bpy.types.Node):
bl_label = "Soft Volume Invert" bl_label = "Soft Volume Invert"
# The only difference between this and PlasmaSoftVolumeLinkNode is this can only have ONE input # The only difference between this and PlasmaSoftVolumeLinkNode is this can only have ONE input
input_sockets = OrderedDict([ input_sockets: dict[str, dict[str, str]] = {
("properties", { "properties": {
"text": "Properties", "text": "Properties",
"type": "PlasmaSoftVolumePropertiesNodeSocket", "type": "PlasmaSoftVolumePropertiesNodeSocket",
}), },
("input", { "input": {
"text": "Input Volume", "text": "Input Volume",
"type": "PlasmaSoftVolumeNodeSocket", "type": "PlasmaSoftVolumeNodeSocket",
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, str]] = {
("output", { "output": {
"text": "Output Volume", "text": "Volume",
"type": "PlasmaSoftVolumeNodeSocket" "type": "PlasmaSoftVolumeNodeSocket"
}), },
]) }
def get_key(self, exporter, so): def get_key(self, exporter, so):
return self._find_create_key(plSoftVolumeInvert, exporter, so=so) return self._find_create_key(plSoftVolumeInvert, exporter, so=so)
@ -153,24 +155,24 @@ class PlasmaSoftVolumeInvertNode(PlasmaNodeBase, bpy.types.Node):
class PlasmaSoftVolumeLinkNode(PlasmaNodeBase): class PlasmaSoftVolumeLinkNode(PlasmaNodeBase):
input_sockets = OrderedDict([ input_sockets: dict[str, Any] = {
("properties", { "properties": {
"text": "Properties", "text": "Properties",
"type": "PlasmaSoftVolumePropertiesNodeSocket", "type": "PlasmaSoftVolumePropertiesNodeSocket",
}), },
("input", { "input": {
"text": "Input Volume", "text": "Input Volume",
"type": "PlasmaSoftVolumeNodeSocket", "type": "PlasmaSoftVolumeNodeSocket",
"spawn_empty": True, "spawn_empty": True,
}), },
]) }
output_sockets = OrderedDict([ output_sockets: dict[str, dict[str, str]] = {
("output", { "output": {
"text": "Output Volume", "text": "Volume",
"type": "PlasmaSoftVolumeNodeSocket" "type": "PlasmaSoftVolumeNodeSocket"
}), },
]) }
def export(self, exporter, bo, so): def export(self, exporter, bo, so):
sv = self.get_key(exporter, so).object sv = self.get_key(exporter, so).object

Loading…
Cancel
Save