Live patch: support for adding nodes

This commit is contained in:
Moritz Brückner 2021-07-20 20:53:22 +02:00
parent 3ed915b654
commit 1edc7a9469
333 changed files with 396 additions and 666 deletions

View file

@ -1,5 +1,6 @@
package armory.logicnode;
#if arm_patch @:keep @:keepSub #end
class LogicNode {
var tree: LogicTree;

View file

@ -6,6 +6,7 @@ import armory.logicnode.LogicTree;
#if arm_patch @:expose("LivePatch") #end
@:access(armory.logicnode.LogicNode)
@:access(armory.logicnode.LogicNodeInput)
class LivePatch extends iron.Trait {
#if !arm_patch
@ -105,6 +106,31 @@ class LivePatch extends iron.Trait {
tree.nodes.remove(nodeName);
}
public static function patchNodeCreate(treeName: String, nodeName: String, nodeType: String, propDatas: Array<Array<Dynamic>>, inputDatas: Array<Array<Dynamic>>, outputDatas: Array<Array<Dynamic>>) {
var tree = LogicTree.nodeTrees[treeName];
if (tree == null) return;
// No further constructor parameters required here, all variable nodes
// use optional further parameters and all values are set later in this
// function.
var newNode: LogicNode = Type.createInstance(Type.resolveClass(nodeType), [tree]);
newNode.name = nodeName;
tree.nodes[nodeName] = newNode;
for (propData in propDatas) {
Reflect.setField(newNode, propData[0], propData[1]);
}
var i = 0;
for (inputData in inputDatas) {
newNode.addInput(createSocketDefaultNode(newNode.tree, inputData[0], inputData[1]), i++);
}
for (outputData in outputDatas) {
newNode.addOutputs([createSocketDefaultNode(newNode.tree, outputData[0], outputData[1])]);
}
}
public static function patchNodeCopy(treeName: String, nodeName: String, newNodeName: String, copyProps: Array<String>, inputDatas: Array<Array<Dynamic>>, outputDatas: Array<Array<Dynamic>>) {
var tree = LogicTree.nodeTrees[treeName];
if (tree == null) return;
@ -115,7 +141,7 @@ class LivePatch extends iron.Trait {
// No further constructor parameters required here, all variable nodes
// use optional further parameters and all values are set later in this
// function.
var newNode = Type.createInstance(Type.getClass(node), [tree]);
var newNode: LogicNode = Type.createInstance(Type.getClass(node), [tree]);
newNode.name = newNodeName;
tree.nodes[newNodeName] = newNode;

View file

@ -186,7 +186,7 @@ def send_event(event_id: str, opt_data: Any = None):
tree_name = arm.node_utils.get_export_tree_name(node.get_tree())
node_name = arm.node_utils.get_export_node_name(node)[1:]
value = arm.node_utils.haxe_format_prop(node, prop_name)
value = arm.node_utils.haxe_format_prop_value(node, prop_name)
js = f'LivePatch.patchUpdateNodeProp("{tree_name}", "{node_name}", "{prop_name}", {value});'
write_patch(js)
@ -215,6 +215,25 @@ def send_event(event_id: str, opt_data: Any = None):
js = f'LivePatch.patchUpdateNodeInputVal("{tree_name}", "{node_name}", {socket_index}, {value});'
write_patch(js)
elif event_id == 'ln_create':
node: ArmLogicTreeNode = opt_data
tree_name = arm.node_utils.get_export_tree_name(node.get_tree())
node_name = arm.node_utils.get_export_node_name(node)[1:]
node_type = 'armory.logicnode.' + node.bl_idname[2:]
prop_names = (p for p in arm.node_utils.get_haxe_property_names(node))
prop_values = (getattr(node, prop_name) for prop_name in prop_names)
prop_datas = arm.node_utils.haxe_format_socket_val(list(zip(prop_names, prop_values)))
inp_data = [(inp.arm_socket_type, inp.get_default_value()) for inp in node.inputs]
inp_data = arm.node_utils.haxe_format_socket_val(inp_data)
out_data = [(out.arm_socket_type, out.get_default_value()) for out in node.outputs]
out_data = arm.node_utils.haxe_format_socket_val(out_data)
js = f'LivePatch.patchNodeCreate("{tree_name}", "{node_name}", "{node_type}", {prop_datas}, {inp_data}, {out_data});'
write_patch(js)
elif event_id == 'ln_delete':
node: ArmLogicTreeNode = opt_data

View file

@ -6,8 +6,7 @@ class AnimActionNode(ArmLogicTreeNode):
bl_label = 'Action'
arm_version = 1
def init(self, context):
super(AnimActionNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAnimAction', 'Action')
self.add_output('ArmNodeSocketAnimAction', 'Action', is_var=True)

View file

@ -6,8 +6,7 @@ class BlendActionNode(ArmLogicTreeNode):
bl_label = 'Blend Action'
arm_version = 1
def init(self, context):
super(BlendActionNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmNodeSocketAnimAction', 'Action 1')

View file

@ -7,8 +7,7 @@ class BoneFKNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'armature'
def init(self, context):
super(BoneFKNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmStringSocket', 'Bone')

View file

@ -7,8 +7,7 @@ class BoneIKNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'armature'
def init(self, context):
super(BoneIKNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmStringSocket', 'Bone')

View file

@ -6,8 +6,7 @@ class AnimationStateNode(ArmLogicTreeNode):
bl_label = 'Get Action State'
arm_version = 1
def init(self, context):
super(AnimationStateNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmStringSocket', 'Action')

View file

@ -7,8 +7,7 @@ class GetTilesheetStateNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'tilesheet'
def init(self, context):
super(GetTilesheetStateNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmStringSocket', 'Name')

View file

@ -6,8 +6,7 @@ class OnActionMarkerNode(ArmLogicTreeNode):
bl_label = 'On Action Marker'
arm_version = 1
def init(self, context):
super(OnActionMarkerNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmStringSocket', 'Marker')

View file

@ -6,8 +6,7 @@ class PlayActionFromNode(ArmLogicTreeNode):
bl_label = 'Play Action From'
arm_version = 2
def init(self, context):
super(PlayActionFromNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmNodeSocketAnimAction', 'Action')
@ -22,7 +21,7 @@ class PlayActionFromNode(ArmLogicTreeNode):
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.arm_version not in (0, 1):
raise LookupError()
return NodeReplacement(
'LNPlayActionFromNode', self.arm_version, 'LNPlayActionFromNode', 2,
in_socket_mapping={0:0, 1:1, 2:2, 3:3, 4:4}, out_socket_mapping={0:0, 1:1}

View file

@ -7,8 +7,7 @@ class PlayTilesheetNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'tilesheet'
def init(self, context):
super(PlayTilesheetNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmStringSocket', 'Name')

View file

@ -6,8 +6,7 @@ class SetActionPausedNode(ArmLogicTreeNode):
bl_label = 'Set Action Paused'
arm_version = 1
def init(self, context):
super(SetActionPausedNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmBoolSocket', 'Paused')

View file

@ -6,8 +6,7 @@ class SetActionSpeedNode(ArmLogicTreeNode):
bl_label = 'Set Action Speed'
arm_version = 1
def init(self, context):
super(SetActionSpeedNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmFloatSocket', 'Speed', default_value=1.0)

View file

@ -7,8 +7,7 @@ class SetParentBoneNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'armature'
def init(self, context):
super(SetParentBoneNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmNodeSocketObject', 'Parent', default_value='Parent')

View file

@ -6,8 +6,7 @@ class SetParticleSpeedNode(ArmLogicTreeNode):
bl_label = 'Set Particle Speed'
arm_version = 1
def init(self, context):
super(SetParticleSpeedNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmFloatSocket', 'Speed', default_value=1.0)

View file

@ -7,8 +7,7 @@ class SetTilesheetPausedNode(ArmLogicTreeNode):
arm_section = 'tilesheet'
arm_version = 1
def init(self, context):
super(SetTilesheetPausedNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmBoolSocket', 'Paused')

View file

@ -37,6 +37,14 @@ class ArmLogicTreeNode(bpy.types.Node):
else:
self.arm_version = 1
if not hasattr(self, 'arm_init'):
# Show warning for older node packages
arm.log.warn(f'Node {self.bl_idname} has no arm_init function and might not work correctly!')
else:
self.arm_init(context)
arm.live_patch.send_event('ln_create', self)
@classmethod
def poll(cls, ntree):
return ntree.bl_idname == 'ArmLogicTreeType'

View file

@ -10,8 +10,7 @@ class ArrayNode(ArmLogicTreeNode):
def __init__(self):
array_nodes[str(id(self))] = self
def init(self, context):
super(ArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -15,8 +15,7 @@ class ArrayAddNode(ArmLogicTreeNode):
super(ArrayAddNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(ArrayAddNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmBoolSocket', 'Modify Original', default_value=True)

View file

@ -11,8 +11,7 @@ class BooleanArrayNode(ArmLogicTreeNode):
super(BooleanArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(BooleanArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -11,8 +11,7 @@ class ColorArrayNode(ArmLogicTreeNode):
super(ColorArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(ColorArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -6,8 +6,7 @@ class ArrayContainsNode(ArmLogicTreeNode):
bl_label = 'Array Contains'
arm_version = 1
def init(self, context):
super(ArrayContainsNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmDynamicSocket', 'Value')

View file

@ -11,8 +11,7 @@ class FloatArrayNode(ArmLogicTreeNode):
super(FloatArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(FloatArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -6,8 +6,7 @@ class ArrayGetNode(ArmLogicTreeNode):
bl_label = 'Array Get'
arm_version = 1
def init(self, context):
super(ArrayGetNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmIntSocket', 'Index')

View file

@ -11,8 +11,7 @@ class IntegerArrayNode(ArmLogicTreeNode):
super(IntegerArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(IntegerArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array')
self.add_output('ArmIntSocket', 'Length')

View file

@ -6,8 +6,7 @@ class ArrayLengthNode(ArmLogicTreeNode):
bl_label = 'Array Length'
arm_version = 1
def init(self, context):
super(ArrayLengthNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_output('ArmIntSocket', 'Length')

View file

@ -7,8 +7,7 @@ class ArrayLoopNode(ArmLogicTreeNode):
bl_label = 'Array Loop'
arm_version = 1
def init(self, context):
super(ArrayLoopNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketArray', 'Array')

View file

@ -11,8 +11,7 @@ class ObjectArrayNode(ArmLogicTreeNode):
super(ObjectArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(ObjectArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -8,8 +8,7 @@ class ArrayPopNode(ArmLogicTreeNode):
bl_label = 'Array Pop'
arm_version = 1
def init(self, context):
super(ArrayPopNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_output('ArmDynamicSocket', 'Value')

View file

@ -8,8 +8,7 @@ class ArrayRemoveIndexNode(ArmLogicTreeNode):
bl_label = 'Array Remove by Index'
arm_version = 1
def init(self, context):
super(ArrayRemoveIndexNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmIntSocket', 'Index')

View file

@ -11,8 +11,7 @@ class ArrayRemoveValueNode(ArmLogicTreeNode):
# def __init__(self):
# array_nodes[str(id(self))] = self
def init(self, context):
super(ArrayRemoveValueNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmDynamicSocket', 'Value')

View file

@ -6,8 +6,7 @@ class ArraySetNode(ArmLogicTreeNode):
bl_label = 'Array Set'
arm_version = 1
def init(self, context):
super(ArraySetNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmIntSocket', 'Index')

View file

@ -8,8 +8,7 @@ class ArrayShiftNode(ArmLogicTreeNode):
bl_label = 'Array Shift'
arm_version = 1
def init(self, context):
super(ArrayShiftNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_output('ArmDynamicSocket', 'Value')

View file

@ -8,8 +8,7 @@ class ArraySliceNode(ArmLogicTreeNode):
bl_label = 'Array Slice'
arm_version = 1
def init(self, context):
super(ArraySliceNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmIntSocket', 'Index')
self.add_input('ArmIntSocket', 'End')

View file

@ -8,8 +8,7 @@ class ArraySpliceNode(ArmLogicTreeNode):
bl_label = 'Array Splice'
arm_version = 1
def init(self, context):
super(ArraySpliceNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketArray', 'Array')
self.add_input('ArmIntSocket', 'Index')

View file

@ -11,8 +11,7 @@ class StringArrayNode(ArmLogicTreeNode):
super(StringArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(StringArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -11,8 +11,7 @@ class VectorArrayNode(ArmLogicTreeNode):
super(VectorArrayNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(VectorArrayNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketArray', 'Array', is_var=True)
self.add_output('ArmIntSocket', 'Length')

View file

@ -8,6 +8,5 @@ class ActiveCameraNode(ArmLogicTreeNode):
bl_label = 'Get Camera Active'
arm_version = 1
def init(self, context):
super(ActiveCameraNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketObject', 'Camera')

View file

@ -8,8 +8,7 @@ class GetCameraFovNode(ArmLogicTreeNode):
bl_label = 'Get Camera FOV'
arm_version = 1
def init(self, context):
super(GetCameraFovNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmFloatSocket', 'FOV')

View file

@ -8,8 +8,7 @@ class SetCameraNode(ArmLogicTreeNode):
bl_label = 'Set Camera Active'
arm_version = 1
def init(self, context):
super(SetCameraNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Camera')

View file

@ -8,8 +8,7 @@ class SetCameraFovNode(ArmLogicTreeNode):
bl_label = 'Set Camera FOV'
arm_version = 1
def init(self, context):
super(SetCameraFovNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Camera')
self.add_input('ArmFloatSocket', 'FOV', default_value=0.9)

View file

@ -6,8 +6,7 @@ class CanvasGetCheckboxNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Checkbox'
arm_version = 1
def init(self, context):
super(CanvasGetCheckboxNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmStringSocket', 'Element')
self.add_output('ArmBoolSocket', 'Is Checked')

View file

@ -6,8 +6,7 @@ class CanvasGetInputTextNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Input Text'
arm_version = 1
def init(self, context):
super(CanvasGetInputTextNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmStringSocket', 'Element')
self.add_output('ArmStringSocket', 'Text')

View file

@ -6,8 +6,7 @@ class CanvasGetLocationNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Location'
arm_version = 1
def init(self, context):
super(CanvasGetLocationNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')

View file

@ -6,8 +6,7 @@ class CanvasGetPositionNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Position'
arm_version = 1
def init(self, context):
super(CanvasGetPositionNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmStringSocket', 'Element')
self.add_output('ArmIntSocket', 'Position')

View file

@ -6,8 +6,7 @@ class CanvasGetPBNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Progress Bar'
arm_version = 1
def init(self, context):
super(CanvasGetPBNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')

View file

@ -6,8 +6,7 @@ class CanvasGetRotationNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Rotation'
arm_version = 1
def init(self, context):
super(CanvasGetRotationNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')

View file

@ -6,8 +6,7 @@ class CanvasGetScaleNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Scale'
arm_version = 1
def init(self, context):
super(CanvasGetScaleNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')

View file

@ -6,8 +6,7 @@ class CanvasGetSliderNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Slider'
arm_version = 1
def init(self, context):
super(CanvasGetSliderNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmStringSocket', 'Element')
self.add_output('ArmFloatSocket', 'Float')

View file

@ -9,8 +9,7 @@ class CanvasGetVisibleNode(ArmLogicTreeNode):
bl_label = 'Get Canvas Visible'
arm_version = 1
def init(self, context):
super(CanvasGetVisibleNode, self).init(context)
def arm_init(self, context):
self.inputs.new('ArmStringSocket', 'Element')
self.outputs.new('ArmBoolSocket', 'Is Visible')

View file

@ -24,8 +24,7 @@ class OnCanvasElementNode(ArmLogicTreeNode):
('right', 'Right', 'Right mouse button')],
name='Mouse Button', default='left')
def init(self, context):
super(OnCanvasElementNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmStringSocket', 'Element')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -6,8 +6,7 @@ class CanvasSetAssetNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Asset'
arm_version = 1
def init(self, context):
super(CanvasSetAssetNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmStringSocket', 'Asset')

View file

@ -6,8 +6,7 @@ class CanvasSetCheckBoxNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Checkbox'
arm_version = 1
def init(self, context):
super(CanvasSetCheckBoxNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmBoolSocket', 'Check')

View file

@ -6,8 +6,7 @@ class CanvasSetLocationNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Location'
arm_version = 1
def init(self, context):
super(CanvasSetLocationNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmFloatSocket', 'X')

View file

@ -6,8 +6,7 @@ class CanvasSetPBNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Progress Bar'
arm_version = 1
def init(self, context):
super(CanvasSetPBNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmIntSocket', 'At')

View file

@ -6,8 +6,7 @@ class CanvasSetRotationNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Rotation'
arm_version = 1
def init(self, context):
super(CanvasSetRotationNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmFloatSocket', 'Rad')

View file

@ -6,8 +6,7 @@ class CanvasSetScaleNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Scale'
arm_version = 1
def init(self, context):
super(CanvasSetScaleNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmIntSocket', 'Height')

View file

@ -6,8 +6,7 @@ class CanvasSetSliderNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Slider'
arm_version = 1
def init(self, context):
super(CanvasSetSliderNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmFloatSocket', 'Float')

View file

@ -6,8 +6,7 @@ class CanvasSetTextNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Text'
arm_version = 1
def init(self, context):
super(CanvasSetTextNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmStringSocket', 'Text')

View file

@ -6,8 +6,7 @@ class CanvasSetTextColorNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Text Color'
arm_version = 1
def init(self, context):
super(CanvasSetTextColorNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmFloatSocket', 'R')

View file

@ -6,8 +6,7 @@ class CanvasSetVisibleNode(ArmLogicTreeNode):
bl_label = 'Set Canvas Visible'
arm_version = 1
def init(self, context):
super(CanvasSetVisibleNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Element')
self.add_input('ArmBoolSocket', 'Visible')

View file

@ -14,8 +14,7 @@ class GetMouseLockNode(ArmLogicTreeNode):
arm_category = 'Input'
arm_section = 'mouse'
def init(self, context):
super(GetMouseLockNode, self).init(context)
def arm_init(self, context):
self.outputs.new('ArmBoolSocket', 'Is Locked')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):

View file

@ -14,8 +14,7 @@ class GetMouseVisibleNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 2
def init(self, context):
super(GetMouseVisibleNode, self).init(context)
def arm_init(self, context):
self.outputs.new('ArmBoolSocket', 'Is Visible')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):

View file

@ -11,8 +11,7 @@ class MouseCoordsNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 2
def init(self, context):
super(MouseCoordsNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmVectorSocket', 'Coords')
self.add_output('ArmVectorSocket', 'Movement')
self.add_output('ArmIntSocket', 'Wheel')

View file

@ -42,8 +42,7 @@ class OnGamepadNode(ArmLogicTreeNode):
('touchpad', 'touchpad', 'touchpad'),],
name='', default='cross')
def init(self, context):
super(OnGamepadNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
self.add_input('ArmIntSocket', 'Gamepad')

View file

@ -74,8 +74,7 @@ class OnKeyboardNode(ArmLogicTreeNode):
('down', 'down', 'down'),],
name='', default='space')
def init(self, context):
super(OnKeyboardNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):

View file

@ -25,8 +25,7 @@ class OnMouseNode(ArmLogicTreeNode):
('middle', 'middle', 'middle')],
name='', default='left')
def init(self, context):
super(OnMouseNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):

View file

@ -19,8 +19,7 @@ class OnSurfaceNode(ArmLogicTreeNode):
('Moved', 'Moved', 'Moved')],
name='', default='Touched')
def init(self, context):
super(OnSurfaceNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):

View file

@ -19,8 +19,7 @@ class OnVirtualButtonNode(ArmLogicTreeNode):
name='', default='Started')
property1: HaxeStringProperty('property1', name='', default='button')
def init(self, context):
super(OnVirtualButtonNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):

View file

@ -10,8 +10,7 @@ class PauseActionNode(ArmLogicTreeNode):
arm_category = 'Animation'
arm_version = 2
def init(self, context):
super(PauseActionNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -11,8 +11,7 @@ class PauseTilesheetNode(ArmLogicTreeNode):
arm_section = 'tilesheet'
arm_version = 2
def init(self, context):
super(PauseTilesheetNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -10,8 +10,7 @@ class PauseTraitNode(ArmLogicTreeNode):
arm_category = 'Trait'
arm_version = 2
def init(self, context):
super(PauseTraitNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmDynamicSocket', 'Trait')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -10,8 +10,7 @@ class PlayActionNode(ArmLogicTreeNode):
arm_category = 'Animation'
arm_version = 2
def init(self, context):
super(PlayActionNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmNodeSocketAnimAction', 'Action')

View file

@ -10,8 +10,7 @@ class ResumeActionNode(ArmLogicTreeNode):
arm_category = 'Animation'
arm_version = 2
def init(self, context):
super(ResumeActionNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -10,8 +10,7 @@ class ResumeTilesheetNode(ArmLogicTreeNode):
arm_category = 'Animation'
arm_version = 2
def init(self, context):
super(ResumeTilesheetNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -10,8 +10,7 @@ class ResumeTraitNode(ArmLogicTreeNode):
arm_category = 'Trait'
arm_version = 2
def init(self, context):
super(ResumeTraitNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmDynamicSocket', 'Trait')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -11,8 +11,7 @@ class RotateObjectAroundAxisNode(ArmLogicTreeNode):
arm_section = 'rotation'
arm_version = 2
def init(self, context):
super(RotateObjectAroundAxisNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmVectorSocket', 'Axis', default_value=[0, 0, 1])

View file

@ -11,8 +11,7 @@ class ScaleObjectNode(ArmLogicTreeNode):
arm_section = 'scale'
arm_version = 2
def init(self, context):
super(ScaleObjectNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmVectorSocket', 'Scale')

View file

@ -11,8 +11,7 @@ class SetMouseLockNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 2
def init(self, context):
super(SetMouseLockNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmBoolSocket', 'Lock')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -11,8 +11,7 @@ class ShowMouseNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 2
def init(self, context):
super(ShowMouseNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmBoolSocket', 'Show')
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -10,8 +10,7 @@ class SetMaterialNode(ArmLogicTreeNode):
arm_category = 'Material'
arm_version = 2
def init(self, context):
super(SetMaterialNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmNodeSocketObject', 'Object')
self.add_input('ArmDynamicSocket', 'Material')

View file

@ -12,7 +12,6 @@ class SurfaceCoordsNode(ArmLogicTreeNode):
arm_is_obsolete = 'is_obsolete'
arm_version = 2
def init(self, context):
super(SurfaceCoordsNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmVectorSocket', 'Coords')
self.add_output('ArmVectorSocket', 'Movement')

View file

@ -6,8 +6,7 @@ class OnApplicationStateNode(ArmLogicTreeNode):
bl_label = 'On Application State'
arm_version = 1
def init(self, context):
super().init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'On Foreground')
self.add_output('ArmNodeSocketAction', 'On Background')
self.add_output('ArmNodeSocketAction', 'On Shutdown')

View file

@ -12,8 +12,7 @@ class OnEventNode(ArmLogicTreeNode):
property0: HaxeStringProperty('property0', name='', default='')
def init(self, context):
super(OnEventNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):

View file

@ -6,6 +6,5 @@ class OnInitNode(ArmLogicTreeNode):
bl_label = 'On Init'
arm_version = 1
def init(self, context):
super(OnInitNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')

View file

@ -9,8 +9,7 @@ class OnTimerNode(ArmLogicTreeNode):
bl_label = 'On Timer'
arm_version = 1
def init(self, context):
super(OnTimerNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmFloatSocket', 'Duration')
self.add_input('ArmBoolSocket', 'Repeat')

View file

@ -17,8 +17,7 @@ class OnUpdateNode(ArmLogicTreeNode):
('Physics Pre-Update', 'Physics Pre-Update', 'Physics Pre-Update')],
name='On', default='Update')
def init(self, context):
super(OnUpdateNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):

View file

@ -13,8 +13,7 @@ class SendEventNode(ArmLogicTreeNode):
arm_section = 'custom'
arm_version = 1
def init(self, context):
super(SendEventNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Event')
self.add_input('ArmNodeSocketObject', 'Object')

View file

@ -12,8 +12,7 @@ class SendGlobalEventNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'custom'
def init(self, context):
super(SendGlobalEventNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('ArmStringSocket', 'Event')

View file

@ -46,8 +46,7 @@ class GamepadNode(ArmLogicTreeNode):
('touchpad', 'touchpad', 'touchpad'),],
name='', default='cross')
def init(self, context):
super(GamepadNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
self.add_output('ArmBoolSocket', 'State')

View file

@ -11,8 +11,7 @@ class GamepadCoordsNode(ArmLogicTreeNode):
arm_version = 1
arm_section = 'gamepad'
def init(self, context):
super(GamepadCoordsNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmVectorSocket', 'Left Stick')
self.add_output('ArmVectorSocket', 'Right Stick')
self.add_output('ArmVectorSocket', 'Left Movement')

View file

@ -7,8 +7,7 @@ class GetCursorLocationNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 1
def init(self, context):
super(GetCursorLocationNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmIntSocket', 'X')
self.add_output('ArmIntSocket', 'Y')
self.add_output('ArmIntSocket', 'Inverted X')

View file

@ -16,8 +16,7 @@ class GetCursorStateNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 1
def init(self, context):
super(GetCursorStateNode, self).init(context)
def arm_init(self, context):
self.outputs.new('ArmBoolSocket', 'Is Hidden Locked')
self.outputs.new('ArmBoolSocket', 'Is Hidden')
self.outputs.new('ArmBoolSocket', 'Is Locked')

View file

@ -9,8 +9,7 @@ class GetMouseMovementNode(ArmLogicTreeNode):
arm_section = 'mouse'
arm_version = 1
def init(self, context):
super(GetMouseMovementNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmFloatSocket', 'X Multiplier', default_value=-1.0)
self.add_input('ArmFloatSocket', 'Y Multiplier', default_value=-1.0)

View file

@ -7,8 +7,7 @@ class GetTouchLocationNode(ArmLogicTreeNode):
arm_section = 'surface'
arm_version = 1
def init(self, context):
super(GetTouchLocationNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmIntSocket', 'X')
self.add_output('ArmIntSocket', 'Y')
self.add_output('ArmIntSocket', 'Inverted X')

View file

@ -7,8 +7,7 @@ class GetTouchMovementNode(ArmLogicTreeNode):
arm_section = 'surface'
arm_version = 1
def init(self, context):
super(GetTouchMovementNode, self).init(context)
def arm_init(self, context):
self.add_input('ArmFloatSocket', 'X Multiplier', default_value=-1.0)
self.add_input('ArmFloatSocket', 'Y Multiplier', default_value=-1.0)

View file

@ -70,8 +70,7 @@ class KeyboardNode(ArmLogicTreeNode):
('down', 'down', 'down'),],
name='', default='space')
def init(self, context):
super(KeyboardNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
self.add_output('ArmBoolSocket', 'State')

View file

@ -21,8 +21,7 @@ class MouseNode(ArmLogicTreeNode):
('right', 'Right', 'Right mouse button')],
name='', default='left')
def init(self, context):
super(MouseNode, self).init(context)
def arm_init(self, context):
self.add_output('ArmNodeSocketAction', 'Out')
self.add_output('ArmBoolSocket', 'State')

View file

@ -59,8 +59,7 @@ class OnSwipeNode(ArmLogicTreeNode):
super(OnSwipeNode, self).__init__()
array_nodes[str(id(self))] = self
def init(self, context):
super(OnSwipeNode, self).init(context)
def arm_init(self, context):
self.inputs.new('ArmFloatSocket', 'Time')
self.inputs[-1].default_value = 0.15
self.inputs.new('ArmIntSocket', 'Min Length (px)')

Some files were not shown because too many files have changed in this diff Show more