Add a Set Camera Node

This commit is contained in:
Zicklag 2018-11-10 13:39:51 -06:00
parent fb5cdcd636
commit 7d91654d05
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,21 @@
package armory.logicnode;
import iron.Scene;
import iron.object.CameraObject;
class SetCameraNode extends LogicNode {
public function new(tree:LogicTree) {
super(tree);
}
override function run(from:Int) {
var camera:CameraObject = inputs[1].get();
if (camera == null) return;
camera.buildProjection();
iron.Scene.active.camera = camera;
runOutput(0);
}
}

View file

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