Upload files to "leenkx/blender/lnx/logicnode/particle"

This commit is contained in:
Onek8 2025-05-22 21:36:22 +00:00
parent 0b5bb877fb
commit c3c89c320b
5 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,41 @@
from lnx.logicnode.lnx_nodes import *
class AddParticleToObjectNode(LnxLogicTreeNode):
"""Sets the speed of the given particle source."""
bl_idname = 'LNAddParticleToObjectNode'
bl_label = 'Add Particle To Object'
lnx_version = 1
def remove_extra_inputs(self, context):
while len(self.inputs) > 1:
self.inputs.remove(self.inputs[-1])
if self.property0 == 'Scene':
self.add_input('LnxStringSocket', 'Scene From Name')
self.add_input('LnxStringSocket', 'Object From Name')
else:
self.add_input('LnxNodeSocketObject', 'Object From')
self.add_input('LnxIntSocket', 'Slot')
self.add_input('LnxNodeSocketObject', 'Object To')
self.add_input('LnxBoolSocket', 'Render Emitter', default_value = True)
property0: HaxeEnumProperty(
'property0',
items = [('Scene Active', 'Scene Active', 'Scene Active'),
('Scene', 'Scene', 'Scene')],
name='', default='Scene Active', update=remove_extra_inputs)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object From')
self.add_input('LnxIntSocket', 'Slot')
self.add_input('LnxNodeSocketObject', 'Object To')
self.add_input('LnxBoolSocket', 'Render Emitter', default_value = True)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,14 @@
from lnx.logicnode.lnx_nodes import *
class GetParticleNode(LnxLogicTreeNode):
"""Returns the Particle Systems of an object."""
bl_idname = 'LNGetParticleNode'
bl_label = 'Get Particle'
lnx_version = 1
def lnx_init(self, context):
self.inputs.new('LnxNodeSocketObject', 'Object')
self.outputs.new('LnxNodeSocketArray', 'Names')
self.outputs.new('LnxIntSocket', 'Length')
self.outputs.new('LnxBoolSocket', 'Render Emitter')

View File

@ -0,0 +1,31 @@
from lnx.logicnode.lnx_nodes import *
class GetParticleDataNode(LnxLogicTreeNode):
"""Returns the data of the given Particle System."""
bl_idname = 'LNGetParticleDataNode'
bl_label = 'Get Particle Data'
lnx_version = 1
def lnx_init(self, context):
self.inputs.new('LnxNodeSocketObject', 'Object')
self.inputs.new('LnxIntSocket', 'Slot')
self.outputs.new('LnxStringSocket', 'Name')
self.outputs.new('LnxFloatSocket', 'Particle Size')
self.outputs.new('LnxIntSocket', 'Frame Start')
self.outputs.new('LnxIntSocket', 'Frame End')
self.outputs.new('LnxIntSocket', 'Lifetime')
self.outputs.new('LnxFloatSocket', 'Lifetime Random')
self.outputs.new('LnxIntSocket', 'Emit From')
self.outputs.new('LnxVectorSocket', 'Velocity')
self.outputs.new('LnxFloatSocket', 'Velocity Random')
self.outputs.new('LnxVectorSocket', 'Gravity')
self.outputs.new('LnxFloatSocket', 'Weight Gravity')
self.outputs.new('LnxFloatSocket', 'Speed')
self.outputs.new('LnxFloatSocket', 'Time')
self.outputs.new('LnxFloatSocket', 'Lap')
self.outputs.new('LnxFloatSocket', 'Lap Time')
self.outputs.new('LnxIntSocket', 'Count')

View File

@ -0,0 +1,33 @@
from lnx.logicnode.lnx_nodes import *
class RemoveParticleFromObjectNode(LnxLogicTreeNode):
"""Remove Particle From Object."""
bl_idname = 'LNRemoveParticleFromObjectNode'
bl_label = 'Remove Particle From Object'
lnx_version = 1
def remove_extra_inputs(self, context):
while len(self.inputs) > 2:
self.inputs.remove(self.inputs[-1])
if self.property0 == 'Slot':
self.add_input('LnxIntSocket', 'Slot')
if self.property0 == 'Name':
self.add_input('LnxStringSocket', 'Name')
property0: HaxeEnumProperty(
'property0',
items = [('Slot', 'Slot', 'Slot'),
('Name', 'Name', 'Name'),
('All', 'All', 'All')],
name='', default='Slot', update=remove_extra_inputs)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxIntSocket', 'Slot')
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')

View File

@ -0,0 +1,58 @@
from lnx.logicnode.lnx_nodes import *
class SetParticleDataNode(LnxLogicTreeNode):
"""Sets the parameters of the given particle system."""
bl_idname = 'LNSetParticleDataNode'
bl_label = 'Set Particle Data'
lnx_version = 1
def remove_extra_inputs(self, context):
while len(self.inputs) > 3:
self.inputs.remove(self.inputs[-1])
if self.property0 == 'Particle Size':
self.add_input('LnxFloatSocket', 'Particle Size')
if self.property0 == 'Frame End':
self.add_input('LnxIntSocket', 'Frame End')
if self.property0 == 'Frame Start':
self.add_input('LnxIntSocket', 'Frame Start')
if self.property0 == 'Lifetime':
self.add_input('LnxIntSocket', 'Lifetime')
if self.property0 == 'Lifetime Random':
self.add_input('LnxFloatSocket', 'Lifetime Random')
if self.property0 == 'Emit From':
self.add_input('LnxIntSocket', 'Emit From')
if self.property0 == 'Velocity':
self.add_input('LnxVectorSocket', 'Velocity')
if self.property0 == 'Velocity Random':
self.add_input('LnxFloatSocket', 'Velocity Random')
if self.property0 == 'Weight Gravity':
self.add_input('LnxFloatSocket', 'Weight Gravity')
if self.property0 == 'Speed':
self.add_input('LnxFloatSocket', 'Speed')
property0: HaxeEnumProperty(
'property0',
items = [('Particle Size', 'Particle Size', 'for the system'),
('Frame Start', 'Frame Start', 'for the system'),
('Frame End', 'Frame End', 'for the system'),
('Lifetime', 'Lifetime', 'for the instance'),
('Lifetime Random', 'Lifetime Random', 'for the system'),
('Emit From', 'Emit From', 'for the system (Vertices:0 Faces:1 Volume: 2)'),
('Velocity', 'Velocity', 'for the instance'),
('Velocity Random', 'Velocity Random', 'for the system'),
('Weight Gravity', 'Weight Gravity', 'for the instance'),
('Speed', 'Speed', 'for the instance')],
name='', default='Speed', update=remove_extra_inputs)
def lnx_init(self, context):
self.add_input('LnxNodeSocketAction', 'In')
self.add_input('LnxNodeSocketObject', 'Object')
self.add_input('LnxIntSocket', 'Slot')
self.add_input('LnxFloatSocket', 'Speed', default_value=1.0)
self.add_output('LnxNodeSocketAction', 'Out')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')