forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
18
leenkx/blender/lnx/logicnode/sound/LN_pause_speaker.py
Normal file
18
leenkx/blender/lnx/logicnode/sound/LN_pause_speaker.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class PauseSpeakerNode(LnxLogicTreeNode):
|
||||
"""Pauses playback of the given speaker object. The playback will be resumed
|
||||
at the paused position.
|
||||
|
||||
@seeNode Play Speaker
|
||||
@seeNode Stop Speaker
|
||||
"""
|
||||
bl_idname = 'LNPauseSoundNode'
|
||||
bl_label = 'Pause Speaker'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Speaker')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
116
leenkx/blender/lnx/logicnode/sound/LN_play_sound.py
Normal file
116
leenkx/blender/lnx/logicnode/sound/LN_play_sound.py
Normal file
@ -0,0 +1,116 @@
|
||||
import bpy
|
||||
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
|
||||
class PlaySoundNode(LnxLogicTreeNode):
|
||||
"""Plays the given sound.
|
||||
|
||||
@input Play: Plays the sound, or if paused, resumes the playback.
|
||||
The exact behaviour depends on the Retrigger option (see below).
|
||||
@input Pause: Pauses the playing sound. If no sound is playing,
|
||||
nothing happens.
|
||||
@input Stop: Stops the playing sound. If the playback is paused,
|
||||
this will reset the playback position to the start of the sound.
|
||||
@input Update Volume: Updates the volume of the current playback.
|
||||
@input Volume: Volume of the playback. Typically ranges from 0 to 1.
|
||||
|
||||
@output Out: activated once when Play is activated.
|
||||
@output Running: activated while the playback is active.
|
||||
@output Done: activated when the playback has finished or was
|
||||
stopped manually.
|
||||
|
||||
@option Sound/Sound Name: specify a sound by a resource or a string name
|
||||
@option Sound: The sound that will be played.
|
||||
@option Stream: Stream the sound from disk.
|
||||
@option Loop: Whether to loop the playback.
|
||||
@option Retrigger: If true, the playback position will be reset to
|
||||
the beginning on each activation of Play. If false, the playback
|
||||
will continue at the current position.
|
||||
@option Sample Rate: Manually override the sample rate of the sound
|
||||
(this controls the pitch and the playback speed).
|
||||
"""
|
||||
bl_idname = 'LNPlaySoundRawNode'
|
||||
bl_label = 'Play Sound'
|
||||
bl_width_default = 200
|
||||
lnx_version = 3
|
||||
|
||||
def remove_extra_inputs(self, context):
|
||||
while len(self.inputs) > 5:
|
||||
self.inputs.remove(self.inputs[-1])
|
||||
if self.property6 == 'Sound Name':
|
||||
self.add_input('LnxStringSocket', 'Sound Name')
|
||||
|
||||
property0: HaxePointerProperty('property0', name='', type=bpy.types.Sound)
|
||||
|
||||
property1: HaxeBoolProperty(
|
||||
'property1',
|
||||
name='Loop',
|
||||
description='Play the sound in a loop',
|
||||
default=False)
|
||||
property2: HaxeBoolProperty(
|
||||
'property2',
|
||||
name='Retrigger',
|
||||
description='Play the sound from the beginning every time',
|
||||
default=False)
|
||||
property3: HaxeBoolProperty(
|
||||
'property3',
|
||||
name='Use Custom Sample Rate',
|
||||
description='If enabled, override the default sample rate',
|
||||
default=False)
|
||||
property4: HaxeIntProperty(
|
||||
'property4',
|
||||
name='Sample Rate',
|
||||
description='Set the sample rate used to play this sound',
|
||||
default=44100,
|
||||
min=0)
|
||||
property5: HaxeBoolProperty(
|
||||
'property5',
|
||||
name='Stream',
|
||||
description='Stream the sound from disk',
|
||||
default=False
|
||||
)
|
||||
|
||||
property6: HaxeEnumProperty(
|
||||
'property6',
|
||||
items = [('Sound', 'Sound', 'Sound'),
|
||||
('Sound Name', 'Sound Name', 'Sound Name')],
|
||||
name='', default='Sound', update=remove_extra_inputs)
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'Play')
|
||||
self.add_input('LnxNodeSocketAction', 'Pause')
|
||||
self.add_input('LnxNodeSocketAction', 'Stop')
|
||||
self.add_input('LnxNodeSocketAction', 'Update Volume')
|
||||
self.add_input('LnxFloatSocket', 'Volume', default_value=1.0)
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
||||
self.add_output('LnxNodeSocketAction', 'Is Running')
|
||||
self.add_output('LnxNodeSocketAction', 'Done')
|
||||
|
||||
def draw_buttons(self, context, layout):
|
||||
layout.prop(self, 'property6')
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
if self.property6 == 'Sound':
|
||||
col.prop_search(self, 'property0', bpy.data, 'sounds', icon='NONE', text='')
|
||||
|
||||
col.prop(self, 'property5')
|
||||
col.prop(self, 'property1')
|
||||
col.prop(self, 'property2')
|
||||
|
||||
layout.label(text="Overrides:")
|
||||
# Sample rate
|
||||
split = layout.split(factor=0.15, align=False)
|
||||
split.prop(self, 'property3', text="")
|
||||
row = split.row()
|
||||
if not self.property3:
|
||||
row.enabled = False
|
||||
row.prop(self, 'property4')
|
||||
|
||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||
if 0 <= self.lnx_version <= 2:
|
||||
return NodeReplacement.Identity(self)
|
||||
|
||||
raise LookupError()
|
18
leenkx/blender/lnx/logicnode/sound/LN_play_speaker.py
Normal file
18
leenkx/blender/lnx/logicnode/sound/LN_play_speaker.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class PlaySpeakerNode(LnxLogicTreeNode):
|
||||
"""Starts the playback of the given speaker object. If the playback was
|
||||
paused, it is resumed from the paused position.
|
||||
|
||||
@seeNode Pause Speaker
|
||||
@seeNode Play Speaker
|
||||
"""
|
||||
bl_idname = 'LNPlaySoundNode'
|
||||
bl_label = 'Play Speaker'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Speaker')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
18
leenkx/blender/lnx/logicnode/sound/LN_set_sound_speaker.py
Normal file
18
leenkx/blender/lnx/logicnode/sound/LN_set_sound_speaker.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetSoundSpeakerNode(LnxLogicTreeNode):
|
||||
"""sets sound name of the given speaker object.
|
||||
|
||||
@seeNode Play Speaker
|
||||
@seeNode Stop Speaker
|
||||
"""
|
||||
bl_idname = 'LNSetSoundNode'
|
||||
bl_label = 'Set Sound Speaker'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Speaker')
|
||||
self.add_input('LnxStringSocket', 'Sound Name')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
18
leenkx/blender/lnx/logicnode/sound/LN_set_volume_speaker.py
Normal file
18
leenkx/blender/lnx/logicnode/sound/LN_set_volume_speaker.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class SetVolumeSoundNode(LnxLogicTreeNode):
|
||||
"""sets volume of the given speaker object.
|
||||
|
||||
@seeNode Play Speaker
|
||||
@seeNode Stop Speaker
|
||||
"""
|
||||
bl_idname = 'LNSetVolumeSoundNode'
|
||||
bl_label = 'Set Volume Speaker'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Speaker')
|
||||
self.add_input('LnxFloatSocket', 'Volume')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
18
leenkx/blender/lnx/logicnode/sound/LN_stop_speaker.py
Normal file
18
leenkx/blender/lnx/logicnode/sound/LN_stop_speaker.py
Normal file
@ -0,0 +1,18 @@
|
||||
from lnx.logicnode.lnx_nodes import *
|
||||
|
||||
class StopSpeakerNode(LnxLogicTreeNode):
|
||||
"""Stops playback of the given speaker object. The playback position will be
|
||||
reset to the start.
|
||||
|
||||
@seeNode Pause Speaker
|
||||
@seeNode Play Speaker
|
||||
"""
|
||||
bl_idname = 'LNStopSoundNode'
|
||||
bl_label = 'Stop Speaker'
|
||||
lnx_version = 1
|
||||
|
||||
def lnx_init(self, context):
|
||||
self.add_input('LnxNodeSocketAction', 'In')
|
||||
self.add_input('LnxNodeSocketObject', 'Speaker')
|
||||
|
||||
self.add_output('LnxNodeSocketAction', 'Out')
|
0
leenkx/blender/lnx/logicnode/sound/__init__.py
Normal file
0
leenkx/blender/lnx/logicnode/sound/__init__.py
Normal file
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