2017-04-08 00:34:45 +02:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class GetChildNode(ArmLogicTreeNode):
|
2020-10-05 19:55:56 +02:00
|
|
|
"""Returns the child of the given object by the child object's name."""
|
2017-04-08 00:34:45 +02:00
|
|
|
bl_idname = 'LNGetChildNode'
|
2020-09-25 00:49:21 +02:00
|
|
|
bl_label = 'Get Object Child'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2018-12-18 23:48:38 +01:00
|
|
|
property0: EnumProperty(
|
2018-07-04 12:29:41 +02:00
|
|
|
items = [('By Name', 'By Name', 'By Name'),
|
|
|
|
('Contains', 'Contains', 'Contains'),
|
|
|
|
('Starts With', 'Starts With', 'Starts With'),
|
|
|
|
('Ends With', 'Ends With', 'Ends With'),
|
|
|
|
],
|
|
|
|
name='', default='By Name')
|
2020-09-08 17:03:24 +02:00
|
|
|
|
2017-04-08 00:34:45 +02:00
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(GetChildNode, self).init(context)
|
2020-09-20 20:10:01 +02:00
|
|
|
self.add_input('ArmNodeSocketObject', 'Parent')
|
|
|
|
self.add_input('NodeSocketString', 'Child Name')
|
|
|
|
self.add_output('ArmNodeSocketObject', 'Child')
|
2017-04-08 00:34:45 +02:00
|
|
|
|
2018-07-04 12:29:41 +02:00
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.prop(self, 'property0')
|
|
|
|
|
2020-09-09 20:48:35 +02:00
|
|
|
add_node(GetChildNode, category=PKG_AS_CATEGORY, section='relations')
|