Revision: 38895
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38895
Author:   nexyon
Date:     2011-08-01 11:44:20 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
3D Audio GSoC:
Adds new speaker object type.

Notes:
* Needs some nice icons
* Quickily review by Joshua Leung (5 mins)
* Properties UI updated (with help of Thomans Dinges)
* Speakers have their own theme color
* No real audio functionality yet.
* Minor bug regarding lamps/lattices fixed in interface_templates.c

I personality tested:
* Creation, Deletion, Duplication
* Saving, Loading
* Library linking (incl. make local)
* Tracking
* Dope Sheet, Outliner
* Animation
* Drawing (incl. Theme)

Modified Paths:
--------------
    branches/soc-2011-pepper/release/scripts/modules/bpy_types.py
    branches/soc-2011-pepper/release/scripts/startup/bl_ui/__init__.py
    branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_scene.py
    branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_dopesheet.py
    branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_info.py
    branches/soc-2011-pepper/source/blender/CMakeLists.txt
    branches/soc-2011-pepper/source/blender/blenkernel/BKE_main.h
    branches/soc-2011-pepper/source/blender/blenkernel/BKE_object.h
    branches/soc-2011-pepper/source/blender/blenkernel/intern/anim_sys.c
    branches/soc-2011-pepper/source/blender/blenkernel/intern/depsgraph.c
    branches/soc-2011-pepper/source/blender/blenkernel/intern/idcode.c
    branches/soc-2011-pepper/source/blender/blenkernel/intern/library.c
    branches/soc-2011-pepper/source/blender/blenkernel/intern/object.c
    branches/soc-2011-pepper/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-pepper/source/blender/blenloader/intern/writefile.c
    
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_defines.c
    
branches/soc-2011-pepper/source/blender/editors/animation/anim_channels_edit.c
    branches/soc-2011-pepper/source/blender/editors/animation/anim_filter.c
    branches/soc-2011-pepper/source/blender/editors/animation/keyframes_draw.c
    branches/soc-2011-pepper/source/blender/editors/include/ED_anim_api.h
    branches/soc-2011-pepper/source/blender/editors/include/UI_resources.h
    
branches/soc-2011-pepper/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-pepper/source/blender/editors/interface/resources.c
    branches/soc-2011-pepper/source/blender/editors/object/object_add.c
    branches/soc-2011-pepper/source/blender/editors/object/object_intern.h
    branches/soc-2011-pepper/source/blender/editors/object/object_ops.c
    branches/soc-2011-pepper/source/blender/editors/object/object_relations.c
    branches/soc-2011-pepper/source/blender/editors/sound/sound_ops.c
    
branches/soc-2011-pepper/source/blender/editors/space_buttons/buttons_context.c
    branches/soc-2011-pepper/source/blender/editors/space_file/filelist.c
    branches/soc-2011-pepper/source/blender/editors/space_nla/nla_buttons.c
    branches/soc-2011-pepper/source/blender/editors/space_nla/nla_channels.c
    
branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_draw.c
    
branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_tools.c
    
branches/soc-2011-pepper/source/blender/editors/space_outliner/outliner_tree.c
    branches/soc-2011-pepper/source/blender/editors/space_view3d/drawobject.c
    branches/soc-2011-pepper/source/blender/makesdna/DNA_ID.h
    branches/soc-2011-pepper/source/blender/makesdna/DNA_action_types.h
    branches/soc-2011-pepper/source/blender/makesdna/DNA_object_types.h
    branches/soc-2011-pepper/source/blender/makesdna/DNA_userdef_types.h
    branches/soc-2011-pepper/source/blender/makesdna/intern/makesdna.c
    branches/soc-2011-pepper/source/blender/makesrna/RNA_access.h
    branches/soc-2011-pepper/source/blender/makesrna/intern/CMakeLists.txt
    branches/soc-2011-pepper/source/blender/makesrna/intern/makesrna.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_ID.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_action.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_internal.h
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_main.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_main_api.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_object.c
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_userdef.c

Added Paths:
-----------
    
branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_data_speaker.py
    branches/soc-2011-pepper/source/blender/makesdna/DNA_speaker_types.h
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_speaker.c

