Always keep an active VR pose bookmark (as fallback)

This commit is contained in:
Julian Eisel 2020-02-16 20:17:34 +01:00
parent 6cbec3e789
commit 52d383c574
1 changed files with 11 additions and 2 deletions

View File

@ -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: