[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25348] trunk/blender: Description and more presets for animation players (rv / framecycler).

Matt Ebb matt at mke3.net
Mon Dec 14 00:30:19 CET 2009


Revision: 25348
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25348
Author:   broken
Date:     2009-12-14 00:30:18 +0100 (Mon, 14 Dec 2009)

Log Message:
-----------
Description and more presets for animation players (rv / framecycler).

Also put a bit more logic for guessing player paths based on my system. 
If anyone can make this a bit more clever/bulletproof, please feel free to 
get involved in it, it's all python!

Modified Paths:
--------------
    trunk/blender/release/scripts/op/screen_play_rendered_anim.py
    trunk/blender/source/blender/editors/interface/resources.c
    trunk/blender/source/blender/makesrna/intern/rna_userdef.c

Modified: trunk/blender/release/scripts/op/screen_play_rendered_anim.py
===================================================================
--- trunk/blender/release/scripts/op/screen_play_rendered_anim.py	2009-12-13 22:48:11 UTC (rev 25347)
+++ trunk/blender/release/scripts/op/screen_play_rendered_anim.py	2009-12-13 23:30:18 UTC (rev 25348)
@@ -24,7 +24,7 @@
 # Originally written by Matt Ebb
 
 import bpy
-import subprocess, platform
+import subprocess, os, platform
 
 # from BKE_add_image_extension()
 img_format_exts = {
@@ -50,8 +50,35 @@
     'THEORA':'ogg',
     }
 
+def guess_player_path(preset):
+    if preset == 'BLENDER24':
+        player_path = 'blender'
+        
+        if platform.system() == 'Darwin':
+            test_path = '/Applications/blender 2.49.app/Contents/MacOS/blender'
+            if os.path.exists(test_path):
+                player_path = test_path
+
+    elif preset == 'DJV':
+        player_path = 'djv_view'
+        
+        if platform.system() == 'Darwin':
+            test_path = '/Applications/djv-0.8.2.app/Contents/Resources/bin/djv_view'
+            if os.path.exists(test_path):
+                player_path = test_path
+    
+    elif preset == 'FRAMECYCLER':
+        player_path = 'framecycler'
+    
+    elif preset == 'RV':
+        player_path = 'rv'
+    
+    
+    return player_path
+
+
 class PlayRenderedAnim(bpy.types.Operator):
-
+    '''Plays back rendered frames/movies using an external player.'''
     bl_idname = "screen.play_rendered_anim"
     bl_label = "Play Rendered Animation"
     bl_register = True
@@ -67,13 +94,14 @@
         
         # 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'
+            player_path = guess_player_path(preset)
         
         # doesn't support ### frame notation yet
-        file = "%s%04d" % (bpy.utils.expandpath(rd.output_path), sce.start_frame)
+        if preset in ('BLENDER24', 'DJV', 'CUSTOM'):
+            file = "%s%04d" % (bpy.utils.expandpath(rd.output_path), sce.start_frame)
+        elif preset in ('FRAMECYCLER', 'RV'):
+            file = "%s#" % bpy.utils.expandpath(rd.output_path)
+        
         if rd.file_extensions:
             file += '.' + img_format_exts[rd.file_format]
         
@@ -85,6 +113,12 @@
         elif preset == 'DJV':
             opts = [file, "-playback_speed", str(rd.fps)]
             cmd.extend(opts)
+        elif preset == 'FRAMECYCLER':
+            opts = [file, "%d-%d" % (sce.start_frame, sce.end_frame)]
+            cmd.extend(opts)
+        elif preset == 'RV':
+            opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file]
+            cmd.extend(opts)
         else: # 'CUSTOM'
             cmd.extend(file)
 
@@ -93,6 +127,7 @@
             process = subprocess.Popen(cmd)
         except:
             pass
+            #raise OSError("Couldn't find an external animation player.")
 
         return('FINISHED',)
 

Modified: trunk/blender/source/blender/editors/interface/resources.c
===================================================================
--- trunk/blender/source/blender/editors/interface/resources.c	2009-12-13 22:48:11 UTC (rev 25347)
+++ trunk/blender/source/blender/editors/interface/resources.c	2009-12-13 23:30:18 UTC (rev 25348)
@@ -1283,6 +1283,9 @@
 	if (U.dbl_click_time == 0) {
 		U.dbl_click_time = 350;
 	}
+	if (U.anim_player_preset == 0) {
+		U.anim_player_preset =1 ;
+	}
 
 	/* funny name, but it is GE stuff, moves userdef stuff to engine */
 // XXX	space_set_commmandline_options();

Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2009-12-13 22:48:11 UTC (rev 25347)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c	2009-12-13 23:30:18 UTC (rev 25348)
@@ -2360,9 +2360,11 @@
 	
 	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"},
+		{1, "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"},
+		{3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"},
+		{4, "RV", 0, "rv", "Frame player from Tweak Software"},
+		{50, "CUSTOM", 0, "Custom", "Custom animation player executable path"},
 		{0, NULL, 0, NULL, NULL}};
 	
 	srna= RNA_def_struct(brna, "UserPreferencesFilePaths", NULL);
@@ -2430,6 +2432,7 @@
 	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");
+	RNA_def_property_enum_default(prop, 1);		/* set default to blender 2.4 player until an internal one is back */
 	
 	/* Autosave  */
 





More information about the Bf-blender-cvs mailing list