Merge pull request #2221 from QuantumCoderQC/ExtraLogicNodes
Extra logic nodes
This commit is contained in:
commit
6c6d7c1419
22
Sources/armory/logicnode/OncePerFrameNode.hx
Normal file
22
Sources/armory/logicnode/OncePerFrameNode.hx
Normal 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;
|
||||
}
|
||||
}
|
16
blender/arm/logicnode/logic/LN_once_per_frame.py
Normal file
16
blender/arm/logicnode/logic/LN_once_per_frame.py
Normal 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')
|
Loading…
Reference in a new issue