Modified: branches/soc-2011-pepper/release/scripts/modules/bpy_types.py
===================================================================
--- branches/soc-2011-pepper/release/scripts/modules/bpy_types.py       
2011-08-01 11:43:54 UTC (rev 38894)
+++ branches/soc-2011-pepper/release/scripts/modules/bpy_types.py       
2011-08-01 11:44:20 UTC (rev 38895)
@@ -57,7 +57,7 @@
                 "curves", "grease_pencil", "groups", "images", \
                 "lamps", "lattices", "materials", "metaballs", \
                 "meshes", "node_groups", "objects", "scenes", \
-                "sounds", "textures", "texts", "fonts", "worlds"
+                "sounds", "speakers", "textures", "texts", "fonts", "worlds"
 
         return tuple(id_block for attr in attr_links for id_block in 
getattr(bpy.data, attr) if id_block.library == self)
 

Modified: branches/soc-2011-pepper/release/scripts/startup/bl_ui/__init__.py
===================================================================
--- branches/soc-2011-pepper/release/scripts/startup/bl_ui/__init__.py  
2011-08-01 11:43:54 UTC (rev 38894)
+++ branches/soc-2011-pepper/release/scripts/startup/bl_ui/__init__.py  
2011-08-01 11:44:20 UTC (rev 38895)
@@ -36,6 +36,7 @@
     "properties_data_mesh",
     "properties_data_metaball",
     "properties_data_modifier",
+    "properties_data_speaker",
     "properties_game",
     "properties_material",
     "properties_object_constraint",

Added: 
branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_data_speaker.py
===================================================================
--- 
branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_data_speaker.py
                           (rev 0)
+++ 
branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_data_speaker.py
   2011-08-01 11:44:20 UTC (rev 38895)
