Merge pull request #1963 from E1e5en/ln-get-fps
Add LN Get Frames Per Second
This commit is contained in:
commit
7d7b6a3ed5
19
Sources/armory/logicnode/GetFPSNode.hx
Normal file
19
Sources/armory/logicnode/GetFPSNode.hx
Normal 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;
|
||||
}
|
||||
}
|
11
blender/arm/logicnode/miscellaneous/LN_get_fps.py
Normal file
11
blender/arm/logicnode/miscellaneous/LN_get_fps.py
Normal 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')
|
Loading…
Reference in a new issue