render presets, select from a directory, button to add own presets

This commit is contained in:
Campbell Barton
2009-11-21 21:39:20 +00:00
parent d875f4927e
commit 5e7debcecf
10 changed files with 156 additions and 17 deletions

View File

@@ -22,6 +22,18 @@ import bpy
narrowui = 180
class RENDER_MT_presets(bpy.types.Menu):
'''
Creates the menu items by scanning scripts/templates
'''
bl_label = "Render Presets"
def draw(self, context):
import os
template_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "presets", "render")
self.path_menu(template_dir, "script.python_file_run")
class RenderButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -502,6 +514,11 @@ class RENDER_PT_dimensions(RenderButtonsPanel):
sub.itemR(rd, "fps")
sub.itemR(rd, "fps_base", text="/")
sub = col.split(percentage=0.75)
sub.itemM("RENDER_MT_presets", text="Presets")
sub.itemO("render.preset_add", text="Add")
class RENDER_PT_stamp(RenderButtonsPanel):
bl_label = "Stamp"
@@ -548,6 +565,9 @@ class RENDER_PT_stamp(RenderButtonsPanel):
sub.active = rd.stamp_note
sub.itemR(rd, "stamp_note_text", text="")
bpy.types.register(RENDER_MT_presets)
bpy.types.register(RENDER_PT_render)
bpy.types.register(RENDER_PT_layers)
bpy.types.register(RENDER_PT_dimensions)

View File

@@ -177,22 +177,8 @@ class TEXT_MT_templates(bpy.types.Menu):
def draw(self, context):
import os
def path_to_name(f):
f_base = os.path.splitext(f)[0]
f_base = f_base.replace("_", " ")
return ' '.join([w[0].upper() + w[1:] for w in f_base.split()])
layout = self.layout
template_dir = os.path.join(os.path.dirname(__file__), os.path.pardir, "templates")
for f in sorted(os.listdir(template_dir)):
if f.startswith("."):
continue
path = os.path.join(template_dir, f)
layout.item_stringO("text.open", "path", path, text=path_to_name(f))
self.path_menu(template_dir, "text.open")
class TEXT_MT_edit_view(bpy.types.Menu):