@@ -0,0 +1,129 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel():
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+
+    @classmethod
+    def poll(cls, context):
+        engine = context.scene.render.engine
+        return context.speaker and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_speaker(DataButtonsPanel, bpy.types.Panel):
+    bl_label = ""
+    bl_options = {'HIDE_HEADER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        speaker = context.speaker
+        space = context.space_data
+
+        split = layout.split(percentage=0.65)
+
+        if ob:
+            split.template_ID(ob, "data")
+        elif speaker:
+            split.template_ID(space, "pin_id")
+
+
+class DATA_PT_speaker(DataButtonsPanel, bpy.types.Panel):
+    bl_label = "Sound"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        speaker = context.speaker
+
+        split = layout.split(percentage=0.75)
+
+        split.template_ID(speaker, "sound", open="sound.open")
+        split.prop(speaker, "muted")
+
+        split = layout.split()
+
+        row = split.row()
+
+        row.prop(speaker, "volume")
+        row.prop(speaker, "pitch")
+
+
+class DATA_PT_distance(DataButtonsPanel, bpy.types.Panel):
+    bl_label = "Distance"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        speaker = context.speaker
+
+        split = layout.split()
+        col = split.column()
+
+        col.label("Volume:")
+        col.prop(speaker, "volume_min", text="Minimum")
+        col.prop(speaker, "volume_max", text="Maximum")
+        col.prop(speaker, "attenuation")
+
+        col = split.column()
+
+        col.label("Distance:")
+        col.prop(speaker, "distance_max", text="Maximum")
+        col.prop(speaker, "distance_reference", text="Reference")
+
+
+class DATA_PT_cone(DataButtonsPanel, bpy.types.Panel):
+    bl_label = "Cone"
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        speaker = context.speaker
+
+        split = layout.split()
+        col = split.column()
+
+        col.label("Angle:")
+        col.prop(speaker, "cone_angle_outer", text="Outer")
+        col.prop(speaker, "cone_angle_inner", text="Inner")
+
+        col = split.column()
+
+        col.label("Volume:")
+        col.prop(speaker, "cone_volume_outer", text="Outer")
+
+
+class DATA_PT_custom_props_speaker(DataButtonsPanel, PropertyPanel, 
bpy.types.Panel):
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    _context_path = "object.data"
+    _property_type = bpy.types.Speaker
+
+if __name__ == "__main__":  # only for live edit.
+    bpy.utils.register_module(__name__)

Modified: 
branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_scene.py
===================================================================
--- branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_scene.py  
2011-08-01 11:43:54 UTC (rev 38894)
+++ branches/soc-2011-pepper/release/scripts/startup/bl_ui/properties_scene.py  
2011-08-01 11:44:20 UTC (rev 38895)
@@ -51,22 +51,24 @@
         layout = self.layout
         scene = context.scene
         rd = context.scene.render
-        
-        layout.prop(scene, "audio_distance_model")
 
-        layout.prop(scene, "audio_doppler_speed", text="Speed")
-        layout.prop(scene, "audio_doppler_factor")
-
         layout.prop(scene, "audio_volume")
-        layout.operator("sound.update_animation_flags")
         layout.operator("sound.bake_animation")
 
         split = layout.split()
 
         col = split.column()
-        col.prop(rd, "ffmpeg_audio_mixrate", text="Rate")
+
+        col.label("Listener:")
+        col.prop(scene, "audio_distance_model", text="")
+        col.prop(scene, "audio_doppler_speed", text="Speed")
+        col.prop(scene, "audio_doppler_factor", text="Doppler")
+
         col = split.column()
+
+        col.label("Format:")
         col.prop(rd, "ffmpeg_audio_channels", text="")
+        col.prop(rd, "ffmpeg_audio_mixrate", text="Rate")
 
 
 class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
@@ -102,7 +104,6 @@
         col = row.column(align=True)
         col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
         col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
-        col.menu("SCENE_MT_keying_set_specials", icon='DOWNARROW_HLT', text="")
 
         ks = scene.keying_sets.active
         if ks and ks.is_path_absolute:
@@ -121,14 +122,6 @@
             col.prop(ks, "bl_options")
 
 
-class SCENE_MT_keying_set_specials(bpy.types.Menu):
-    bl_label = "Keying Set Specials"
-
-    def draw(self, context):
-        layout = self.layout
-        
-        layout.operator("anim.keying_set_import", text="Import From File")
-
 class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
     bl_label = "Active Keying Set"
 
@@ -233,36 +226,6 @@
 #  XXX, move operator to op/ dir
 
 
-class ANIM_OT_keying_set_import(bpy.types.Operator):
-    "Import Keying Set from a python script."
-    bl_idname = "anim.keying_set_import"
-    bl_label = "Import Keying Set from File"
-
-    filepath = bpy.props.StringProperty(name="File Path", 
description="Filepath to read file from.")
-    filter_folder = bpy.props.BoolProperty(name="Filter folders", 
description="", default=True, options={'HIDDEN'})
-    filter_text = bpy.props.BoolProperty(name="Filter text", description="", 
default=True, options={'HIDDEN'})
-    filter_python = bpy.props.BoolProperty(name="Filter python", 
description="", default=True, options={'HIDDEN'})
-
-    def execute(self, context):
-        if not self.filepath:
-            raise Exception("Filepath not set.")
-        
-        f = open(self.filepath, "r")
-        if not f:
-            raise Exception("Could not open file.")
-        
-        # lazy way of loading and running this file...
-        exec(compile(f.read(), self.filepath, 'exec'))
-        
-        f.close()
-
-        return {'FINISHED'}
-
-    def invoke(self, context, event):
-        wm = context.window_manager
-        wm.fileselect_add(self)
-        return {'RUNNING_MODAL'}
-
 class ANIM_OT_keying_set_export(bpy.types.Operator):
     "Export Keying Set to a python script."
     bl_idname = "anim.keying_set_export"

Modified: 
branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_dopesheet.py
===================================================================
--- branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_dopesheet.py   
2011-08-01 11:43:54 UTC (rev 38894)
+++ branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_dopesheet.py   
2011-08-01 11:44:20 UTC (rev 38895)
@@ -86,6 +86,8 @@
             row.prop(dopesheet, "show_armatures", text="")
         if bpy.data.particles:
             row.prop(dopesheet, "show_particles", text="")
+        if bpy.data.speakers:
+            row.prop(dopesheet, "show_speakers", text="")
 
 
 #######################################

Modified: branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_info.py
===================================================================
--- branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_info.py        
2011-08-01 11:43:54 UTC (rev 38894)
+++ branches/soc-2011-pepper/release/scripts/startup/bl_ui/space_info.py        
2011-08-01 11:44:20 UTC (rev 38895)
@@ -292,6 +292,9 @@
         layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", 
icon='OUTLINER_OB_LAMP')
         layout.separator()
 
+        layout.operator("object.speaker_add", text="Speaker", icon='SPEAKER')
+        layout.separator()
+

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to