Merge pull request #1963 from E1e5en/ln-get-fps

Add LN Get Frames Per Second
This commit is contained in:
Lubos Lenco 2020-10-28 10:44:25 +01:00 committed by GitHub
commit 7d7b6a3ed5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,19 @@
package armory.logicnode;
class GetFPSNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
if (from == 0) {
var fps = Math.round(1 / iron.system.Time.realDelta);
if ((fps == Math.POSITIVE_INFINITY) || (fps == Math.NEGATIVE_INFINITY) || (Math.isNaN(fps))) {
return 0;
}
return fps;
}
return null;
}
}

View file

@ -0,0 +1,11 @@
from arm.logicnode.arm_nodes import *
class GetFPSNode(ArmLogicTreeNode):
"""Get the frames per second count."""
bl_idname = 'LNGetFPSNode'
bl_label = 'Get Frames Per Second'
arm_version = 1
def init(self, context):
super(GetFPSNode, self).init(context)
self.add_output('NodeSocketInt', 'Count')