Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/properties_data_speaker.py
| Show All 12 Lines | class DataButtonsPanel: | ||||
| def poll(cls, context): | def poll(cls, context): | ||||
| engine = context.engine | engine = context.engine | ||||
| return context.speaker and (engine in cls.COMPAT_ENGINES) | return context.speaker and (engine in cls.COMPAT_ENGINES) | ||||
| class DATA_PT_context_speaker(DataButtonsPanel, Panel): | class DATA_PT_context_speaker(DataButtonsPanel, Panel): | ||||
| bl_label = "" | bl_label = "" | ||||
| bl_options = {'HIDE_HEADER'} | bl_options = {'HIDE_HEADER'} | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| ob = context.object | ob = context.object | ||||
| speaker = context.speaker | speaker = context.speaker | ||||
| space = context.space_data | space = context.space_data | ||||
| if ob: | if ob: | ||||
| layout.template_ID(ob, "data") | layout.template_ID(ob, "data") | ||||
| elif speaker: | elif speaker: | ||||
| layout.template_ID(space, "pin_id") | layout.template_ID(space, "pin_id") | ||||
| class DATA_PT_speaker(DataButtonsPanel, Panel): | class DATA_PT_speaker(DataButtonsPanel, Panel): | ||||
| bl_label = "Sound" | bl_label = "Sound" | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| speaker = context.speaker | speaker = context.speaker | ||||
| layout.template_ID(speaker, "sound", open="sound.open_mono") | layout.template_ID(speaker, "sound", open="sound.open_mono") | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| layout.prop(speaker, "muted") | layout.prop(speaker, "muted") | ||||
| col = layout.column() | col = layout.column() | ||||
| col.active = not speaker.muted | col.active = not speaker.muted | ||||
| col.prop(speaker, "volume", slider=True) | col.prop(speaker, "volume", slider=True) | ||||
| col.prop(speaker, "pitch") | col.prop(speaker, "pitch") | ||||
| class DATA_PT_distance(DataButtonsPanel, Panel): | class DATA_PT_distance(DataButtonsPanel, Panel): | ||||
| bl_label = "Distance" | bl_label = "Distance" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| speaker = context.speaker | speaker = context.speaker | ||||
| layout.active = not speaker.muted | layout.active = not speaker.muted | ||||
| col = layout.column() | col = layout.column() | ||||
| sub = col.column(align=True) | sub = col.column(align=True) | ||||
| sub.prop(speaker, "volume_min", slider=True, text="Volume Min") | sub.prop(speaker, "volume_min", slider=True, text="Volume Min") | ||||
| sub.prop(speaker, "volume_max", slider=True, text="Max") | sub.prop(speaker, "volume_max", slider=True, text="Max") | ||||
| col.prop(speaker, "attenuation") | col.prop(speaker, "attenuation") | ||||
| col.separator() | col.separator() | ||||
| col.prop(speaker, "distance_max", text="Max Distance") | col.prop(speaker, "distance_max", text="Max Distance") | ||||
| col.prop(speaker, "distance_reference", text="Distance Reference") | col.prop(speaker, "distance_reference", text="Distance Reference") | ||||
| class DATA_PT_cone(DataButtonsPanel, Panel): | class DATA_PT_cone(DataButtonsPanel, Panel): | ||||
| bl_label = "Cone" | bl_label = "Cone" | ||||
| bl_options = {'DEFAULT_CLOSED'} | bl_options = {'DEFAULT_CLOSED'} | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| def draw(self, context): | def draw(self, context): | ||||
| layout = self.layout | layout = self.layout | ||||
| layout.use_property_split = True | layout.use_property_split = True | ||||
| speaker = context.speaker | speaker = context.speaker | ||||
| layout.active = not speaker.muted | layout.active = not speaker.muted | ||||
| col = layout.column() | col = layout.column() | ||||
| sub = col.column(align=True) | sub = col.column(align=True) | ||||
| sub.prop(speaker, "cone_angle_outer", text="Angle Outer") | sub.prop(speaker, "cone_angle_outer", text="Angle Outer") | ||||
| sub.prop(speaker, "cone_angle_inner", text="Inner") | sub.prop(speaker, "cone_angle_inner", text="Inner") | ||||
| col.separator() | col.separator() | ||||
| col.prop(speaker, "cone_volume_outer", slider=True) | col.prop(speaker, "cone_volume_outer", slider=True) | ||||
| class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, Panel): | class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, Panel): | ||||
| COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'} | COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH','BLENDER_WORKBENCH_NEXT'} | ||||
| _context_path = "object.data" | _context_path = "object.data" | ||||
| _property_type = bpy.types.Speaker | _property_type = bpy.types.Speaker | ||||
| classes = ( | classes = ( | ||||
| DATA_PT_context_speaker, | DATA_PT_context_speaker, | ||||
| DATA_PT_speaker, | DATA_PT_speaker, | ||||
| DATA_PT_distance, | DATA_PT_distance, | ||||
| DATA_PT_cone, | DATA_PT_cone, | ||||
| DATA_PT_custom_props_speaker, | DATA_PT_custom_props_speaker, | ||||
| ) | ) | ||||
| if __name__ == "__main__": # only for live edit. | if __name__ == "__main__": # only for live edit. | ||||
| from bpy.utils import register_class | from bpy.utils import register_class | ||||
| for cls in classes: | for cls in classes: | ||||
| register_class(cls) | register_class(cls) | ||||