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:
authorJulian Eisel <eiseljulian@gmail.com>2020-02-16 22:17:34 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-02-16 22:17:34 +0300
commit52d383c574b1077c09858e865f9db9a1a7b16ba8 (patch)
tree94fa8ca8f8571a98341a232ecad7dcc843b8247b
parent6cbec3e789a6566b3a98cdcbc3b5c56612fa5e63 (diff)
Always keep an active VR pose bookmark (as fallback)
-rw-r--r--viewport_vr_preview.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/viewport_vr_preview.py b/viewport_vr_preview.py
index 3e5b0b9c..e5d66d34 100644
--- a/viewport_vr_preview.py
+++ b/viewport_vr_preview.py
@@ -252,9 +252,12 @@ class VIEW3D_OT_vr_pose_bookmark_remove(bpy.types.Operator):
def execute(self, context):
wm = context.window_manager
bookmarks = wm.vr_pose_bookmarks
- bookmark_active_idx = wm.vr_pose_bookmarks_active
- bookmarks.remove(bookmark_active_idx)
+ if len(bookmarks) > 1:
+ bookmark_active_idx = wm.vr_pose_bookmarks_active
+ bookmarks.remove(bookmark_active_idx)
+
+ wm.vr_pose_bookmarks_active -= 1
return {'FINISHED'}
@@ -453,6 +456,12 @@ def register():
name="Show Virtual Camera"
)
+ # Ensure there's a default bookmark (scene camera by default).
+ bookmarks = bpy.context.window_manager.vr_pose_bookmarks
+ if len(bookmarks) == 0:
+ bookmarks.add()
+ bookmarks[0].type = 'SCENE_CAMERA'
+
def unregister():
for cls in classes: