2020-09-03 18:53:19 +02:00
|
|
|
import bpy
|
2020-09-08 23:21:41 +02:00
|
|
|
|
2020-09-03 18:53:19 +02:00
|
|
|
from arm.logicnode.arm_nodes import *
|
|
|
|
|
|
|
|
|
2020-09-08 21:16:20 +02:00
|
|
|
class SpawnCollectionNode(ArmLogicTreeNode):
|
2020-09-28 15:58:41 +02:00
|
|
|
"""
|
2020-10-27 19:44:37 +01:00
|
|
|
Spawns a new instance of the selected collection. Each spawned instance
|
|
|
|
has an empty owner object to control the instance as a whole (like Blender
|
2020-10-05 19:55:56 +02:00
|
|
|
uses it for collection instances).
|
2020-09-28 15:58:41 +02:00
|
|
|
|
|
|
|
@input In: activates the node.
|
|
|
|
@input Transform: the transformation of the instance that should be
|
|
|
|
spawned. Please note that the collection's instance offset is
|
|
|
|
also taken into account.
|
|
|
|
|
|
|
|
@output Out: activated when a collection instance was spawned. It is
|
|
|
|
not activated when no collection is selected.
|
|
|
|
@output Top-Level Objects: all objects in the last spawned
|
|
|
|
collection that are direct children of the owner object of the
|
|
|
|
collection's instance.
|
|
|
|
@output All Objects: all objects in the last spawned collection.
|
|
|
|
@output Owner Object: The owning object of the last spawned
|
|
|
|
collection's instance.
|
|
|
|
"""
|
2020-09-03 18:53:19 +02:00
|
|
|
bl_idname = 'LNSpawnCollectionNode'
|
|
|
|
bl_label = 'Spawn Collection'
|
2020-10-27 19:44:37 +01:00
|
|
|
arm_section = 'collection'
|
2020-09-13 11:27:58 +02:00
|
|
|
arm_version = 1
|
2020-09-03 18:53:19 +02:00
|
|
|
|
|
|
|
property0: PointerProperty(name='Collection', type=bpy.types.Collection)
|
|
|
|
|
|
|
|
def init(self, context):
|
2020-09-13 11:27:58 +02:00
|
|
|
super(SpawnCollectionNode, self).init(context)
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_input('ArmNodeSocketAction', 'In')
|
|
|
|
self.add_input('NodeSocketShader', 'Transform')
|
2020-09-03 18:53:19 +02:00
|
|
|
|
2020-09-08 21:49:02 +02:00
|
|
|
self.add_output('ArmNodeSocketAction', 'Out')
|
|
|
|
self.add_output('ArmNodeSocketArray', 'Top-Level Objects')
|
|
|
|
self.add_output('ArmNodeSocketArray', 'All Objects')
|
|
|
|
self.add_output('ArmNodeSocketObject', 'Owner Object')
|
2020-09-03 18:53:19 +02:00
|
|
|
|
|
|
|
def draw_buttons(self, context, layout):
|
|
|
|
layout.prop_search(self, 'property0', bpy.data, 'collections', icon='NONE', text='')
|