Merge pull request #403 from guzzard/logicnodes-camera-fov

Get/Set CameraObject FOV logic nodes
This commit is contained in:
Lubos Lenco 2017-12-06 22:31:45 +01:00 committed by GitHub
commit 9d912bec8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 74 additions and 0 deletions

View file

@ -0,0 +1,18 @@
package armory.logicnode;
import iron.object.CameraObject;
class GetCameraFovNode extends LogicNode {
public function new(tree:LogicTree) {
super(tree);
}
override function get(from:Int):Dynamic {
var camera:CameraObject = inputs[0].get();
if (camera == null) return 0.0;
return camera.data.raw.fov;
}
}

View file

@ -0,0 +1,22 @@
package armory.logicnode;
import iron.object.CameraObject;
class SetCameraFovNode extends LogicNode {
public function new(tree:LogicTree) {
super(tree);
}
override function run() {
var camera:CameraObject = inputs[1].get();
var fov:Float = inputs[2].get();
if (camera == null) return;
camera.data.raw.fov = fov;
camera.buildProjection();
super.run();
}
}

View file

@ -0,0 +1,18 @@
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class SetCameraFovNode(Node, ArmLogicTreeNode):
'''Set camera FOV node'''
bl_idname = 'LNSetCameraFovNode'
bl_label = 'Set Camera FOV'
bl_icon = 'GAME'
def init(self, context):
self.inputs.new('ArmNodeSocketAction', 'In')
self.inputs.new('ArmNodeSocketObject', 'Object')
self.inputs.new('NodeSocketFloat', 'FOV')
self.outputs.new('ArmNodeSocketAction', 'Out')
add_node(SetCameraFovNode, category='Action')

View file

@ -0,0 +1,16 @@
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class GetCameraFovNode(Node, ArmLogicTreeNode):
'''Get camera FOV node'''
bl_idname = 'LNGetCameraFovNode'
bl_label = 'Get Camera FOV'
bl_icon = 'GAME'
def init(self, context):
self.inputs.new('ArmNodeSocketObject', 'Object')
self.outputs.new('NodeSocketFloat', 'FOV')
add_node(GetCameraFovNode, category='Value')