[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25307] trunk/blender: Added back rendered animation playback (in a sense), with a

Matt Ebb matt at mke3.net
Fri Dec 11 09:05:05 CET 2009


Revision: 25307
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25307
Author:   broken
Date:     2009-12-11 09:05:05 +0100 (Fri, 11 Dec 2009)

Log Message:
-----------
Added back rendered animation playback (in a sense), with a 
customisable player.

You can choose a player in User Preferences -> File Paths. You can 
choose a plan custom command line, otherwise there are presets available
for the Blender 2.4 player or DJV (where it will give it the correct filename, 
fps, etc on the command line). So for example if you have a Blender 2.4 
version installed, you can enter the path to the blender 2.4 executable, 
and the playback will work just like before.

Any info on other frame players (FrameCycler? pdplayer?) and their 
command line settings could be useful for adding some more presets too, 
if anyone knows of them.

It's available in Render->Play Rendered Animation (Ctrl F11)

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_info.py
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/source/blender/editors/screen/screen_ops.c
    trunk/blender/source/blender/makesdna/DNA_userdef_types.h
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Added Paths:
-----------
    trunk/blender/release/scripts/op/screen_play_rendered_anim.py

Added: trunk/blender/release/scripts/op/screen_play_rendered_anim.py
===================================================================
--- trunk/blender/release/scripts/op/screen_play_rendered_anim.py	                        (rev 0)
+++ trunk/blender/release/scripts/op/screen_play_rendered_anim.py	2009-12-11 08:05:05 UTC (rev 25307)
@@ -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

Modified: trunk/blender/release/scripts/ui/space_info.py
===================================================================
--- trunk/blender/release/scripts/ui/space_info.py	2009-12-11 05:23:00 UTC (rev 25306)
+++ trunk/blender/release/scripts/ui/space_info.py	2009-12-11 08:05:05 UTC (rev 25307)
@@ -261,6 +261,7 @@
         layout.separator()
 
         layout.operator("screen.render_view_show")
+        layout.operator("screen.play_rendered_anim")
 
 
 class INFO_MT_help(bpy.types.Menu):

Modified: trunk/blender/release/scripts/ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/ui/space_userpref.py	2009-12-11 05:23:00 UTC (rev 25306)
+++ trunk/blender/release/scripts/ui/space_userpref.py	2009-12-11 08:05:05 UTC (rev 25307)
@@ -1083,6 +1083,7 @@
         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 @@
         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:")

Modified: trunk/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_ops.c	2009-12-11 05:23:00 UTC (rev 25306)
+++ trunk/blender/source/blender/editors/screen/screen_ops.c	2009-12-11 08:05:05 UTC (rev 25307)
@@ -3877,6 +3877,7 @@
 	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__

Modified: trunk/blender/source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2009-12-11 05:23:00 UTC (rev 25306)
+++ trunk/blender/source/blender/makesdna/DNA_userdef_types.h	2009-12-11 08:05:05 UTC (rev 25307)
@@ -286,10 +286,11 @@
 	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;

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2009-12-11 05:23:00 UTC (rev 25306)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2009-12-11 08:05:05 UTC (rev 25307)
@@ -2358,6 +2358,13 @@
 	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 @@
 	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);





More information about the Bf-blender-cvs mailing list