-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Warp Message node. #190
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
from .node_core import * | ||
from ..properties.modifiers.region import footstep_surfaces, footstep_surface_ids | ||
from ..exporter import ExportError | ||
from ..exporter import ExportError, utils | ||
from .. import idprops | ||
|
||
class PlasmaMessageSocketBase(PlasmaNodeSocketBase): | ||
|
@@ -656,7 +656,7 @@ class PlasmaSceneObjectMsgRcvrNode(idprops.IDPropObjectMixin, PlasmaNodeBase, bp | |
("message", { | ||
"text": "Message", | ||
"type": "PlasmaNodeSocketInputGeneral", | ||
"valid_link_sockets": {"PlasmaEnableMessageSocket"}, | ||
"valid_link_sockets": {"PlasmaEnableMessageSocket", "PlasmaWarpMessageSocket"}, | ||
"spawn_empty": True, | ||
}), | ||
]) | ||
|
@@ -877,3 +877,35 @@ def convert_message(self, exporter, so): | |
msg.BCastFlags |= (plMessage.kPropagateToModifiers | plMessage.kNetPropagate) | ||
msg.surface = footstep_surface_ids[self.surface] | ||
return msg | ||
|
||
|
||
class PlasmaWarpMsgNode(PlasmaMessageNode, bpy.types.Node): | ||
bl_category = "MSG" | ||
bl_idname = "PlasmaWarpMsgNode" | ||
bl_label = "Warp" | ||
|
||
pos_object = PointerProperty(name="Position", | ||
description="Object defining the target position", | ||
type=bpy.types.Object) | ||
|
||
output_sockets = OrderedDict([ | ||
("receivers", { | ||
"text": "Send To", | ||
"type": "PlasmaWarpMessageSocket", | ||
"valid_link_sockets": {"PlasmaWarpMessageSocket", "PlasmaNodeSocketInputGeneral"}, | ||
}), | ||
]) | ||
|
||
def draw_buttons(self, context, layout): | ||
layout.prop(self, "pos_object") | ||
|
||
def convert_message(self, exporter, so): | ||
msg = plWarpMsg() | ||
msg.BCastFlags |= plMessage.kNetPropagate | ||
msg.warpFlags |= plWarpMsg.kFlushTransform | ||
msg.transform = utils.matrix44(self.pos_object.matrix_local) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would be more useful if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a useful default. I'll give it a try and see how that works in practice. |
||
return msg | ||
|
||
|
||
class PlasmaWarpMessageSocket(PlasmaNodeSocketBase, bpy.types.NodeSocket): | ||
bl_color = (0.427, 0.196, 0.0, 1.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"PlasmaNodeSocketInputGeneral"
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the explanation in IRC, it might be better to use
valid_link_nodes
instead and specify the expected node type.