forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
16
leenkx/blender/lnx/logicnode/math/LN_colors_mix.py
Normal file
16
leenkx/blender/lnx/logicnode/math/LN_colors_mix.py
Normal file
@ -0,0 +1,16 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class ColorsMixNode(LnxLogicTreeNode):
|
||||
"""
|
||||
@see https://github.com/rvanwijnen/spectral.js 2023 Ronald van Wijnen.
|
||||
"""
|
||||
|
||||
bl_idname = 'LNColorsMixNode'
|
||||
bl_label = 'Colors Mix'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketArray', 'Colors')
|
||||
self.add_input('LnxNodeSocketArray', 'Factors')
|
||||
|
||||
self.add_output('LnxColorSocket', 'Color')
|
||||
@ -38,7 +38,10 @@ class MathNode(LnxLogicTreeNode):
|
||||
'Modulo': 2,
|
||||
'Less Than': 2,
|
||||
'Greater Than': 2,
|
||||
'Ping-Pong': 2
|
||||
'Ping-Pong': 2,
|
||||
'Hyperbolic Sine': 1,
|
||||
'Hyperbolic Cosine': 1,
|
||||
'Hyperbolic Tangent': 1
|
||||
}.get(operation_name, 0)
|
||||
|
||||
def get_enum(self):
|
||||
@ -97,7 +100,10 @@ class MathNode(LnxLogicTreeNode):
|
||||
('Fract', 'Fract', 'Fract'),
|
||||
('Square Root', 'Square Root', 'Square Root'),
|
||||
('Exponent', 'Exponent', 'Exponent'),
|
||||
('Ping-Pong', 'Ping-Pong', 'The output value is moved between 0.0 and the Scale based on the input value')],
|
||||
('Ping-Pong', 'Ping-Pong', 'The output value is moved between 0.0 and the Scale based on the input value'),
|
||||
('Hyperbolic Sine', 'Hyperbolic Sine', 'Hyperbolic Sine'),
|
||||
('Hyperbolic Cosine', 'Hyperbolic Cosine', 'Hyperbolic Cosine'),
|
||||
('Hyperbolic Tangent', 'Hyperbolic Tangent', 'Hyperbolic Tangent')],
|
||||
name='', default='Add', set=set_enum, get=get_enum)
|
||||
|
||||
property1: HaxeBoolProperty('property1', name='Clamp', default=False)
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class MatrixMathNode(LnxLogicTreeNode):
|
||||
"""Multiplies matrices."""
|
||||
bl_idname = 'LNMatrixMathNode'
|
||||
bl_label = 'Matrix Math'
|
||||
lnx_section = 'matrix'
|
||||
lnx_version = 1
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items = [('Multiply', 'Multiply', 'Multiply')],
|
||||
name='', default='Multiply')
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxDynamicSocket', 'Matrix 1')
|
||||
self.add_input('LnxDynamicSocket', 'Matrix 2')
|
||||
|
||||
self.add_output('LnxDynamicSocket', 'Result')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
54
leenkx/blender/lnx/logicnode/math/LN_poisson_disk.py
Normal file
54
leenkx/blender/lnx/logicnode/math/LN_poisson_disk.py
Normal file
@ -0,0 +1,54 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class PoissonDiskNode(LnxLogicTreeNode):
|
||||
"""
|
||||
Generates an array of points with a poisson distribution.
|
||||
|
||||
SampleCube (Sample Rectangle):
|
||||
topLeft: Minimum bounding corner position.
|
||||
lowerRight: Maximum bounding corner position.
|
||||
minimumDistance: Minimum required spatial distance between points.
|
||||
pointsPerIteration: Candidate sample attempts per active point before rejection.
|
||||
|
||||
SampleSphere (Sample Circle):
|
||||
center: Sphere center position vector.
|
||||
radius: Bounding sphere radius.
|
||||
minimumDistance: Minimum required spatial distance between points.
|
||||
pointsPerIteration: Candidate sample attempts per active point before rejection.
|
||||
"""
|
||||
bl_idname = 'LNPoissonDiskNode'
|
||||
bl_label = 'Poisson Disk Sampling'
|
||||
lnx_section = 'generator'
|
||||
lnx_version = 1
|
||||
|
||||
def remove_extra_inputs(self, context):
|
||||
while len(self.inputs) > 3:
|
||||
self.inputs.remove(self.inputs[-1])
|
||||
if self.property0 in ('Sample Cube', 'Sample Rectangle'):
|
||||
self.add_input('LnxVectorSocket', 'Top Left')
|
||||
self.add_input('LnxVectorSocket', 'Lower Right')
|
||||
else:
|
||||
self.add_input('LnxVectorSocket', 'Center')
|
||||
self.add_input('LnxFloatSocket', 'Radius')
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items = [('Sample Cube', 'Sample Cube', 'Sample Cube'),
|
||||
('Sample Sphere', 'Sample Sphere', 'Sample Sphere'),
|
||||
('Sample Rectangle', 'Sample Rectangle', 'Sample Rectangle'),
|
||||
('Sample Circle', 'Sample Circle', 'Sample Circle')],
|
||||
name='', default='Sample Cube', update=remove_extra_inputs)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxIntSocket', 'Points Per Iteration')
|
||||
self.add_input('LnxFloatSocket', 'Minimum Distance')
|
||||
self.add_input('LnxVectorSocket', 'Top Left')
|
||||
self.add_input('LnxVectorSocket', 'Lower Right')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxNodeSocketArray', 'Points')
|
||||
self.add_output('LnxIntSocket', 'Length')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
71
leenkx/blender/lnx/logicnode/math/LN_procedural_noise.py
Normal file
71
leenkx/blender/lnx/logicnode/math/LN_procedural_noise.py
Normal file
@ -0,0 +1,71 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class ProceduralNoiseNode(LnxLogicTreeNode):
|
||||
"""
|
||||
Generates different kind of noises values.
|
||||
|
||||
repeat: Periodicity interval for seamless tiling. -1 disables repeating.
|
||||
|
||||
Perlin:
|
||||
x: Spatial X coordinate.
|
||||
y: Spatial Y coordinate.
|
||||
z: Spatial Z coordinate.
|
||||
|
||||
OctavePerlin:
|
||||
x, y, z: Spatial coordinates.
|
||||
octaves: Number of noise layers combined.
|
||||
persistence: Amplitude multiplier per octave (decay factor).
|
||||
frequency: Base spatial scaling factor.
|
||||
|
||||
DiamondSquare:
|
||||
width: Total grid width.
|
||||
height: Total grid height.
|
||||
featureSize: Initial step size for grid subdivision.
|
||||
scale: Random offset amplitude scale factor.
|
||||
randFunc: Random number generator function returning a Float.
|
||||
"""
|
||||
bl_idname = 'LNProceduralNoiseNode'
|
||||
bl_label = 'Procedural Noise'
|
||||
lnx_section = 'generator'
|
||||
lnx_version = 1
|
||||
|
||||
def remove_extra_inputs(self, context):
|
||||
while len(self.inputs) > 1:
|
||||
self.inputs.remove(self.inputs[-1])
|
||||
if self.property0 in ('Perlin', 'Octave Perlin'):
|
||||
self.add_input('LnxFloatSocket', 'X')
|
||||
self.add_input('LnxFloatSocket', 'Y')
|
||||
self.add_input('LnxFloatSocket', 'Z')
|
||||
self.add_input('LnxIntSocket', 'Repeat', default_value = -1)
|
||||
if self.property0 == 'Octave Perlin':
|
||||
self.add_input('LnxIntSocket', 'Octaves', default_value = 4)
|
||||
self.add_input('LnxFloatSocket', 'Persistence', default_value = 0.5)
|
||||
self.add_input('LnxFloatSocket', 'Frequency', default_value = 1.0)
|
||||
if self.property0 == 'Diamond Square':
|
||||
self.add_input('LnxIntSocket', 'X')
|
||||
self.add_input('LnxIntSocket', 'Y')
|
||||
self.add_input('LnxIntSocket', 'Width', default_value = 3)
|
||||
self.add_input('LnxIntSocket', 'Height', default_value = 3)
|
||||
self.add_input('LnxIntSocket', 'Feature Size', default_value = 2)
|
||||
self.add_input('LnxFloatSocket', 'Scale', default_value = 1.0)
|
||||
self.add_input('LnxFloatSocket', 'Offset', default_value = 0.5)
|
||||
|
||||
property0: HaxeEnumProperty(
|
||||
'property0',
|
||||
items = [('Perlin', 'Perlin', 'Perlin 3D'),
|
||||
('Octave Perlin', 'Octave Perlin', 'Octave Perlin 3D'),
|
||||
('Diamond Square', 'Diamond Square', 'Diamond Square 2D')],
|
||||
name='', default='Perlin', update=remove_extra_inputs)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxFloatSocket', 'X')
|
||||
self.add_input('LnxFloatSocket', 'Y')
|
||||
self.add_input('LnxFloatSocket', 'Z')
|
||||
self.add_input('LnxIntSocket', 'Repeat', default_value = -1)
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxFloatSocket', 'Value')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property0')
|
||||
@ -45,7 +45,13 @@ class TweenFloatNode(LnxLogicTreeNode):
|
||||
('CircInOut', 'CircInOut', 'CircInOut'),
|
||||
('BackIn', 'BackIn', 'BackIn'),
|
||||
('BackOut', 'BackOut', 'BackOut'),
|
||||
('BackInOut', 'BackInOut', 'BackInOut')],
|
||||
('BackInOut', 'BackInOut', 'BackInOut'),
|
||||
('BounceIn', 'BounceIn', 'BounceIn'),
|
||||
('BounceOut', 'BounceOut', 'BounceOut'),
|
||||
('BounceInOut', 'BounceInOut', 'BounceInOut'),
|
||||
('ElasticIn', 'ElasticIn', 'ElasticIn'),
|
||||
('ElasticOut', 'ElasticOut', 'ElasticOut'),
|
||||
('ElasticInOut', 'ElasticInOut', 'ElasticInOut')],
|
||||
name='', default='Linear')
|
||||
|
||||
def lnx_init(self, context):
|
||||
|
||||
@ -45,7 +45,13 @@ class TweenFloatNode(LnxLogicTreeNode):
|
||||
('CircInOut', 'CircInOut', 'CircInOut'),
|
||||
('BackIn', 'BackIn', 'BackIn'),
|
||||
('BackOut', 'BackOut', 'BackOut'),
|
||||
('BackInOut', 'BackInOut', 'BackInOut')],
|
||||
('BackInOut', 'BackInOut', 'BackInOut'),
|
||||
('BounceIn', 'BounceIn', 'BounceIn'),
|
||||
('BounceOut', 'BounceOut', 'BounceOut'),
|
||||
('BounceInOut', 'BounceInOut', 'BounceInOut'),
|
||||
('ElasticIn', 'ElasticIn', 'ElasticIn'),
|
||||
('ElasticOut', 'ElasticOut', 'ElasticOut'),
|
||||
('ElasticInOut', 'ElasticInOut', 'ElasticInOut')],
|
||||
name='', default='Linear')
|
||||
|
||||
def lnx_init(self, context):
|
||||
|
||||
@ -45,7 +45,13 @@ class TweenTransformNode(LnxLogicTreeNode):
|
||||
('CircInOut', 'CircInOut', 'CircInOut'),
|
||||
('BackIn', 'BackIn', 'BackIn'),
|
||||
('BackOut', 'BackOut', 'BackOut'),
|
||||
('BackInOut', 'BackInOut', 'BackInOut')],
|
||||
('BackInOut', 'BackInOut', 'BackInOut'),
|
||||
('BounceIn', 'BounceIn', 'BounceIn'),
|
||||
('BounceOut', 'BounceOut', 'BounceOut'),
|
||||
('BounceInOut', 'BounceInOut', 'BounceInOut'),
|
||||
('ElasticIn', 'ElasticIn', 'ElasticIn'),
|
||||
('ElasticOut', 'ElasticOut', 'ElasticOut'),
|
||||
('ElasticInOut', 'ElasticInOut', 'ElasticInOut')],
|
||||
name='', default='Linear')
|
||||
|
||||
def lnx_init(self, context):
|
||||
|
||||
@ -45,7 +45,13 @@ class TweenVectorNode(LnxLogicTreeNode):
|
||||
('CircInOut', 'CircInOut', 'CircInOut'),
|
||||
('BackIn', 'BackIn', 'BackIn'),
|
||||
('BackOut', 'BackOut', 'BackOut'),
|
||||
('BackInOut', 'BackInOut', 'BackInOut')],
|
||||
('BackInOut', 'BackInOut', 'BackInOut'),
|
||||
('BounceIn', 'BounceIn', 'BounceIn'),
|
||||
('BounceOut', 'BounceOut', 'BounceOut'),
|
||||
('BounceInOut', 'BounceInOut', 'BounceInOut'),
|
||||
('ElasticIn', 'ElasticIn', 'ElasticIn'),
|
||||
('ElasticOut', 'ElasticOut', 'ElasticOut'),
|
||||
('ElasticInOut', 'ElasticInOut', 'ElasticInOut')],
|
||||
name='', default='Linear')
|
||||
|
||||
def lnx_init(self, context):
|
||||
|
||||
@ -6,7 +6,7 @@ class WorldToScreenSpaceNode(LnxLogicTreeNode):
|
||||
bl_idname = 'LNWorldToScreenSpaceNode'
|
||||
bl_label = 'World to Screen Space'
|
||||
lnx_section = 'matrix'
|
||||
lnx_version = 2
|
||||
lnx_version = 3
|
||||
|
||||
def remove_extra_inputs(self, context):
|
||||
while len(self.inputs) > 1:
|
||||
@ -24,12 +24,14 @@ class WorldToScreenSpaceNode(LnxLogicTreeNode):
|
||||
self.add_input('LnxVectorSocket', 'World')
|
||||
|
||||
self.add_output('LnxVectorSocket', 'Screen')
|
||||
self.add_output('LnxIntSocket', 'X')
|
||||
self.add_output('LnxIntSocket', 'Y')
|
||||
|
||||
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):
|
||||
if self.lnx_version not in (0, 1, 2):
|
||||
raise LookupError()
|
||||
|
||||
return NodeReplacement.Identity(self)
|
||||
|
||||
@ -5,3 +5,4 @@ add_node_section(name='angle', category='Math')
|
||||
add_node_section(name='matrix', category='Math')
|
||||
add_node_section(name='color', category='Math')
|
||||
add_node_section(name='vector', category='Math')
|
||||
add_node_section(name='generator', category='Math')
|
||||
|
||||
Reference in New Issue
Block a user