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>2021-03-15 08:56:41 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-15 09:01:58 +0300
commita4b23075edd0b3f92f0766b04eaf891f5d4a8f00 (patch)
treeb147ed8971d2a924b601ef2848d83c358dd7933e /system_demo_mode
parenta34b1cee5169b6b8a53b7cd0eca49b444e274ab1 (diff)
system_demo_mode: fix screen switching
Replace screen switching with workspace switching.
Diffstat (limited to 'system_demo_mode')
-rw-r--r--system_demo_mode/demo_mode.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/system_demo_mode/demo_mode.py b/system_demo_mode/demo_mode.py
index 8c45448b..d03dc493 100644
--- a/system_demo_mode/demo_mode.py
+++ b/system_demo_mode/demo_mode.py
@@ -274,17 +274,18 @@ def demo_mode_update():
if global_config["anim_screen_switch"]:
# print(time_delta, 1)
if time_delta > global_config["anim_screen_switch"]:
-
- screen = bpy.context.window.screen
- index = bpy.data.screens.keys().index(screen.name)
- screen_new = bpy.data.screens[(index if index > 0 else len(bpy.data.screens)) - 1]
- bpy.context.window.screen = screen_new
+ window = bpy.context.window
+ scene = window.scene
+ workspace = window.workspace
+ index = bpy.data.workspaces.keys().index(workspace.name)
+ workspace_new = bpy.data.workspaces[(index + 1) % len(bpy.data.workspaces)]
+ window.workspace = workspace_new
global_state["last_switch"] = time_current
- # if we also switch scenes then reset last frame
- # otherwise it could mess up cycle calc.
- if screen.scene != screen_new.scene:
+ # If we also switch scenes then reset last frame
+ # otherwise it could mess up cycle calculation.
+ if scene != window.scene:
global_state["last_frame"] = -1
#if global_config["mode"] == 'PLAY':