[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49627] trunk/blender: bring back the play option from 2.4x
Campbell Barton
ideasman42 at gmail.com
Mon Aug 6 18:07:12 CEST 2012
Revision: 49627
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49627
Author: campbellbarton
Date: 2012-08-06 16:07:11 +0000 (Mon, 06 Aug 2012)
Log Message:
-----------
bring back the play option from 2.4x
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
trunk/blender/release/scripts/startup/bl_ui/properties_render.py
trunk/blender/source/blender/editors/interface/resources.c
trunk/blender/source/blender/makesrna/intern/rna_userdef.c
trunk/blender/source/blender/windowmanager/CMakeLists.txt
trunk/blender/source/creator/creator.c
Added Paths:
-----------
trunk/blender/source/blender/windowmanager/intern/wm_playanim.c
Modified: trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py 2012-08-06 15:59:09 UTC (rev 49626)
+++ trunk/blender/release/scripts/startup/bl_operators/screen_play_rendered_anim.py 2012-08-06 16:07:11 UTC (rev 49627)
@@ -28,7 +28,9 @@
def guess_player_path(preset):
import sys
- if preset == 'BLENDER24':
+ if preset == 'INTERNAL':
+ return bpy.app.binary_path
+ elif preset == 'BLENDER24':
player_path = "blender"
if sys.platform == "darwin":
@@ -110,32 +112,7 @@
cmd = [player_path]
# extra options, fps controls etc.
- if preset == 'BLENDER24':
- # -----------------------------------------------------------------
- # 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
- # -----------------------------------------------------------------
-
+ if preset in {'BLENDER24', 'INTERNAL'}:
opts = ["-a", "-f", str(rd.fps), str(rd.fps_base),
"-j", str(scene.frame_step), file]
cmd.extend(opts)
Modified: trunk/blender/release/scripts/startup/bl_ui/properties_render.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_render.py 2012-08-06 15:59:09 UTC (rev 49626)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_render.py 2012-08-06 16:07:11 UTC (rev 49627)
@@ -66,6 +66,7 @@
row = layout.row()
row.operator("render.render", text="Image", icon='RENDER_STILL')
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")
Modified: trunk/blender/source/blender/editors/interface/resources.c
===================================================================
--- trunk/blender/source/blender/editors/interface/resources.c 2012-08-06 15:59:09 UTC (rev 49626)
+++ trunk/blender/source/blender/editors/interface/resources.c 2012-08-06 16:07:11 UTC (rev 49627)
@@ -1950,9 +1950,6 @@
if (U.dbl_click_time == 0) {
U.dbl_click_time = 350;
}
- if (U.anim_player_preset == 0) {
- U.anim_player_preset = 1;
- }
if (U.scrcastfps == 0) {
U.scrcastfps = 10;
U.scrcastwait = 50;
Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c 2012-08-06 15:59:09 UTC (rev 49626)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c 2012-08-06 16:07:11 UTC (rev 49627)
@@ -3450,7 +3450,7 @@
StructRNA *srna;
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"},
{2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"},
{3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"},
Modified: trunk/blender/source/blender/windowmanager/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/windowmanager/CMakeLists.txt 2012-08-06 15:59:09 UTC (rev 49626)
+++ trunk/blender/source/blender/windowmanager/CMakeLists.txt 2012-08-06 16:07:11 UTC (rev 49627)
@@ -53,6 +53,7 @@
set(SRC
intern/wm.c
+ intern/wm_playanim.c
intern/wm_cursors.c
intern/wm_dragdrop.c
intern/wm_draw.c
Added: trunk/blender/source/blender/windowmanager/intern/wm_playanim.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_playanim.c (rev 0)
+++ trunk/blender/source/blender/windowmanager/intern/wm_playanim.c 2012-08-06 16:07:11 UTC (rev 49627)
@@ -0,0 +1,1136 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/windowmanager/intern/wm_playanim.c
+ * \ingroup wm
+ *
+ * \note This file uses ghost directly and none of the WM definitions.
+ * this could be made into its own module, alongside creator/
+ */
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#ifndef WIN32
+# include <unistd.h>
+# include <sys/times.h>
+# include <sys/wait.h>
+#else
+# include <io.h>
+#endif
+#include "MEM_guardedalloc.h"
+
+#include "PIL_time.h"
+
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+#include "BLI_path_util.h"
+#include "BLI_fileops.h"
+#include "BLI_rect.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#include "BKE_blender.h"
+#include "BKE_global.h"
+#include "BKE_utildefines.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#ifdef WITH_QUICKTIME
+# ifdef _WIN32
+# include <QTML.h>
+# include <Movies.h>
+# elif defined(__APPLE__)
+# include <QuickTime/Movies.h>
+# endif /* __APPLE__ */
+#endif /* WITH_QUICKTIME */
+
+#include "DNA_scene_types.h"
+#include "BLI_utildefines.h"
+#include "ED_datafiles.h" /* for fonts */
+#include "wm_event_types.h"
+#include "GHOST_C-api.h"
+#include "BLF_api.h"
+
+
+typedef struct PlayState {
+
+ /* playback state */
+ short direction;
+ short next;
+ short once;
+ short turbo;
+ short pingpong;
+ short noskip;
+ short sstep;
+ short pause;
+ short wait2;
+ short stopped;
+ short go;
+
+ /* current picture */
+ struct PlayAnimPict *picture;
+
+ /* set once at the start */
+ int ibufx, ibufy;
+ int fontid;
+
+ /* saves passing args */
+ struct ImBuf *curframe_ibuf;
+} PlayState;
+
+/* for debugging */
+#if 0
+void print_ps(PlayState *ps)
+{
+ printf("ps:\n");
+ printf(" direction=%d,\n", (int)ps->direction);
+ printf(" next=%d,\n", ps->next);
+ printf(" once=%d,\n", ps->once);
+ printf(" turbo=%d,\n", ps->turbo);
+ printf(" pingpong=%d,\n", ps->pingpong);
+ printf(" noskip=%d,\n", ps->noskip);
+ printf(" sstep=%d,\n", ps->sstep);
+ printf(" pause=%d,\n", ps->pause);
+ printf(" wait2=%d,\n", ps->wait2);
+ printf(" stopped=%d,\n", ps->stopped);
+ printf(" go=%d,\n\n", ps->go);
+ fflush(stdout);
+}
+#endif
+
+/* global for window and events */
+typedef enum eWS_Qual {
+ WS_QUAL_LSHIFT = (1 << 0),
+ WS_QUAL_RSHIFT = (1 << 1),
+ WS_QUAL_SHIFT = (WS_QUAL_LSHIFT | WS_QUAL_RSHIFT),
+ WS_QUAL_LALT = (1 << 2),
+ WS_QUAL_RALT = (1 << 3),
+ WS_QUAL_ALT = (WS_QUAL_LALT | WS_QUAL_RALT),
+ WS_QUAL_LCTRL = (1 << 4),
+ WS_QUAL_RCTRL = (1 << 5),
+ WS_QUAL_LMOUSE = (1 << 16),
+ WS_QUAL_MMOUSE = (1 << 17),
+ WS_QUAL_RMOUSE = (1 << 18),
+ WS_QUAL_MOUSE = (WS_QUAL_LMOUSE | WS_QUAL_MMOUSE | WS_QUAL_RMOUSE)
+} eWS_Qual;
+
+static struct WindowStateGlobal {
+ GHOST_SystemHandle ghost_system;
+ void *ghost_window;
+
+ /* events */
+ eWS_Qual qual;
+} g_WS = {NULL};
+
+void playanim_window_get_size(int *width_r, int *height_r)
+{
+ GHOST_RectangleHandle bounds = GHOST_GetClientBounds(g_WS.ghost_window);
+ *width_r = GHOST_GetWidthRectangle(bounds);
+ *height_r = GHOST_GetHeightRectangle(bounds);
+ GHOST_DisposeRectangle(bounds);
+}
+
+/* implementation */
+static void playanim_event_qual_update(void)
+{
+ int val;
+
+ /* Shift */
+ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftShift, &val);
+ if (val) g_WS.qual |= WS_QUAL_LSHIFT;
+ else g_WS.qual &= ~WS_QUAL_LSHIFT;
+
+ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightShift, &val);
+ if (val) g_WS.qual |= WS_QUAL_RSHIFT;
+ else g_WS.qual &= ~WS_QUAL_RSHIFT;
+
+ /* Control */
+ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftControl, &val);
+ if (val) g_WS.qual |= WS_QUAL_LCTRL;
+ else g_WS.qual &= ~WS_QUAL_LCTRL;
+
+ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightControl, &val);
+ if (val) g_WS.qual |= WS_QUAL_RCTRL;
+ else g_WS.qual &= ~WS_QUAL_RCTRL;
+
+ /* Alt */
+ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyLeftAlt, &val);
+ if (val) g_WS.qual |= WS_QUAL_LCTRL;
+ else g_WS.qual &= ~WS_QUAL_LCTRL;
+
+ GHOST_GetModifierKeyState(g_WS.ghost_system, GHOST_kModifierKeyRightAlt, &val);
+ if (val) g_WS.qual |= WS_QUAL_RCTRL;
+ else g_WS.qual &= ~WS_QUAL_RCTRL;
+
+ /* LMB */
+ GHOST_GetButtonState(g_WS.ghost_system, GHOST_kButtonMaskLeft, &val);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list