cleanup for addon python internals, fix filtering bug.
[blender.git] / release / scripts / ui / properties_render.py
index 75123311c41495c32248d5ca676271e0c6cbdd6f..23dc434ae38f968883cd86d606bc57e4f6e79afc 100644 (file)
@@ -29,6 +29,13 @@ class RENDER_MT_presets(bpy.types.Menu):
     draw = bpy.types.Menu.draw_preset
 
 
     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'
 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):
     # 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)
 
 
         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
 
     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()
         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()
 
         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")
 
 
         layout.prop(rd, "display_mode", text="Display")
 
@@ -71,7 +78,7 @@ class RENDER_PT_layers(RenderButtonsPanel):
         layout = self.layout
 
         scene = context.scene
         layout = self.layout
 
         scene = context.scene
-        rd = scene.render_data
+        rd = scene.render
         wide_ui = context.region.width > narrowui
 
         row = layout.row()
         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
 
     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()
         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
 
     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()
         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()
             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
         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
 
     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()
         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
 
     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="")
         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()
 
         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()
 
         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):
     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
 
         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
 
         wide_ui = context.region.width > narrowui
 
+        layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
+
         split = layout.split()
 
         col = split.column()
         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 = 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()
 
 
         sub.separator()
 
@@ -439,14 +448,14 @@ class RENDER_PT_antialiasing(RenderButtonsPanel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw_header(self, context):
     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
 
 
         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
 
         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)
 
         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")
 
         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")
             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"
 
 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):
     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
 
 
         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")
 
         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'}
 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
         layout = self.layout
 
         scene = context.scene
-        rd = scene.render_data
+        rd = scene.render
         wide_ui = context.region.width > narrowui
 
         row = layout.row().split()
         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):
     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
 
 
         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
         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
 
     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')
         wide_ui = context.region.width > narrowui
 
         layout.operator("object.bake_image", icon='RENDER_STILL')
@@ -626,6 +636,7 @@ class RENDER_PT_bake(RenderButtonsPanel):
 
 classes = [
     RENDER_MT_presets,
 
 classes = [
     RENDER_MT_presets,
+    RENDER_MT_ffmpeg_presets,
     RENDER_PT_render,
     RENDER_PT_layers,
     RENDER_PT_dimensions,
     RENDER_PT_render,
     RENDER_PT_layers,
     RENDER_PT_dimensions,
@@ -645,6 +656,7 @@ def register():
     for cls in classes:
         register(cls)
 
     for cls in classes:
         register(cls)
 
+
 def unregister():
     unregister = bpy.types.unregister
     for cls in classes:
 def unregister():
     unregister = bpy.types.unregister
     for cls in classes:
@@ -652,4 +664,3 @@ def unregister():
 
 if __name__ == "__main__":
     register()
 
 if __name__ == "__main__":
     register()
-