1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 from rna_prop_ui import PropertyPanel
24 class DataButtonsPanel():
25 bl_space_type = 'PROPERTIES'
26 bl_region_type = 'WINDOW'
30 def poll(cls, context):
31 engine = context.scene.render.engine
32 return context.speaker and (engine in cls.COMPAT_ENGINES)
35 class DATA_PT_context_speaker(DataButtonsPanel, bpy.types.Panel):
37 bl_options = {'HIDE_HEADER'}
38 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
40 def draw(self, context):
44 speaker = context.speaker
45 space = context.space_data
47 split = layout.split(percentage=0.65)
50 split.template_ID(ob, "data")
52 split.template_ID(space, "pin_id")
55 class DATA_PT_speaker(DataButtonsPanel, bpy.types.Panel):
57 COMPAT_ENGINES = {'BLENDER_RENDER'}
59 def draw(self, context):
62 speaker = context.speaker
64 split = layout.split(percentage=0.75)
66 split.template_ID(speaker, "sound", open="sound.open_mono")
67 split.prop(speaker, "muted")
69 split = layout.split()
73 row.prop(speaker, "volume")
74 row.prop(speaker, "pitch")
77 class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel):
79 COMPAT_ENGINES = {'BLENDER_RENDER'}
81 def draw(self, context):
84 speaker = context.speaker
86 split = layout.split()
90 col.prop(speaker, "volume_min", text="Minimum")
91 col.prop(speaker, "volume_max", text="Maximum")
92 col.prop(speaker, "attenuation")
96 col.label("Distance:")
97 col.prop(speaker, "distance_max", text="Maximum")
98 col.prop(speaker, "distance_reference", text="Reference")
101 class DATA_PT_cone(DataButtonsPanel, bpy.types.Panel):
103 COMPAT_ENGINES = {'BLENDER_RENDER'}
105 def draw(self, context):
108 speaker = context.speaker
110 split = layout.split()
114 col.prop(speaker, "cone_angle_outer", text="Outer")
115 col.prop(speaker, "cone_angle_inner", text="Inner")
120 col.prop(speaker, "cone_volume_outer", text="Outer")
123 class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
124 COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
125 _context_path = "object.data"
126 _property_type = bpy.types.Speaker
128 if __name__ == "__main__": # only for live edit.
129 bpy.utils.register_module(__name__)