bring back the play option from 2.4x

This commit is contained in:
Campbell Barton 2012-08-06 16:07:11 +00:00
parent 48b59330fe
commit db6c4ba11e
7 changed files with 1156 additions and 42 deletions

@ -28,7 +28,9 @@ import os
def guess_player_path(preset): def guess_player_path(preset):
import sys import sys
if preset == 'BLENDER24': if preset == 'INTERNAL':
return bpy.app.binary_path
elif preset == 'BLENDER24':
player_path = "blender" player_path = "blender"
if sys.platform == "darwin": if sys.platform == "darwin":
@ -110,32 +112,7 @@ class PlayRenderedAnim(Operator):
cmd = [player_path] cmd = [player_path]
# extra options, fps controls etc. # extra options, fps controls etc.
if preset == 'BLENDER24': if preset in {'BLENDER24', 'INTERNAL'}:
# -----------------------------------------------------------------
# Check blender is not 2.5x until it supports playback again
try:
process = subprocess.Popen([player_path, '--version'],
stdout=subprocess.PIPE,
)
except:
# ignore and allow the main execution to catch the problem.
process = None
if process is not None:
process.wait()
out = process.stdout.read()
process.stdout.close()
out_split = out.strip().split()
if out_split[0] == b'Blender':
if not out_split[1].startswith(b'2.4'):
self.report({'ERROR'},
"Blender %s doesn't support playback: %r" %
(out_split[1].decode(), player_path))
return {'CANCELLED'}
del out, out_split
del process
# -----------------------------------------------------------------
opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), opts = ["-a", "-f", str(rd.fps), str(rd.fps_base),
"-j", str(scene.frame_step), file] "-j", str(scene.frame_step), file]
cmd.extend(opts) cmd.extend(opts)

@ -66,6 +66,7 @@ class RENDER_PT_render(RenderButtonsPanel, Panel):
row = layout.row() row = layout.row()
row.operator("render.render", text="Image", icon='RENDER_STILL') row.operator("render.render", text="Image", icon='RENDER_STILL')
row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
row.operator("render.play_rendered_anim", text="Play", icon='RENDER_ANIMATION')
layout.prop(rd, "display_mode", text="Display") layout.prop(rd, "display_mode", text="Display")

@ -1950,9 +1950,6 @@ void init_userdef_do_versions(void)
if (U.dbl_click_time == 0) { if (U.dbl_click_time == 0) {
U.dbl_click_time = 350; U.dbl_click_time = 350;
} }
if (U.anim_player_preset == 0) {
U.anim_player_preset = 1;
}
if (U.scrcastfps == 0) { if (U.scrcastfps == 0) {
U.scrcastfps = 10; U.scrcastfps = 10;
U.scrcastwait = 50; U.scrcastwait = 50;

@ -3450,7 +3450,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
StructRNA *srna; StructRNA *srna;
static EnumPropertyItem anim_player_presets[] = { static EnumPropertyItem anim_player_presets[] = {
/*{0, "INTERNAL", 0, "Internal", "Built-in animation player"}, *//* doesn't work yet! */ {0, "INTERNAL", 0, "Internal", "Built-in animation player"}, /* doesn't work yet! */
{1, "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"}, {2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"},
{3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"}, {3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"},

@ -53,6 +53,7 @@ set(INC_SYS
set(SRC set(SRC
intern/wm.c intern/wm.c
intern/wm_playanim.c
intern/wm_cursors.c intern/wm_cursors.c
intern/wm_dragdrop.c intern/wm_dragdrop.c
intern/wm_draw.c intern/wm_draw.c

File diff suppressed because it is too large Load Diff

@ -453,16 +453,14 @@ static int set_env(int argc, const char **argv, void *UNUSED(data))
return 1; return 1;
} }
static int playback_mode(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) static int playback_mode(int argc, const char **argv, void *UNUSED(data))
{ {
extern void playanim(int argc, const char **argv);
/* not if -b was given first */ /* not if -b was given first */
if (G.background == 0) { if (G.background == 0) {
#if 0 /* TODO, bring player back? */
playanim(argc, argv); /* not the same argc and argv as before */ playanim(argc, argv); /* not the same argc and argv as before */
#else exit(0); /* 2.4x didn't do this */
fprintf(stderr, "Playback mode not supported in blender 2.6x\n");
exit(0);
#endif
} }
return -2; return -2;
@ -1272,11 +1270,6 @@ int main(int argc, const char **argv)
BLI_threadapi_init(); BLI_threadapi_init();
RNA_init();
RE_engines_init();
init_nodesystem();
initglobals(); /* blender.c */ initglobals(); /* blender.c */
IMB_init(); IMB_init();
@ -1297,6 +1290,15 @@ int main(int argc, const char **argv)
BLI_argsParse(ba, 1, NULL, NULL); BLI_argsParse(ba, 1, NULL, NULL);
#endif #endif
/* after level 1 args, this is so playanim skips RNA init */
RNA_init();
RE_engines_init();
init_nodesystem();
/* end second init */
#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS) #if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
G.background = 1; /* python module mode ALWAYS runs in background mode (for now) */ G.background = 1; /* python module mode ALWAYS runs in background mode (for now) */
#else #else