Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-21 12:34:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-21 12:34:35 +0400
commit1d1d792898c700ac0318d9bad0c99c0203cd06d0 (patch)
tree18dd708190acf6d1f27c8e434b8e78469e052050 /system_demo_mode
parent5b8fd09b3310ad60999c13e7048781e2b556a7f7 (diff)
demo mode fixes
* redraw before rendering (workaround for bug) * play the first file once on init (before first file was assumed to be first file in demo_config.py which often isnt the case)
Diffstat (limited to 'system_demo_mode')
-rw-r--r--system_demo_mode/demo_mode.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/system_demo_mode/demo_mode.py b/system_demo_mode/demo_mode.py
index efccd94a..00b092f6 100644
--- a/system_demo_mode/demo_mode.py
+++ b/system_demo_mode/demo_mode.py
@@ -131,6 +131,12 @@ def demo_mode_auto_select():
def demo_mode_next_file(step=1):
+
+ # support for temp
+ if global_config_files[global_state["demo_index"]].get("is_tmp"):
+ del global_config_files[global_state["demo_index"]]
+ global_state["demo_index"] -= 1
+
print(global_state["demo_index"])
global_state["demo_index"] = (global_state["demo_index"] + step) % len(global_config_files)
print(global_state["demo_index"], "....")
@@ -159,6 +165,22 @@ def demo_mode_load_file():
bpy.ops.wm.demo_mode('EXEC_DEFAULT')
+def demo_mode_temp_file():
+ """ Initialize a temp config for the duration of the play time.
+ Use this so we can initialize the demo intro screen but not show again.
+ """
+ assert(global_state["demo_index"] == 0)
+
+ temp_config = global_config_fallback.copy()
+ temp_config["anim_time_min"] = 0.0
+ temp_config["anim_time_max"] = 60.0
+ temp_config["anim_cycles"] = 1
+ temp_config["mode"] = 'PLAY'
+ temp_config["is_tmp"] = True
+
+ global_config_files.insert(0, temp_config)
+
+
def demo_mode_init():
print("func:demo_mode_init")
DemoKeepAlive.ensure()
@@ -189,6 +211,8 @@ def demo_mode_init():
scene.render.use_file_extension = False
scene.render.use_placeholder = False
try:
+ # XXX - without this rendering will crash because of a bug in blender!
+ bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
if global_config["anim_render"]:
bpy.ops.render.render('INVOKE_DEFAULT', animation=True)
else:
@@ -346,6 +370,8 @@ class DemoMode(bpy.types.Operator):
# load config if not loaded
if not global_config_files:
load_config()
+ demo_mode_temp_file() # play this once through then never again
+
if not global_config_files:
self.report({'INFO'}, "No configuration found with text or file: %s. Run File -> Demo Mode Setup" % DEMO_CFG)
return {'CANCELLED'}