forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class GetMaterialNode(LnxLogicTreeNode):
|
||||
"""Returns the material of the given object."""
|
||||
bl_idname = 'LNGetMaterialNode'
|
||||
bl_label = 'Get Object Material'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxIntSocket', 'Slot')
|
||||
|
||||
self.add_output('LnxDynamicSocket', 'Material')
|
@ -0,0 +1,13 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class GetMaterialsNode(LnxLogicTreeNode):
|
||||
"""Returns the materials of the given object."""
|
||||
bl_idname = 'LNGetMaterialsNode'
|
||||
bl_label = 'Get Object Materials'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
|
||||
self.add_output('LnxNodeSocketArray', 'Materials')
|
||||
self.add_output('LnxIntSocket', 'Length')
|
30
leenkx/blender/lnx/logicnode/material/LN_material.py
Normal file
30
leenkx/blender/lnx/logicnode/material/LN_material.py
Normal file
@ -0,0 +1,30 @@
|
||||
import bpy
|
||||
|
||||
import lnx.utils
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class MaterialNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
|
||||
"""Stores the given material as a variable."""
|
||||
bl_idname = 'LNMaterialNode'
|
||||
bl_label = 'Material'
|
||||
lnx_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 lnx.utils.asset_name(bpy.data.materials[self.property0.name])
|
||||
|
||||
property0: HaxePointerProperty('property0', name='', type=bpy.types.Material)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_output('LnxDynamicSocket', 'Material', is_var=True)
|
||||
|
||||
def draw_content(self, context, layout):
|
||||
layout.prop_search(self, 'property0', bpy.data, 'materials', icon='NONE', text='')
|
||||
|
||||
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
|
||||
self.property0 = master_node.property0
|
@ -0,0 +1,42 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetMaterialImageParamNode(LnxLogicTreeNode):
|
||||
"""Set an image value material parameter to the specified object.
|
||||
|
||||
@seeNode Get Scene Root
|
||||
|
||||
@input Object: Object whose material parameter should change. Use `Get Scene Root` node to set parameter globally.
|
||||
|
||||
@input Per Object:
|
||||
- `Enabled`: Set material parameter specific to this object. Global parameter will be ignored.
|
||||
- `Disabled`: Set parameter globally, including this object.
|
||||
|
||||
@input Material: Material whose parameter to be set.
|
||||
|
||||
@input Node: Name of the parameter.
|
||||
|
||||
@input Image: Name of the image.
|
||||
"""
|
||||
bl_idname = 'LNSetMaterialImageParamNode'
|
||||
bl_label = 'Set Material Image Param'
|
||||
lnx_section = 'params'
|
||||
lnx_version = 2
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxBoolSocket', 'Per Object')
|
||||
self.add_input('LnxDynamicSocket', 'Material')
|
||||
self.add_input('LnxStringSocket', 'Node')
|
||||
self.add_input('LnxStringSocket', 'Image')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement(
|
||||
'LNSetMaterialImageParamNode', self.lnx_version, 'LNSetMaterialImageParamNode', 2,
|
||||
in_socket_mapping={0:0, 1:3, 2:4, 3:5}, out_socket_mapping={0:0}
|
||||
)
|
@ -0,0 +1,42 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetMaterialRgbParamNode(LnxLogicTreeNode):
|
||||
"""Set a color or vector value material parameter to the specified object.
|
||||
|
||||
@seeNode Get Scene Root
|
||||
|
||||
@input Object: Object whose material parameter should change. Use `Get Scene Root` node to set parameter globally.
|
||||
|
||||
@input Per Object:
|
||||
- `Enabled`: Set material parameter specific to this object. Global parameter will be ignored.
|
||||
- `Disabled`: Set parameter globally, including this object.
|
||||
|
||||
@input Material: Material whose parameter to be set.
|
||||
|
||||
@input Node: Name of the parameter.
|
||||
|
||||
@input Color: Color or vector input.
|
||||
"""
|
||||
bl_idname = 'LNSetMaterialRgbParamNode'
|
||||
bl_label = 'Set Material RGB Param'
|
||||
lnx_section = 'params'
|
||||
lnx_version = 2
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxBoolSocket', 'Per Object')
|
||||
self.add_input('LnxDynamicSocket', 'Material')
|
||||
self.add_input('LnxStringSocket', 'Node')
|
||||
self.add_input('LnxColorSocket', 'Color')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement(
|
||||
'LNSetMaterialRgbParamNode', self.lnx_version, 'LNSetMaterialRgbParamNode', 2,
|
||||
in_socket_mapping={0:0, 1:3, 2:4, 3:5}, out_socket_mapping={0:0}
|
||||
)
|
@ -0,0 +1,43 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetMaterialValueParamNode(LnxLogicTreeNode):
|
||||
"""Set a float value material parameter to the specified object.
|
||||
|
||||
@seeNode Get Scene Root
|
||||
|
||||
@input Object: Object whose material parameter should change. Use `Get Scene Root` node to set parameter globally.
|
||||
|
||||
@input Per Object:
|
||||
- `Enabled`: Set material parameter specific to this object. Global parameter will be ignored.
|
||||
- `Disabled`: Set parameter globally, including this object.
|
||||
|
||||
@input Material: Material whose parameter to be set.
|
||||
|
||||
@input Node: Name of the parameter.
|
||||
|
||||
@input Float: float value.
|
||||
"""
|
||||
bl_idname = 'LNSetMaterialValueParamNode'
|
||||
bl_label = 'Set Material Value Param'
|
||||
lnx_section = 'params'
|
||||
lnx_version = 2
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxBoolSocket', 'Per Object')
|
||||
self.add_input('LnxDynamicSocket', 'Material')
|
||||
self.add_input('LnxStringSocket', 'Node')
|
||||
self.add_input('LnxFloatSocket', 'Float')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if self.lnx_version not in (0, 1):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement(
|
||||
'LNSetMaterialValueParamNode', self.lnx_version, 'LNSetMaterialValueParamNode', 2,
|
||||
in_socket_mapping={0:0, 1:3, 2:4, 3:5}, out_socket_mapping={0:0}
|
||||
)
|
@ -0,0 +1,15 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetMaterialSlotNode(LnxLogicTreeNode):
|
||||
"""TO DO."""
|
||||
bl_idname = 'LNSetMaterialSlotNode'
|
||||
bl_label = 'Set Object Material Slot'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Object')
|
||||
self.add_input('LnxDynamicSocket', 'Material')
|
||||
self.add_input('LnxIntSocket', 'Slot')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
4
leenkx/blender/lnx/logicnode/material/__init__.py
Normal file
4
leenkx/blender/lnx/logicnode/material/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
from lnx.logicnode.lnx_nodes import add_node_section
|
||||
|
||||
add_node_section(name='default', category='Material')
|
||||
add_node_section(name='params', category='Material')
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user