cleanup for addon python internals, fix filtering bug.
[blender.git] / release / scripts / ui / properties_render.py
index 0eb46955a0c0bc58b8b67edcae2e2091dd88c0df..23dc434ae38f968883cd86d606bc57e4f6e79afc 100644 (file)
@@ -12,7 +12,7 @@
 #
 #  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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # ##### END GPL LICENSE BLOCK #####
 
@@ -29,6 +29,13 @@ class RENDER_MT_presets(bpy.types.Menu):
     draw = bpy.types.Menu.draw_preset
 
 
+class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
+    bl_label = "FFMPEG Presets"
+    preset_subdir = "ffmpeg"
+    preset_operator = "script.python_file_run"
+    draw = bpy.types.Menu.draw_preset
+
+
 class RenderButtonsPanel(bpy.types.Panel):
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
@@ -36,7 +43,7 @@ class RenderButtonsPanel(bpy.types.Panel):
     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
 
     def poll(self, context):
-        rd = context.scene.render_data
+        rd = context.scene.render
         return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
 
 
@@ -47,17 +54,17 @@ class RENDER_PT_render(RenderButtonsPanel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         split = layout.split()
 
         col = split.column()
-        col.operator("screen.render", text="Image", icon='RENDER_STILL')
+        col.operator("render.render", text="Image", icon='RENDER_STILL')
 
         if wide_ui:
             col = split.column()
-        col.operator("screen.render", text="Animation", icon='RENDER_ANIMATION').animation = True
+        col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
 
         layout.prop(rd, "display_mode", text="Display")
 
@@ -71,7 +78,7 @@ class RENDER_PT_layers(RenderButtonsPanel):
         layout = self.layout
 
         scene = context.scene
-        rd = scene.render_data
+        rd = scene.render
         wide_ui = context.region.width > narrowui
 
         row = layout.row()
@@ -176,7 +183,7 @@ class RENDER_PT_shading(RenderButtonsPanel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         split = layout.split()
@@ -202,7 +209,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         split = layout.split()
@@ -222,7 +229,7 @@ class RENDER_PT_performance(RenderButtonsPanel):
             col = split.column()
         col.label(text="Memory:")
         sub = col.column()
-        sub.enabled = not (rd.use_border or rd.full_sample) 
+        sub.enabled = not (rd.use_border or rd.full_sample)
         sub.prop(rd, "save_buffers")
         sub = col.column()
         sub.active = rd.use_compositing
@@ -246,7 +253,7 @@ class RENDER_PT_post_processing(RenderButtonsPanel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         split = layout.split()
@@ -289,7 +296,7 @@ class RENDER_PT_output(RenderButtonsPanel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         layout.prop(rd, "output_path", text="")
@@ -355,7 +362,7 @@ class RENDER_PT_output(RenderButtonsPanel):
 
         elif rd.file_format == 'QUICKTIME_CARBON':
             split = layout.split()
-            split.operator("scene.render_data_set_quicktime_codec")
+            split.operator("scene.render_set_quicktime_codec")
 
         elif rd.file_format == 'QUICKTIME_QTKIT':
             split = layout.split()
@@ -370,15 +377,17 @@ class RENDER_PT_encoding(RenderButtonsPanel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def poll(self, context):
-        rd = context.scene.render_data
+        rd = context.scene.render
         return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
 
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
+        layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
+
         split = layout.split()
 
         col = split.column()
@@ -419,7 +428,7 @@ class RENDER_PT_encoding(RenderButtonsPanel):
         sub = layout.column()
 
         if rd.ffmpeg_format not in ('MP3'):
-          sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
+            sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
 
         sub.separator()
 
@@ -439,14 +448,14 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw_header(self, context):
-        rd = context.scene.render_data
+        rd = context.scene.render
 
         self.layout.prop(rd, "antialiasing", text="")
 
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
         layout.active = rd.antialiasing
 
@@ -454,7 +463,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
 
         col = split.column()
         col.row().prop(rd, "antialiasing_samples", expand=True)
-        sub = col.row() 
+        sub = col.row()
         sub.enabled = not rd.use_border
         sub.prop(rd, "full_sample")
 
@@ -462,7 +471,7 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
             col = split.column()
         col.prop(rd, "pixel_filter", text="")
         col.prop(rd, "filter_size", text="Size")
-        
+
 
 class RENDER_PT_motion_blur(RenderButtonsPanel):
     bl_label = "Full Sample Motion Blur"
@@ -470,19 +479,20 @@ class RENDER_PT_motion_blur(RenderButtonsPanel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw_header(self, context):
-        rd = context.scene.render_data
+        rd = context.scene.render
 
         self.layout.prop(rd, "motion_blur", text="")
 
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         layout.active = rd.motion_blur
 
         row = layout.row()
         row.prop(rd, "motion_blur_samples")
 
+
 class RENDER_PT_dimensions(RenderButtonsPanel):
     bl_label = "Dimensions"
     COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -491,7 +501,7 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
         layout = self.layout
 
         scene = context.scene
-        rd = scene.render_data
+        rd = scene.render
         wide_ui = context.region.width > narrowui
 
         row = layout.row().split()
@@ -537,14 +547,14 @@ class RENDER_PT_stamp(RenderButtonsPanel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw_header(self, context):
-        rd = context.scene.render_data
+        rd = context.scene.render
 
         self.layout.prop(rd, "render_stamp", text="")
 
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         layout.active = rd.render_stamp
@@ -585,7 +595,7 @@ class RENDER_PT_bake(RenderButtonsPanel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render_data
+        rd = context.scene.render
         wide_ui = context.region.width > narrowui
 
         layout.operator("object.bake_image", icon='RENDER_STILL')
@@ -624,16 +634,33 @@ class RENDER_PT_bake(RenderButtonsPanel):
         sub.prop(rd, "bake_bias")
 
 
-bpy.types.register(RENDER_MT_presets)
-bpy.types.register(RENDER_PT_render)
-bpy.types.register(RENDER_PT_layers)
-bpy.types.register(RENDER_PT_dimensions)
-bpy.types.register(RENDER_PT_antialiasing)
-bpy.types.register(RENDER_PT_motion_blur)
-bpy.types.register(RENDER_PT_shading)
-bpy.types.register(RENDER_PT_output)
-bpy.types.register(RENDER_PT_encoding)
-bpy.types.register(RENDER_PT_performance)
-bpy.types.register(RENDER_PT_post_processing)
-bpy.types.register(RENDER_PT_stamp)
-bpy.types.register(RENDER_PT_bake)
+classes = [
+    RENDER_MT_presets,
+    RENDER_MT_ffmpeg_presets,
+    RENDER_PT_render,
+    RENDER_PT_layers,
+    RENDER_PT_dimensions,
+    RENDER_PT_antialiasing,
+    RENDER_PT_motion_blur,
+    RENDER_PT_shading,
+    RENDER_PT_output,
+    RENDER_PT_encoding,
+    RENDER_PT_performance,
+    RENDER_PT_post_processing,
+    RENDER_PT_stamp,
+    RENDER_PT_bake]
+
+
+def register():
+    register = bpy.types.register
+    for cls in classes:
+        register(cls)
+
+
+def unregister():
+    unregister = bpy.types.unregister
+    for cls in classes:
+        unregister(cls)
+
+if __name__ == "__main__":
+    register()