28 lines
879 B
Python
28 lines
879 B
Python
import bpy
|
|
from bpy.props import *
|
|
from bpy.types import Node, NodeSocket
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
class ScriptNode(Node, ArmLogicTreeNode):
|
|
'''Script node'''
|
|
bl_idname = 'LNScriptNode'
|
|
bl_label = 'Script'
|
|
bl_icon = 'GAME'
|
|
|
|
@property
|
|
def property0(self):
|
|
return bpy.data.texts[self.property0_].as_string() if self.property0_ in bpy.data.texts else ''
|
|
|
|
|
|
property0_ = StringProperty(name='Text', default='')
|
|
|
|
def init(self, context):
|
|
self.inputs.new('ArmNodeSocketAction', 'In')
|
|
self.inputs.new('ArmNodeSocketArray', 'Array')
|
|
self.outputs.new('ArmNodeSocketAction', 'Out')
|
|
self.outputs.new('NodeSocketShader', 'Result')
|
|
|
|
def draw_buttons(self, context, layout):
|
|
layout.prop_search(self, 'property0_', bpy.data, 'texts', icon='NONE', text='')
|
|
|
|
add_node(ScriptNode, category='Native')
|