diff options
-rw-r--r-- | release/scripts/op/screen_play_rendered_anim.py | 99 | ||||
-rw-r--r-- | release/scripts/ui/space_info.py | 1 | ||||
-rw-r--r-- | release/scripts/ui/space_userpref.py | 4 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 16 |
6 files changed, 125 insertions, 3 deletions
diff --git a/release/scripts/op/screen_play_rendered_anim.py b/release/scripts/op/screen_play_rendered_anim.py new file mode 100644 index 00000000000..e98fa45cbaa --- /dev/null +++ b/release/scripts/op/screen_play_rendered_anim.py @@ -0,0 +1,99 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# Script copyright (C) Campbell J Barton +# +# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ***** END GPL LICENCE BLOCK ***** +# -------------------------------------------------------------------------- + +# History +# +# Originally written by Matt Ebb + +import bpy +import subprocess, platform + +# from BKE_add_image_extension() +img_format_exts = { + 'IRIS':'.rgb', + 'RADHDR':'.hdr', + 'PNG':'png', + 'TARGA':'tga', + 'RAWTARGA':'tga', + 'BMP':'bmp', + 'TIFF':'tif', + 'OPENEXR':'exr', + 'MULTILAYER':'exr', + 'CINEON':'cin', + 'DPX':'dpx', + 'JPEG':'jpg', + 'JPEG2000':'jp2', + 'QUICKTIME_QTKIT':'mov', + 'QUICKTIME_CARBON':'mov', + 'AVIRAW':'avi', + 'AVIJPEG':'avi', + 'AVICODEC':'avi', + 'XVID':'avi', + 'THEORA':'ogg', + } + +class PlayRenderedAnim(bpy.types.Operator): + + bl_idname = "screen.play_rendered_anim" + bl_label = "Play Rendered Animation" + bl_register = True + bl_undo = False + + def execute(self, context): + sce = context.scene + rd = sce.render_data + prefs = context.user_preferences + + preset = prefs.filepaths.animation_player_preset + player_path = prefs.filepaths.animation_player + + # try and guess a command line if it doesn't exist + if player_path == '': + if preset == 'BLENDER24': + player_path = 'blender' + elif preset == 'DJV': + player_path = 'djv_view' + + # doesn't support ### frame notation yet + file = "%s%04d" % (rd.output_path, sce.start_frame) + if rd.file_extensions: + file += '.' + img_format_exts[rd.file_format] + + cmd = [player_path] + # extra options, fps controls etc. + if preset == 'BLENDER24': + opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), file] + cmd.extend(opts) + elif preset == 'DJV': + opts = [file, "-playback_speed", str(rd.fps)] + cmd.extend(opts) + else: # 'CUSTOM' + cmd.extend(file) + + # launch it + try: + process = subprocess.Popen(cmd) + except: + pass + + return('FINISHED',) + +bpy.ops.add(PlayRenderedAnim)
\ No newline at end of file diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 1543e6bf263..37075ac3188 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -261,6 +261,7 @@ class INFO_MT_render(bpy.types.Menu): layout.separator() layout.operator("screen.render_view_show") + layout.operator("screen.play_rendered_anim") class INFO_MT_help(bpy.types.Menu): diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 1ec01c31eca..383e7ce4e9c 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -1083,6 +1083,7 @@ class USERPREF_PT_file(bpy.types.Panel): sub.label(text="Scripts:") sub.label(text="Sounds:") sub.label(text="Temp:") + sub.label(text="Animation Player:") sub = col1.column() sub.prop(paths, "fonts_directory", text="") @@ -1093,6 +1094,9 @@ class USERPREF_PT_file(bpy.types.Panel): sub.prop(paths, "python_scripts_directory", text="") sub.prop(paths, "sounds_directory", text="") sub.prop(paths, "temporary_directory", text="") + subsplit = sub.split(percentage=0.3) + subsplit.prop(paths, "animation_player_preset", text="") + subsplit.prop(paths, "animation_player", text="") col = split.column() col.label(text="Save & Load:") diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index b67001a454c..fe2bc58faf2 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3877,6 +3877,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf) RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_render", F12KEY, KM_PRESS, KM_CTRL, 0)->ptr, "animation", 1); WM_keymap_add_item(keymap, "SCREEN_OT_render_view_cancel", ESCKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SCREEN_OT_render_view_show", F11KEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "SCREEN_OT_play_rendered_anim", F11KEY, KM_PRESS, KM_CTRL, 0); /* user prefs */ #ifdef __APPLE__ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 82e6cebe71e..c6b1bf0b3f6 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -286,10 +286,11 @@ typedef struct UserDef { char plugseqdir[160]; char pythondir[160]; char sounddir[160]; - /* yafray: temporary xml export directory */ - char yfexportdir[160]; + char anim_player[240]; // FILE_MAX length + int anim_player_preset; + int pad; + short versions; - short dbl_click_time; int gameflags; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f695936d47c..21e601c3ba3 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2358,6 +2358,13 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) PropertyRNA *prop; StructRNA *srna; + static EnumPropertyItem anim_player_presets[] = { + //{0, "INTERNAL", 0, "Internal", "Built-in animation player"}, // doesn't work yet! + {0, "BLENDER24", 0, "Blender 2.4", "Blender command line animation playback - path to Blender 2.4"}, + {2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"}, + {3, "CUSTOM", 0, "Custom", "Custom animation player executable path"}, + {0, NULL, 0, NULL, NULL}}; + srna= RNA_def_struct(brna, "UserPreferencesFilePaths", NULL); RNA_def_struct_sdna(srna, "UserDef"); RNA_def_struct_nested(brna, srna, "UserPreferences"); @@ -2414,7 +2421,16 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) prop= RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "tempdir"); RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files."); + + prop= RNA_def_property(srna, "animation_player", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_sdna(prop, NULL, "anim_player"); + RNA_def_property_ui_text(prop, "Animation Player", "Path to a custom animation/frame sequence player."); + prop= RNA_def_property(srna, "animation_player_preset", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "anim_player_preset"); + RNA_def_property_enum_items(prop, anim_player_presets); + RNA_def_property_ui_text(prop, "Animation Player Preset", "Preset configs for external animation players"); + /* Autosave */ prop= RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE); |