Add Remove Input Map Key node

This commit is contained in:
Henrique 2021-07-07 17:08:01 -03:00
parent 43a574eb15
commit daee309ad8
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,23 @@
package armory.logicnode;
import armory.system.InputMap;
class RemoveInputMapKeyNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
var inputMap = inputs[1].get();
var key = inputs[2].get();
var k = InputMap.getInputMapKey(inputMap, key);
if (k != null) {
if (InputMap.getInputMap(inputMap).removeInput(k)) {
runOutput(0);
}
}
}
}

View file

@ -0,0 +1,15 @@
from arm.logicnode.arm_nodes import *
class RemoveInputMapKeyNode(ArmLogicTreeNode):
"""Remove input map key."""
bl_idname = 'LNRemoveInputMapKeyNode'
bl_label = 'Remove Input Map Key'
arm_version = 1
def init(self, context):
super(RemoveInputMapKeyNode, self).init(context)
self.add_input('ArmNodeSocketAction', 'In')
self.add_input('NodeSocketString', 'Input Map')
self.add_input('NodeSocketString', 'Key')
self.add_output('ArmNodeSocketAction', 'Out')