Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class GetDistanceNode(LnxLogicTreeNode):
"""Returns the euclidian distance between the two given objects.
@see For distance between two locations, use the `Distance` operator
in the *[`Vector Math`](#vector-math)* node."""
bl_idname = 'LNGetDistanceNode'
bl_label = 'Get Distance'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxFloatSocket', 'Distance')

View File

@ -0,0 +1,16 @@
import bpy
from lnx.logicnode.lnx_nodes import *
class GetObjectNode(LnxLogicTreeNode):
"""Searches for a object that uses the given name in the current active scene and returns it."""
bl_idname = 'LNGetObjectNode'
bl_label = 'Get Object by Name'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxStringSocket', 'Name')
self.add_output('LnxNodeSocketObject', 'Object')

View File

@ -0,0 +1,16 @@
import bpy
from lnx.logicnode.lnx_nodes import *
class GetObjectByUidNode(LnxLogicTreeNode):
"""Searches for a object with this uid in the current active scene and returns it."""
bl_idname = 'LNGetObjectByUidNode'
bl_label = 'Get Object By Uid'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxIntSocket', 'Uid')
self.add_output('LnxNodeSocketObject', 'Object')

View File

@ -0,0 +1,26 @@
from lnx.logicnode.lnx_nodes import *
class GetChildNode(LnxLogicTreeNode):
"""Returns the child of the given object by the child object's name."""
bl_idname = 'LNGetChildNode'
bl_label = 'Get Object Child'
lnx_section = 'relations'
lnx_version = 1
property0: HaxeEnumProperty(
'property0',
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')
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Parent')
self.add_input('LnxStringSocket', 'Child Name')
self.add_output('LnxNodeSocketObject', 'Child')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class GetChildrenNode(LnxLogicTreeNode):
"""Returns the children of the given object."""
bl_idname = 'LNGetChildrenNode'
bl_label = 'Get Object Children'
lnx_section = 'relations'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Parent')
self.add_output('LnxNodeSocketArray', 'Children')

View File

@ -0,0 +1,32 @@
from lnx.logicnode.lnx_nodes import *
class GetObjectGeomNode(LnxLogicTreeNode):
"""Returns the vertex geometry info of the given object and the vertex groups info.
@input Object: object geometry to retrieve.
@output Vertices Positions: an array with the vertices positions.
@output Vertices Normals: an array with vertices normals directions.
@output Vertices Indices: an array with vertices indices.
@output Vertices Material Indices: an array with material indices per vertex.
@output Vertices Vertices Face Indices: an array with face index per vertex.
@output Vertex Groups Maps: maps with vertex group names and vertices positions.
@output Vertex Groups Names: an array with the names of the vertex gruops.
"""
bl_idname = 'LNGetObjectGeomNode'
bl_label = 'Get Object Geometry Node'
lnx_section = 'relations'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxNodeSocketArray', 'Vertices Positions')
self.add_output('LnxNodeSocketArray', 'Vertices Normals')
self.add_output('LnxNodeSocketArray', 'Vertices Indices')
self.add_output('LnxNodeSocketArray', 'Vertices Material Indices')
self.add_output('LnxNodeSocketArray', 'Vertices Face Indices')
self.add_output('LnxDynamicSocket', 'Vertex Groups Maps')
self.add_output('LnxNodeSocketArray', 'Vertex Groups Names')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class GetMeshNode(LnxLogicTreeNode):
"""Returns the mesh of the given object."""
bl_idname = 'LNGetMeshNode'
bl_label = 'Get Object Mesh'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxDynamicSocket', 'Mesh')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class GetNameNode(LnxLogicTreeNode):
"""Returns the name of the given object."""
bl_idname = 'LNGetNameNode'
bl_label = 'Get Object Name'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxStringSocket', 'Name')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class GetObjectOffscreenNode(LnxLogicTreeNode):
"""Returns if the given object is offscreen. Don't works if culling is disabled."""
bl_idname = 'LNGetObjectOffscreenNode'
bl_label = 'Get Object Offscreen'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.inputs.new('LnxNodeSocketObject', 'Object')
self.outputs.new('LnxBoolSocket', 'Is Object Offscreen')
self.outputs.new('LnxBoolSocket', 'Is Mesh Offscreen')
self.outputs.new('LnxBoolSocket', 'Is Shadow Offscreen')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class GetParentNode(LnxLogicTreeNode):
"""Returns the direct parent (nearest in the hierarchy) of the given object.
@seeNode Set Object Parent"""
bl_idname = 'LNGetParentNode'
bl_label = 'Get Object Parent'
lnx_section = 'relations'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Child')
self.add_output('LnxNodeSocketObject', 'Parent')

View File

@ -0,0 +1,29 @@
from lnx.logicnode.lnx_nodes import *
class GetPropertyNode(LnxLogicTreeNode):
"""Return the value of the given object property. If the object is `null`
or the property does not exist on the object, the node returns `null`.
@input Object: The object to which the property belongs.
@input Property: The name of the property from which to get the value.
@output Value: The value of the property.
@output Property: The name of the property as stated in the `Property` input.
@see `Object Properties Panel > Leenkx Props > Properties` (do not confuse Leenkx object properties with Blender custom properties!)
@see [`iron.object.Object.properties`](https://api.leenkx.com/iron/object/Object.html#properties)
@seeNode Set Object Property
"""
bl_idname = 'LNGetPropertyNode'
bl_label = 'Get Object Property'
lnx_version = 1
lnx_section = 'props'
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxStringSocket', 'Property')
self.add_output('LnxDynamicSocket', 'Value')
self.add_output('LnxStringSocket', 'Property')

View File

@ -0,0 +1,13 @@
from lnx.logicnode.lnx_nodes import *
class GetUidNode(LnxLogicTreeNode):
"""Returns the uid of the given object."""
bl_idname = 'LNGetUidNode'
bl_label = 'Get Object Uid'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxIntSocket', 'Uid')

View File

@ -0,0 +1,18 @@
from lnx.logicnode.lnx_nodes import *
class GetVisibleNode(LnxLogicTreeNode):
"""Returns whether the given object or its visual components are
visible.
@seeNode Set Object Visible"""
bl_idname = 'LNGetVisibleNode'
bl_label = 'Get Object Visible'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object')
self.add_output('LnxBoolSocket', 'Is Object Visible')
self.add_output('LnxBoolSocket', 'Is Mesh Visible')
self.add_output('LnxBoolSocket', 'Is Shadow Visible')

View File

@ -0,0 +1,18 @@
import bpy
from lnx.logicnode.lnx_nodes import *
class MeshNode(LnxLogicTreeNode):
"""Stores the given mesh as a variable."""
bl_idname = 'LNMeshNode'
bl_label = 'Mesh'
lnx_version = 1
property0_get: HaxePointerProperty('property0_get', name='', type=bpy.types.Mesh)
def lnx_init(self, context):
self.add_output('LnxDynamicSocket', 'Mesh', is_var=True)
def draw_buttons(self, context, layout):
layout.prop_search(self, 'property0_get', bpy.data, 'meshes', icon='NONE', text='')

View File

@ -0,0 +1,27 @@
from lnx.logicnode.lnx_nodes import *
class ObjectNode(LnxLogicVariableNodeMixin, LnxLogicTreeNode):
"""Stores the given object as a variable."""
bl_idname = 'LNObjectNode'
bl_label = 'Object'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketObject', 'Object In')
self.add_output('LnxNodeSocketObject', 'Object Out', is_var=True)
def draw_label(self) -> str:
inp_object = self.inputs['Object In']
if inp_object.is_linked:
return super().draw_label()
obj_name = inp_object.get_default_value()
if obj_name == '':
obj_name = '_self'
return f'{super().draw_label()}: {obj_name}'
def synchronize_from_master(self, master_node: LnxLogicVariableNodeMixin):
self.inputs[0].default_value_raw = master_node.inputs[0].default_value_raw

View File

@ -0,0 +1,21 @@
from lnx.logicnode.lnx_nodes import *
class RaycastClosestObjectNode(LnxLogicTreeNode):
"""it takes an objects array and returns true of false if at least one of those objects is touched at screen (x, y), the object that is touched and the (x,y, z) position of that touch if returned"""
bl_idname = 'LNRaycastClosestObjectNode'
bl_label = 'Raycast Closest Object'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Obj Array')
self.add_input('LnxFloatSocket', 'X')
self.add_input('LnxFloatSocket', 'Y')
self.add_input('LnxNodeSocketObject', 'Camera')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketAction', 'True')
self.add_output('LnxNodeSocketAction', 'False')
self.add_output('LnxNodeSocketObject', 'Object')
self.add_output('LnxVectorSocket', 'Location')

View File

@ -0,0 +1,21 @@
from lnx.logicnode.lnx_nodes import *
class RaycastObjectNode(LnxLogicTreeNode):
"""it takes an object and returns true or false if the object is touched at screen (x, y) and the (x,y, z) position of that touch if returned"""
bl_idname = 'LNRaycastObjectNode'
bl_label = 'Raycast Object'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxFloatSocket', 'X')
self.add_input('LnxFloatSocket', 'Y')
self.add_input('LnxNodeSocketObject', 'Camera')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketAction', 'True')
self.add_output('LnxNodeSocketAction', 'False')
self.add_output('LnxVectorSocket', 'Location')

View File

@ -0,0 +1,34 @@
from lnx.logicnode.lnx_nodes import *
class RaycastRayNode(LnxLogicTreeNode):
"""Cast a Ray (Origin and direction) to return the name, location and distance of the closest object
in the object arrays
@input Obj Array: Objects to detect.
@input Origin: ray origin.
@input Direction: ray direction.
@output True: if an object is detected.
@output False: if none object is detected.
@output Object: close object detected.
@output Location: the position where the ray comes in contact with the ray.
@output Distance: distance from origin to location.
"""
bl_idname = 'LNRaycastRayNode'
bl_label = 'Raycast Ray'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketArray', 'Obj Array')
self.add_input('LnxVectorSocket', 'Origin')
self.add_input('LnxVectorSocket', 'Direction')
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketAction', 'True')
self.add_output('LnxNodeSocketAction', 'False')
self.add_output('LnxNodeSocketObject', 'Object')
self.add_output('LnxVectorSocket', 'Location')
self.add_output('LnxFloatSocket', 'Distance')

View File

@ -0,0 +1,26 @@
from lnx.logicnode.lnx_nodes import *
class RemoveObjectNode(LnxLogicTreeNode):
"""This node will remove a scene object or a scene object and its children.
@input Object: Scene object to remove.
@input Remove Children: Remove scene object's children too.
@input Keep Children Transforms: Scene object's children will maintain current transforms when the scene object is removed, else children transforms revert to scene origin transforms.
"""
bl_idname = 'LNRemoveObjectNode'
bl_label = 'Remove Object'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxBoolSocket', 'Remove Children', default_value=True)
self.add_input('LnxBoolSocket', 'Keep Children Transforms', default_value=True)
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.Identity(self)

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class ClearParentNode(LnxLogicTreeNode):
"""Removes the parent of the given object."""
bl_idname = 'LNClearParentNode'
bl_label = 'Remove Object Parent'
lnx_section = 'relations'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxBoolSocket', 'Keep Transform', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,10 @@
from lnx.logicnode.lnx_nodes import *
class SelfObjectNode(LnxLogicTreeNode):
"""Returns the object that owns the trait."""
bl_idname = 'LNSelfNode'
bl_label = 'Self Object'
lnx_version = 1
def lnx_init(self, context):
self.add_output('LnxNodeSocketObject', 'Object')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class SetMeshNode(LnxLogicTreeNode):
"""Sets the mesh of the given object."""
bl_idname = 'LNSetMeshNode'
bl_label = 'Set Object Mesh'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxDynamicSocket', 'Mesh')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,15 @@
from lnx.logicnode.lnx_nodes import *
class SetNameNode(LnxLogicTreeNode):
"""Sets the name of the given object."""
bl_idname = 'LNSetNameNode'
bl_label = 'Set Object Name'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxStringSocket', 'Name')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,32 @@
from lnx.logicnode.lnx_nodes import *
class SetParentNode(LnxLogicTreeNode):
"""Sets the direct parent (nearest in the hierarchy) of the given object.
@input Object: Object to be parented.
@input Parent: New parent object. Use `Get Scene Root` node to unparent object.
@input Keep Transform: Keep transform after unparenting from old parent
@input Parent Inverse: Preserve object transform after parenting to new object.
@seeNode Get Object Parent"""
bl_idname = 'LNSetParentNode'
bl_label = 'Set Object Parent'
lnx_section = 'relations'
lnx_version = 2
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxNodeSocketObject', 'Parent')
self.add_input('LnxBoolSocket', 'Keep Transform', default_value = True)
self.add_input('LnxBoolSocket', 'Parent Inverse')
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(
'LNSetParentNode', self.lnx_version, 'LNSetParentNode', 2,
in_socket_mapping={0:0, 1:1, 2:2}, out_socket_mapping={0:0}
)

View File

@ -0,0 +1,32 @@
from lnx.logicnode.lnx_nodes import *
class SetPropertyNode(LnxLogicTreeNode):
"""Set the value of the given object property.
This node can be used to share variables between different traits.
If the trait(s) you want to access the variable with are on
different objects, use the *[`Global Object`](#global-object)*
node to store the data. Every trait can access this one.
@input Object: The object to which the property belongs. If the object is `null`, the node does not do anything.
@input Property: The name of the property from which to get the value.
@input Value: The value of the property.
@see `Object Properties Panel > Leenkx Props > Properties` (do not confuse Leenkx object properties with Blender custom properties!)
@see [`iron.object.Object.properties`](https://api.leenkx.com/iron/object/Object.html#properties)
@seeNode Get Object Property
"""
bl_idname = 'LNSetPropertyNode'
bl_label = 'Set Object Property'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxStringSocket', 'Property')
self.add_input('LnxDynamicSocket', 'Value')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,16 @@
from lnx.logicnode.lnx_nodes import *
class SetObjectShapeKeyNode(LnxLogicTreeNode):
"""Sets shape key value of the object"""
bl_idname = 'LNSetObjectShapeKeyNode'
bl_label = 'Set Object Shape Key'
lnx_section = 'props'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxStringSocket', 'Shape Key')
self.add_input('LnxFloatSocket', 'Value')
self.add_output('LnxNodeSocketAction', 'Out')

View File

@ -0,0 +1,44 @@
from lnx.logicnode.lnx_nodes import *
class SetVisibleNode(LnxLogicTreeNode):
"""Sets whether the given object is visible.
@input Object: Object whose property to be set.
@input Visible: Visibility.
@input Children: Set the visibility of the children too. Visibility is set only to the immediate children.
@input Recursive: If enabled, visibility of all the children in the tree is set. Ignored if `Children` is disabled.
@seeNode Get Object Visible"""
bl_idname = 'LNSetVisibleNode'
bl_label = 'Set Object Visible'
lnx_section = 'props'
lnx_version = 2
property0: HaxeEnumProperty(
'property0',
items = [('object', 'Object', 'All object componenets visibility'),
('mesh', 'Mesh', 'Mesh visibility only'),
('shadow', 'Shadow', 'Shadow visibility only'),
],
name='', default='object')
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxBoolSocket', 'Visible')
self.add_input('LnxBoolSocket', 'Children', default_value=True)
self.add_input('LnxBoolSocket', 'Recursive', default_value=False)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
if self.lnx_version not in (0, 1):
raise LookupError()
return NodeReplacement.Identity(self)

View File

@ -0,0 +1,17 @@
from lnx.logicnode.lnx_nodes import *
class SpawnObjectNode(LnxLogicTreeNode):
"""Spawns the given object if present in the current active scene. The spawned object has the same name of its instance, but they are treated as different objects."""
bl_idname = 'LNSpawnObjectNode'
bl_label = 'Spawn Object'
lnx_version = 1
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxDynamicSocket', 'Transform')
self.add_input('LnxBoolSocket', 'Children', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketObject', 'Object')

View File

@ -0,0 +1,24 @@
from lnx.logicnode.lnx_nodes import *
class SpawnObjectByNameNode(LnxLogicTreeNode):
"""Spawns an object bearing the given name, even if not present in the active scene"""
bl_idname = 'LNSpawnObjectByNameNode'
bl_label = 'Spawn Object By Name'
lnx_version = 1
property0: HaxePointerProperty(
'property0',
type=bpy.types.Scene, name='Scene',
description='The scene from which to take the object')
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxStringSocket', 'Name')
self.add_input('LnxDynamicSocket', 'Transform')
self.add_input('LnxBoolSocket', 'Children', default_value=True)
self.add_output('LnxNodeSocketAction', 'Out')
self.add_output('LnxNodeSocketObject', 'Object')
def draw_buttons(self, context, layout):
layout.prop_search(self, 'property0', bpy.data, "scenes")

View File

@ -0,0 +1,5 @@
from lnx.logicnode.lnx_nodes import add_node_section
add_node_section(name='default', category='Object')
add_node_section(name='props', category='Object')
add_node_section(name='relations', category='Object')