Add Group node
This commit is contained in:
parent
0b049eb5af
commit
830140f086
24
Sources/armory/logicnode/ArrayRemoveValueNode.hx
Normal file
24
Sources/armory/logicnode/ArrayRemoveValueNode.hx
Normal file
|
@ -0,0 +1,24 @@
|
|||
package armory.logicnode;
|
||||
|
||||
class ArrayRemoveValueNode extends LogicNode {
|
||||
|
||||
var removedValue:Dynamic = null;
|
||||
|
||||
public function new(tree:LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
override function run() {
|
||||
var ar:Array<Dynamic> = inputs[1].get();
|
||||
var val:Dynamic = inputs[2].get();
|
||||
|
||||
removedValue = val;
|
||||
ar.remove(val);
|
||||
|
||||
runOutputs(0);
|
||||
}
|
||||
|
||||
override function get(from:Int):Dynamic {
|
||||
return removedValue;
|
||||
}
|
||||
}
|
17
Sources/armory/logicnode/GroupNode.hx
Normal file
17
Sources/armory/logicnode/GroupNode.hx
Normal file
|
@ -0,0 +1,17 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.Scene;
|
||||
import iron.object.Object;
|
||||
|
||||
class GroupNode extends LogicNode {
|
||||
|
||||
public var property0:String;
|
||||
|
||||
public function new(tree:LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
override function get(from:Int):Dynamic {
|
||||
return Scene.active.groups.get(property0);
|
||||
}
|
||||
}
|
19
blender/arm/logicnode/array_remove_value.py
Normal file
19
blender/arm/logicnode/array_remove_value.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class ArrayRemoveValueNode(Node, ArmLogicTreeNode):
|
||||
'''Array remove value node'''
|
||||
bl_idname = 'LNArrayRemoveValueNode'
|
||||
bl_label = 'Array Remove Value'
|
||||
bl_icon = 'GAME'
|
||||
|
||||
def init(self, context):
|
||||
self.inputs.new('ArmNodeSocketAction', 'In')
|
||||
self.inputs.new('NodeSocketShader', 'Array')
|
||||
self.inputs.new('NodeSocketShader', 'Value')
|
||||
self.outputs.new('ArmNodeSocketAction', 'Out')
|
||||
self.outputs.new('NodeSocketShader', 'Value')
|
||||
|
||||
add_node(ArrayRemoveValueNode, category='Array')
|
20
blender/arm/logicnode/variable_group.py
Normal file
20
blender/arm/logicnode/variable_group.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class GroupNode(Node, ArmLogicTreeNode):
|
||||
'''Group node'''
|
||||
bl_idname = 'LNGroupNode'
|
||||
bl_label = 'Group'
|
||||
bl_icon = 'GAME'
|
||||
|
||||
property0 = StringProperty(name='', default='')
|
||||
|
||||
def init(self, context):
|
||||
self.outputs.new('NodeSocketShader', 'Array')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop_search(self, 'property0', bpy.data, 'groups', icon='NONE', text='')
|
||||
|
||||
add_node(GroupNode, category='Variable')
|
Loading…
Reference in a new issue