43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
|
from lnx.logicnode.lnx_nodes import *
|
||
|
|
||
|
|
||
|
class AudioLoadNode(LnxLogicTreeNode):
|
||
|
"""Load Audio"""
|
||
|
bl_idname = 'LNAudioLoadNode'
|
||
|
bl_label = 'Load Audio'
|
||
|
bl_description = 'Load audio'
|
||
|
lnx_category = '3D_Audio'
|
||
|
lnx_version = 1
|
||
|
|
||
|
def update_input(self, context):
|
||
|
while len(self.inputs) > 1:
|
||
|
self.inputs.remove(self.inputs[-1])
|
||
|
if self.property1 == 'Audio File':
|
||
|
self.add_input('LnxStringSocket', 'File Name')
|
||
|
|
||
|
#property0: HaxePointerProperty('property0', name='', type=bpy.types.Sound)
|
||
|
|
||
|
property1: HaxeEnumProperty(
|
||
|
'property1',
|
||
|
items = [#('Sound', 'Sound', 'Sound'),
|
||
|
('Audio File', 'Audio File', 'The name of the audio file to load')],
|
||
|
name='', default='Audio File'
|
||
|
#, update=update_input
|
||
|
)
|
||
|
|
||
|
def lnx_init(self, context):
|
||
|
self.add_input('LnxStringSocket', 'Channel', default_value='master')
|
||
|
self.add_input('LnxStringSocket', 'File Name')
|
||
|
self.add_input('LnxBoolSocket', 'Repeat')
|
||
|
self.add_output('LnxDynamicSocket', 'Audio')
|
||
|
|
||
|
|
||
|
def draw_buttons(self, context, layout):
|
||
|
layout.prop(self, 'property1')
|
||
|
#col = layout.column(align=True)
|
||
|
#if self.property1 == 'Sound':
|
||
|
#col.prop_search(self, 'property0', bpy.data, 'sounds', icon='NONE', text='')
|
||
|
|
||
|
def register():
|
||
|
add_category('3D_Audio', icon='SOUND')
|
||
|
AudioLoadNode.on_register()
|