Hi,
I am unable to get a Trait associated with the scene using the GetTrait node. Looking at the code it seems that the Node actually does not support this?
Any comments?
Best regards
blackno666
Hi,
I am unable to get a Trait associated with the scene using the GetTrait node. Looking at the code it seems that the Node actually does not support this?
Any comments?
Best regards
blackno666
@blackno666 the GetTrait needs from you to pass a value that is an object and maybe you can’t assign a trait directly to a scene.
If you create an empty in your scene, assign to it a trait and then make the Get Trait using this empty name, then it’s like to get a trait associated with the scene or a collection.
Maybe can help you to look here Communication between objects, it’s the principe used to call Methods in Class and take advantage of the possibilities of objects, collections and scene with Get Trait to implement an object-oriented design.
Thanks, Didier.
You can actually assign Traits to a scene. I wrote an own logic node “GetSceneTrait.hx (499 Bytes)” to solve the issue. I attach it.
For it to work you need a “blender.py” file which I cannot attach due to the not supported file extension. More information on creating custom nodes can be found here: https://armory3d.org/manual/#/dev/logicnodes
from bpy.types import Node
from arm.logicnode.arm_nodes import *
import arm.nodes_logic
class GetSceneTrait(Node, ArmLogicTreeNode):
'''GetSceneTrait node'''
bl_idname = 'LNGetSceneTrait'
bl_label = 'Get Scene Trait'
bl_icon = 'QUESTION'
def init(self, context):
self.inputs.new('NodeSocketString', 'Name')
self.outputs.new('NodeSocketShader', 'Trait')
def register():
# Add custom nodes
add_node(GetSceneTrait, category='Value')
# Register newly added nodes
arm.nodes_logic.register_nodes()
It works, but i must remove def register(): line