Merge pull request #2221 from QuantumCoderQC/ExtraLogicNodes

Extra logic nodes
This commit is contained in:
Lubos Lenco 2021-06-09 07:38:28 +02:00 committed by GitHub
commit 6c6d7c1419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package armory.logicnode;
class OncePerFrameNode extends LogicNode {
var c = false;
public function new(tree: LogicTree) {
super(tree);
tree.notifyOnUpdate(update);
}
override function run(from: Int) {
if(c) {
c = false;
runOutput(0);
}
}
function update() {
c = true;
}
}

View file

@ -0,0 +1,16 @@
from arm.logicnode.arm_nodes import *
class OncePerFrameNode(ArmLogicTreeNode):
"""Activates the output only once per frame if receives one or more inputs in that frame
If there is no input, there will be no output"""
bl_idname = 'LNOncePerFrameNode'
bl_label = 'Once Per Frame'
arm_section = 'flow'
arm_version = 1
def init(self, context):
super(OncePerFrameNode, self).init(context)
self.add_input('ArmNodeSocketAction', 'In')
self.add_output('ArmNodeSocketAction', 'Out')