Scene root and global object node

This commit is contained in:
Lubos Lenco 2017-11-08 19:37:26 +01:00
parent 7233bb2d87
commit 1503714145
6 changed files with 56 additions and 34 deletions

View file

@ -0,0 +1,12 @@
package armory.logicnode;
class GlobalObjectNode extends LogicNode {
public function new(tree:LogicTree) {
super(tree);
}
override function get(from:Int):Dynamic {
return iron.Scene.global;
}
}

View file

@ -0,0 +1,14 @@
package armory.logicnode;
import armory.Scene;
class SceneRootNode extends LogicNode {
public function new(tree:LogicTree) {
super(tree);
}
override function get(from:Int):Dynamic {
return iron.Scene.active.root;
}
}

View file

@ -1,22 +0,0 @@
package armory.logicnode;
import armory.object.Object;
import armory.system.Event;
class SendGlobalEventNode extends LogicNode {
var entries:Array<TEvent> = null;
public function new(tree:LogicTree) {
super(tree);
}
override function run() {
var name:String = inputs[1].get();
if (entries == null) entries = armory.system.Event.get(name);
for (e in entries) e.onEvent();
super.run();
}
}

View file

@ -0,0 +1,15 @@
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class GlobalObjectNode(Node, ArmLogicTreeNode):
'''Global object node'''
bl_idname = 'LNGlobalObjectNode'
bl_label = 'Global Object'
bl_icon = 'GAME'
def init(self, context):
self.outputs.new('ArmNodeSocketObject', 'Object')
add_node(GlobalObjectNode, category='Variable')

View file

@ -0,0 +1,15 @@
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class SceneRootNode(Node, ArmLogicTreeNode):
'''Scene root node'''
bl_idname = 'LNSceneRootNode'
bl_label = 'Scene Root'
bl_icon = 'GAME'
def init(self, context):
self.outputs.new('ArmNodeSocketObject', 'Object')
add_node(SceneRootNode, category='Variable')

View file

@ -487,16 +487,6 @@ class ArmVirtualInputPanel(bpy.types.Panel):
def draw(self, context):
layout = self.layout
class ArmGlobalVarsPanel(bpy.types.Panel):
bl_label = "Armory Global Variables"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "render"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
class ArmNavigationPanel(bpy.types.Panel):
bl_label = "Armory Navigation"
bl_space_type = "PROPERTIES"
@ -1395,7 +1385,6 @@ def register():
bpy.utils.register_class(ArmRenderPathPanel)
bpy.utils.register_class(ArmRenderPropsPanel)
# bpy.utils.register_class(ArmVirtualInputPanel)
# bpy.utils.register_class(ArmGlobalVarsPanel)
bpy.utils.register_class(ArmoryPlayButton)
bpy.utils.register_class(ArmoryPlayInViewportButton)
bpy.utils.register_class(ArmoryStopButton)
@ -1448,7 +1437,6 @@ def unregister():
bpy.utils.unregister_class(ArmRenderPathPanel)
bpy.utils.unregister_class(ArmRenderPropsPanel)
# bpy.utils.unregister_class(ArmVirtualInputPanel)
# bpy.utils.unregister_class(ArmGlobalVarsPanel)
bpy.utils.unregister_class(ArmoryPlayButton)
bpy.utils.unregister_class(ArmoryPlayInViewportButton)
bpy.utils.unregister_class(ArmoryStopButton)