+# Class type 108
+#
+# Purpose:
+#
+class classtype_particle_box(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("target",c_uint32),
+ ("rate",c_float)]
+
+ function_enum = [('0',"set rate",""),
+ ('1',"",""),
+ ('2',"",""),
+ ('3',"","")]
+
+ def encode_obj(_, node,node_def ):
+ #{
+ node.classtype = 108
+
+ obj = node_def['obj']
+
+ _.rate = obj.cv_data.fltp
+ if obj.cv_data.target:
+ _.target = obj.cv_data.target.cv_data.uid
+ #}
+
+ @staticmethod
+ def draw_scene_helpers( obj ):
+ #{
+ global cv_view_verts, cv_view_colours
+ cv_draw_ucube( obj.matrix_world, [1,0.8,0,1] )
+
+ white = (1,1,1,1)
+ if obj.cv_data.target:
+ cv_draw_arrow( obj.location, obj.cv_data.target.location, white, 0.7 )
+ #}
+
+ @staticmethod
+ def editor_interface( layout, obj ):
+ #{
+ layout.prop( obj.cv_data, "target", text="Triggers" )
+ layout.prop( obj.cv_data, "fltp", text="count per second" )
+ #}
+#}
+
+# Class type 109
+#
+# Purpose:
+#
+class classtype_signal_splitter(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("next",c_uint32*4)]
+
+ function_enum = [('0',"pass along",""),
+ ('1',"",""),
+ ('2',"",""),
+ ('3',"","")]
+
+ def encode_obj(_,node,node_def):
+ #{
+ node.classtype = 109
+
+ obj = node_def['obj']
+
+ if obj.cv_data.target: _.next[0] = obj.cv_data.target.cv_data.uid
+ if obj.cv_data.target1: _.next[1] = obj.cv_data.target1.cv_data.uid
+ if obj.cv_data.target2: _.next[2] = obj.cv_data.target2.cv_data.uid
+ if obj.cv_data.target3: _.next[3] = obj.cv_data.target3.cv_data.uid
+ #}
+
+ @staticmethod
+ def editor_interface( layout, obj ):
+ #{
+ layout.label( text="The split signals will run in order" )
+ layout.prop( obj.cv_data, "target", text="#0" )
+ layout.prop( obj.cv_data, "target1", text="#1" )
+ layout.prop( obj.cv_data, "target2", text="#2" )
+ layout.prop( obj.cv_data, "target3", text="#3" )
+ #}
+
+ @staticmethod
+ def draw_scene_helpers( obj ):
+ #{
+ global cv_view_verts, cv_view_colours
+
+ c0 = (1,0.5,0.2,1)
+ c1 = (0.8,1,0.1,1)
+ c2 = (0.3,0.9,0.4,1)
+ c3 = (0.1,0.4,1.0,1)
+
+ if obj.cv_data.target:
+ cv_draw_arrow( obj.location, obj.cv_data.target.location, c0, 0.7 )
+ if obj.cv_data.target1:
+ cv_draw_arrow( obj.location, obj.cv_data.target1.location, c1, 0.7 )
+ if obj.cv_data.target2:
+ cv_draw_arrow( obj.location, obj.cv_data.target2.location, c2, 0.7 )
+ if obj.cv_data.target3:
+ cv_draw_arrow( obj.location, obj.cv_data.target3.location, c3, 0.7 )
+ #}
+#}
+
+# Class type 106
+#
+# Purpose:
+#
+class classtype_soundscape(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("max_instances",c_uint32),
+ ("allow_transitions",c_uint32),
+ ("transition_duration",c_float),
+ ("label",c_uint32)]
+
+ function_enum = [('0',"play",""),
+ ('1',"set position",""),
+ ('2',"",""),
+ ('3',"","")]
+
+ def encode_obj(_,node,node_def):
+ #{
+ node.classtype = 106
+
+ obj = node_def['obj']
+
+ _.max_instances = obj.cv_data.intp
+ _.allow_transitions = obj.cv_data.bp0
+ _.transition_duration = obj.cv_data.fltp
+ _.label = encoder_process_pstr( obj.cv_data.strp )
+ #}
+
+ @staticmethod
+ def editor_interface( layout, obj ):
+ #{
+ layout.prop( obj.cv_data, "intp", text="max instances" )
+ layout.prop( obj.cv_data, "strp", text="label" )
+
+ box = layout.box()
+ box.label( text="If its a 3d sound, where can it spawn?" )
+ box.prop( obj.cv_data, "bp1", text="Only in water" )
+ box.prop( obj.cv_data, "bp2", text="Only on grass" )
+ box.prop( obj.cv_data, "bp3", text="Only on wood" )
+
+ box = layout.box()
+ box.prop( obj.cv_data, "bp0", text="allow transitions" )
+
+ row = box.row()
+ if not obj.cv_data.bp0:
+ row.enabled=False
+ row.prop( obj.cv_data, "fltp", text="transition duration" )
+ #}
+#}
+
+class classtype_logic_chances(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("targets",c_uint32*2),
+ ("p",c_float)]
+
+ function_enum = [('0',"pass along",""),
+ ('1',"set ratio",""),
+ ('2',"",""),
+ ('3',"","")]
+
+ def encode_obj(_,node,node_def):
+ #{
+ node.classtype = 107
+
+ obj = node_def['obj']
+
+ if obj.cv_data.target: _.targets[0] = obj.cv_data.target.cv_data.uid
+ if obj.cv_data.target1: _.targets[1] = obj.cv_data.target1.cv_data.uid
+
+ _.p = obj.cv_data.fltp
+ #}
+
+ @staticmethod
+ def editor_interface( layout, obj ):
+ #{
+ box = layout.box()
+ box.prop( obj.cv_data, "target", text="red" )
+ box.prop( obj.cv_data, "target1", text="black" )
+ box.prop( obj.cv_data, "fltp", text="p(red)" )
+ #}
+
+ @staticmethod
+ def draw_scene_helpers( obj ):
+ #{
+ global cv_view_verts, cv_view_colours
+
+ red = (1,0,0,1)
+ black = (0,0,0,1)
+
+ if obj.cv_data.target:
+ cv_draw_arrow( obj.location, obj.cv_data.target.location, red, 0.7 )
+ if obj.cv_data.target1:
+ cv_draw_arrow( obj.location, obj.cv_data.target1.location, black, 0.7 )
+ #}
+#}
+
+# Classtype 102 [ DEPRECATED ]
+#
+# Purpose: sends a signal to another entity
+#
+class classtype_logic_relay(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("targets",c_uint32*4)]
+
+ def encode_obj(_, node,node_def ):
+ #{
+ node.classtype = 102
+ obj = node_def['obj']
+ if obj.cv_data.target:
+ _.targets[0] = obj.cv_data.target.cv_data.uid
+ if obj.cv_data.target1:
+ _.targets[1] = obj.cv_data.target1.cv_data.uid
+ if obj.cv_data.target2:
+ _.targets[2] = obj.cv_data.target2.cv_data.uid
+ if obj.cv_data.target3:
+ _.targets[3] = obj.cv_data.target3.cv_data.uid
+ #}
+
+ @staticmethod
+ def draw_scene_helpers( obj ):
+ #{
+ global cv_view_verts, cv_view_colours
+
+ if obj.cv_data.target:
+ cv_draw_arrow( obj.location, obj.cv_data.target.location, [1,1,1,1] )
+ if obj.cv_data.target1:
+ cv_draw_arrow( obj.location, obj.cv_data.target1.location, [1,1,1,1] )
+ if obj.cv_data.target2:
+ cv_draw_arrow( obj.location, obj.cv_data.target2.location, [1,1,1,1] )
+ if obj.cv_data.target3:
+ cv_draw_arrow( obj.location, obj.cv_data.target3.location, [1,1,1,1] )
+ #}
+
+ @staticmethod
+ def editor_interface( layout, obj ):
+ #{
+ layout.prop( obj.cv_data, "target", text="Triggers" )
+ layout.prop( obj.cv_data, "target1", text="Triggers" )
+ layout.prop( obj.cv_data, "target2", text="Triggers" )
+ layout.prop( obj.cv_data, "target3", text="Triggers" )
+ #}
+#}
+
+# Classtype 14
+#
+# Purpose: Plays some audio (44100hz .ogg vorbis only)
+# NOTE: There is a 32mb limit on the audio buffer, world audio is
+# decompressed and stored in signed 16 bit integers (2 bytes)
+# per sample.
+#
+# volume: not used if has 3D flag
+# flags:
+# AUDIO_FLAG_LOOP 0x1
+# AUDIO_FLAG_SPACIAL_3D 0x4 (Probably what you want)
+# AUDIO_FLAG_AUTO_START 0x8 (Play when the world starts)
+# ......
+# the rest are just internal flags, only use the above 3.
+#
+class classtype_audio(Structure):
+#{
+ _pack_ = 1
+ _fields_ = [("pstr_file",c_uint32),
+ ("flags",c_uint32),
+ ("volume",c_float)]
+
+ def encode_obj(_, node,node_def ):
+ #{
+ node.classtype = 14
+
+ obj = node_def['obj']
+
+ _.pstr_file = encoder_process_pstr( obj.cv_data.strp )
+
+ flags = 0x00
+ if obj.cv_data.bp0: flags |= 0x1
+ if obj.cv_data.bp1: flags |= 0x4
+ if obj.cv_data.bp2: flags |= 0x8