armory/blender/arm/logicnode/material/LN_material.py
2021-07-03 19:45:05 +02:00

29 lines
879 B
Python

import bpy
import arm.utils
from arm.logicnode.arm_nodes import *
class MaterialNode(ArmLogicTreeNode):
"""Stores the given material as a variable."""
bl_idname = 'LNMaterialNode'
bl_label = 'Material'
arm_version = 1
@property
def property0_get(self):
if self.property0 == None:
return ''
if self.property0.name not in bpy.data.materials:
return self.property0.name
return arm.utils.asset_name(bpy.data.materials[self.property0.name])
property0: HaxePointerProperty('property0', name='', type=bpy.types.Material)
def init(self, context):
super(MaterialNode, self).init(context)
self.add_output('NodeSocketShader', 'Material', is_var=True)
def draw_buttons(self, context, layout):
layout.prop_search(self, 'property0', bpy.data, 'materials', icon='NONE', text='')