27 lines
782 B
Python
27 lines
782 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()
|
||
|
|
||
|
property0_ = StringProperty(name='Text', default='')
|
||
|
|
||
|
def init(self, context):
|
||
|
self.inputs.new('ArmNodeSocketOperator', 'In')
|
||
|
self.outputs.new('ArmNodeSocketOperator', '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')
|