commit
97d964318f
|
@ -5,7 +5,7 @@ from arm.logicnode.arm_nodes import *
|
|||
|
||||
class GamepadNode(Node, ArmLogicTreeNode):
|
||||
'''Gamepad node'''
|
||||
bl_idname = 'LNGamepadNode'
|
||||
bl_idname = 'LNMergedGamepadNode'
|
||||
bl_label = 'Gamepad'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
|
||||
|
|
49
blender/arm/logicnode/input_gamepad_deprecated.py
Normal file
49
blender/arm/logicnode/input_gamepad_deprecated.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class GamepadNode(Node, ArmLogicTreeNode):
|
||||
'''Gamepad node'''
|
||||
bl_idname = 'LNGamepadNode'
|
||||
bl_label = 'Gamepad State (deprecated)'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
|
||||
property0: EnumProperty(
|
||||
items = [('Down', 'Down', 'Down'),
|
||||
('Started', 'Started', 'Started'),
|
||||
('Released', 'Released', 'Released')],
|
||||
# ('Moved Left', 'Moved Left', 'Moved Left'),
|
||||
# ('Moved Right', 'Moved Right', 'Moved Right'),],
|
||||
name='', default='Started')
|
||||
|
||||
property1: EnumProperty(
|
||||
items = [('cross', 'cross / a', 'cross / a'),
|
||||
('circle', 'circle / b', 'circle / b'),
|
||||
('square', 'square / x', 'square / x'),
|
||||
('triangle', 'triangle / y', 'triangle / y'),
|
||||
('l1', 'l1 / lb', 'l1 / lb'),
|
||||
('r1', 'r1 / rb', 'r1 / rb'),
|
||||
('l2', 'l2 / lt', 'l2 / lt'),
|
||||
('r2', 'r2 / rt', 'r2 / rt'),
|
||||
('share', 'share', 'share'),
|
||||
('options', 'options', 'options'),
|
||||
('l3', 'l3', 'l3'),
|
||||
('r3', 'r3', 'r3'),
|
||||
('up', 'up', 'up'),
|
||||
('down', 'down', 'down'),
|
||||
('left', 'left', 'left'),
|
||||
('right', 'right', 'right'),
|
||||
('home', 'home', 'home'),
|
||||
('touchpad', 'touchpad', 'touchpad'),],
|
||||
name='', default='cross')
|
||||
|
||||
def init(self, context):
|
||||
self.outputs.new('NodeSocketBool', 'State')
|
||||
self.inputs.new('NodeSocketInt', 'Gamepad')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
layout.prop(self, 'property1')
|
||||
|
||||
add_node(GamepadNode, category='Input')
|
|
@ -5,7 +5,7 @@ from arm.logicnode.arm_nodes import *
|
|||
|
||||
class KeyboardNode(Node, ArmLogicTreeNode):
|
||||
'''Keyboard node'''
|
||||
bl_idname = 'LNKeyboardNode'
|
||||
bl_idname = 'LNMergedKeyboardNode'
|
||||
bl_label = 'Keyboard'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
|
||||
|
|
80
blender/arm/logicnode/input_keyboard_deprecated.py
Normal file
80
blender/arm/logicnode/input_keyboard_deprecated.py
Normal file
|
@ -0,0 +1,80 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class KeyboardNode(Node, ArmLogicTreeNode):
|
||||
'''Keyboard node'''
|
||||
bl_idname = 'LNKeyboardNode'
|
||||
bl_label = 'Keyboard State (deprecated)'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
|
||||
property0: EnumProperty(
|
||||
items = [('Down', 'Down', 'Down'),
|
||||
('Started', 'Started', 'Started'),
|
||||
('Released', 'Released', 'Released')],
|
||||
name='', default='Started')
|
||||
|
||||
property1: EnumProperty(
|
||||
items = [('a', 'a', 'a'),
|
||||
('b', 'b', 'b'),
|
||||
('c', 'c', 'c'),
|
||||
('d', 'd', 'd'),
|
||||
('e', 'e', 'e'),
|
||||
('f', 'f', 'f'),
|
||||
('g', 'g', 'g'),
|
||||
('h', 'h', 'h'),
|
||||
('i', 'i', 'i'),
|
||||
('j', 'j', 'j'),
|
||||
('k', 'k', 'k'),
|
||||
('l', 'l', 'l'),
|
||||
('m', 'm', 'm'),
|
||||
('n', 'n', 'n'),
|
||||
('o', 'o', 'o'),
|
||||
('p', 'p', 'p'),
|
||||
('q', 'q', 'q'),
|
||||
('r', 'r', 'r'),
|
||||
('s', 's', 's'),
|
||||
('t', 't', 't'),
|
||||
('u', 'u', 'u'),
|
||||
('v', 'v', 'v'),
|
||||
('w', 'w', 'w'),
|
||||
('x', 'x', 'x'),
|
||||
('y', 'y', 'y'),
|
||||
('z', 'z', 'z'),
|
||||
('0', '0', '0'),
|
||||
('1', '1', '1'),
|
||||
('2', '2', '2'),
|
||||
('3', '3', '3'),
|
||||
('4', '4', '4'),
|
||||
('5', '5', '5'),
|
||||
('6', '6', '6'),
|
||||
('7', '7', '7'),
|
||||
('8', '8', '8'),
|
||||
('9', '9', '9'),
|
||||
('.', '.', '.'),
|
||||
(',', ',', ','),
|
||||
('space', 'space', 'space'),
|
||||
('backspace', 'backspace', 'backspace'),
|
||||
('tab', 'tab', 'tab'),
|
||||
('return', 'return', 'return'),
|
||||
('shift', 'shift', 'shift'),
|
||||
('control', 'control', 'control'),
|
||||
('alt', 'alt', 'alt'),
|
||||
('escape', 'escape', 'escape'),
|
||||
('delete', 'delete', 'delete'),
|
||||
('back', 'back', 'back'),
|
||||
('up', 'up', 'up'),
|
||||
('right', 'right', 'right'),
|
||||
('left', 'left', 'left'),
|
||||
('down', 'down', 'down'),],
|
||||
name='', default='space')
|
||||
|
||||
def init(self, context):
|
||||
self.outputs.new('NodeSocketBool', 'State')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
layout.prop(self, 'property1')
|
||||
|
||||
add_node(KeyboardNode, category='Input')
|
|
@ -5,7 +5,7 @@ from arm.logicnode.arm_nodes import *
|
|||
|
||||
class MouseNode(Node, ArmLogicTreeNode):
|
||||
'''Mouse node'''
|
||||
bl_idname = 'LNMouseNode'
|
||||
bl_idname = 'LNMergedMouseNode'
|
||||
bl_label = 'Mouse'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
property0: EnumProperty(
|
||||
|
|
30
blender/arm/logicnode/input_mouse_deprecated.py
Normal file
30
blender/arm/logicnode/input_mouse_deprecated.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class MouseNode(Node, ArmLogicTreeNode):
|
||||
'''Mouse node'''
|
||||
bl_idname = 'LNMouseNode'
|
||||
bl_label = 'Mouse State (deprecated)'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
property0: EnumProperty(
|
||||
items = [('Down', 'Down', 'Down'),
|
||||
('Started', 'Started', 'Started'),
|
||||
('Released', 'Released', 'Released'),
|
||||
('Moved', 'Moved', 'Moved')],
|
||||
name='', default='Down')
|
||||
property1: EnumProperty(
|
||||
items = [('left', 'left', 'left'),
|
||||
('right', 'right', 'right'),
|
||||
('middle', 'middle', 'middle')],
|
||||
name='', default='left')
|
||||
|
||||
def init(self, context):
|
||||
self.outputs.new('NodeSocketBool', 'State')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
layout.prop(self, 'property1')
|
||||
|
||||
add_node(MouseNode, category='Input')
|
|
@ -5,7 +5,7 @@ from arm.logicnode.arm_nodes import *
|
|||
|
||||
class SurfaceNode(Node, ArmLogicTreeNode):
|
||||
'''Surface node'''
|
||||
bl_idname = 'LNSurfaceNode'
|
||||
bl_idname = 'LNMergedSurfaceNode'
|
||||
bl_label = 'Surface'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
property0: EnumProperty(
|
||||
|
|
24
blender/arm/logicnode/input_surface_deprecated.py
Normal file
24
blender/arm/logicnode/input_surface_deprecated.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class SurfaceNode(Node, ArmLogicTreeNode):
|
||||
'''Surface node'''
|
||||
bl_idname = 'LNSurfaceNode'
|
||||
bl_label = 'Surface State (deprecated)'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
property0: EnumProperty(
|
||||
items = [('Touched', 'Touched', 'Touched'),
|
||||
('Started', 'Started', 'Started'),
|
||||
('Released', 'Released', 'Released'),
|
||||
('Moved', 'Moved', 'Moved')],
|
||||
name='', default='Touched')
|
||||
|
||||
def init(self, context):
|
||||
self.outputs.new('NodeSocketBool', 'State')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
|
||||
add_node(SurfaceNode, category='Input')
|
|
@ -5,7 +5,7 @@ from arm.logicnode.arm_nodes import *
|
|||
|
||||
class VirtualButtonNode(Node, ArmLogicTreeNode):
|
||||
'''Virtual button node'''
|
||||
bl_idname = 'LNVirtualButtonNode'
|
||||
bl_idname = 'LNMergedVirtualButtonNode'
|
||||
bl_label = 'Virtual Button'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
property0: EnumProperty(
|
||||
|
|
25
blender/arm/logicnode/input_virtual_button_deprecated.py
Normal file
25
blender/arm/logicnode/input_virtual_button_deprecated.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class VirtualButtonNode(Node, ArmLogicTreeNode):
|
||||
'''Virtual button node'''
|
||||
bl_idname = 'LNVirtualButtonNode'
|
||||
bl_label = 'Virtual Button State (deprecated)'
|
||||
bl_icon = 'CURVE_PATH'
|
||||
property0: EnumProperty(
|
||||
items = [('Down', 'Down', 'Down'),
|
||||
('Started', 'Started', 'Started'),
|
||||
('Released', 'Released', 'Released')],
|
||||
name='', default='Started')
|
||||
property1: StringProperty(name='', default='button')
|
||||
|
||||
def init(self, context):
|
||||
self.outputs.new('NodeSocketBool', 'State')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
layout.prop(self, 'property1')
|
||||
|
||||
add_node(VirtualButtonNode, category='Input')
|
|
@ -163,25 +163,44 @@ def replace(tree, node):
|
|||
tree.links.new(newnode.inputs[replacement.in_socket_mapping.get(i)], link.from_socket)
|
||||
tree.nodes.remove(node)
|
||||
|
||||
|
||||
def replaceAll():
|
||||
for tree in bpy.data.node_groups:
|
||||
if tree.bl_idname == "ArmLogicTreeType":
|
||||
for node in tree.nodes:
|
||||
if node.bl_idname in get_replaced_nodes():
|
||||
print("Replacing "+ node.bl_idname+ " in Tree "+tree.name)
|
||||
replace(tree, node)
|
||||
|
||||
|
||||
class ReplaceNodesOperator(bpy.types.Operator):
|
||||
'''Automatically replaces deprecated nodes.'''
|
||||
bl_idname = "node.replace"
|
||||
bl_label = "Replace Nodes"
|
||||
|
||||
def execute(self, context):
|
||||
for tree in bpy.data.node_groups:
|
||||
if tree.bl_idname == "ArmLogicTreeType":
|
||||
for node in tree.nodes:
|
||||
if node.bl_idname in get_replaced_nodes():
|
||||
print("Replacing "+ node.bl_idname+ " in Tree "+tree.name)
|
||||
replace(tree, node)
|
||||
replaceAll()
|
||||
return {'FINISHED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.space_data != None and context.space_data.type == 'NODE_EDITOR'
|
||||
|
||||
# Input Replacement Rules
|
||||
add_replacement(Replacement("LNOnGamepadNode", "LNMergedGamepadNode", {}, {0: 0}))
|
||||
add_replacement(Replacement("LNGamepadNode", "LNMergedGamepadNode", {}, {0: 1}))
|
||||
|
||||
add_replacement(Replacement("LNOnMouseNode", "LNMergedMouseNode", {}, {0: 0}))
|
||||
add_replacement(Replacement("LNMouseNode", "LNMergedMouseNode", {}, {0: 1}))
|
||||
|
||||
add_replacement(Replacement("LNOnSurfaceNode", "LNMergedSurfaceNode", {}, {0: 0}))
|
||||
add_replacement(Replacement("LNSurfaceNode", "LNMergedSurfaceNode", {}, {0: 1}))
|
||||
|
||||
add_replacement(Replacement("LNOnKeyboardNode", "LNMergedKeyboardNode", {}, {0: 0}))
|
||||
add_replacement(Replacement("LNKeyboardNode", "LNMergedKeyboardNode", {}, {0: 1}))
|
||||
|
||||
add_replacement(Replacement("LNOnVirtualButtonNode", "LNMergedVirtualButtonNode", {}, {0: 0}))
|
||||
add_replacement(Replacement("LNVirtualButtonNode", "LNMergedVirtualButtonNode", {}, {0: 1}))
|
||||
|
||||
def register():
|
||||
bpy.utils.register_class(ArmLogicTree)
|
||||
bpy.utils.register_class(ARM_PT_LogicNodePanel)
|
||||
|
|
|
@ -9,6 +9,7 @@ import arm.utils
|
|||
import arm.make
|
||||
import arm.props_renderpath as props_renderpath
|
||||
import arm.proxy
|
||||
import arm.nodes_logic
|
||||
|
||||
# Armory version
|
||||
arm_version = '0.7'
|
||||
|
@ -298,6 +299,7 @@ def init_properties_on_load():
|
|||
init_properties()
|
||||
arm.utils.fetch_script_names()
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
arm.nodes_logic.replaceAll()
|
||||
# Outdated project
|
||||
if bpy.data.filepath != '' and (wrd.arm_version != arm_version or wrd.arm_commit != arm_commit): # Call on project load only
|
||||
# This allows for seamless migration from ealier versions of Armory
|
||||
|
|
Loading…
Reference in a new issue