2017-04-04 23:11:31 +02:00
|
|
|
import bpy
|
2020-09-08 23:21:41 +02:00
|
|
|
|
2017-04-04 23:11:31 +02:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 23:21:41 +02:00
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class GetObjectNode(ArmLogicTreeNode):
|
2020-10-05 19:55:56 +02:00
|
|
|
"""Search for the given object by its name and returns it."""
|
2017-04-04 23:11:31 +02:00
|
|
|
bl_idname = 'LNGetObjectNode'
|
|
|
|
bl_label = 'Get Object'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2017-04-04 23:11:31 +02:00
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
property0: PointerProperty(
|
|
|
|
type=bpy.types.Scene, name='Scene',
|
|
|
|
description='The scene from which to take the object')
|
|
|
|
|
2017-04-04 23:11:31 +02:00
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(GetObjectNode, self).init(context)
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('NodeSocketString', 'Name')
|
|
|
|
self.add_output('ArmNodeSocketObject', 'Object')
|
2017-04-04 23:11:31 +02:00
|
|
|
|
2020-09-08 17:03:24 +02:00
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.prop_search(self, 'property0', bpy.data, "scenes")
|
|
|
|
|
2020-09-09 20:48:35 +02:00
|
|
|
add_node(GetObjectNode, category=PKG_AS_CATEGORY)
|