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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kim <pk15950@gmail.com>2022-04-30 10:23:43 +0300
committerPeter Kim <pk15950@gmail.com>2022-04-30 10:23:43 +0300
commit5c92c04518b5dc7c57c3b3a9e81b45879af2e080 (patch)
tree7c4f0dee8132ae57fc896989f8e7d5839460c9d1 /release/scripts
parent2fc6563a597ad8877fea5e580c87eb4e13e58961 (diff)
XR: Add object extras, object types visibility session options
This allows object extras such as image-empties to be shown in the VR viewport/headset display. Being able to see reference images in VR can be useful for architectural walkthroughs and 3D modeling applications. Since users may not want to see all object extras (lights, cameras, etc.), per-object-type visibility settings are also added as session options. By slightly refactoring the definition of the 3D View object types visibility panel (note: no functional changes), the VR Scene Inspection add-on can show a similar panel without duplicating code. When VR selection is possible in the future, the object type select options can also be enabled. Reviewed By: Severin Differential Revision: https://developer.blender.org/D14220
Diffstat (limited to 'release/scripts')
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 9aebb4427d2..4f1d001b2f3 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5684,13 +5684,14 @@ class VIEW3D_PT_object_type_visibility(Panel):
bl_label = "View Object Types"
bl_ui_units_x = 7
- def draw(self, context):
+ # Allows derived classes to pass view data other than context.space_data.
+ # This is used by the official VR add-on, which passes XrSessionSettings
+ # since VR has a 3D view that only exists for the duration of the VR session.
+ def draw_ex(self, context, view, show_select):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
- view = context.space_data
-
layout.label(text="Object Types Visibility")
layout.separator()
col = layout.column()
@@ -5728,19 +5729,25 @@ class VIEW3D_PT_object_type_visibility(Panel):
continue
attr_v = "show_object_viewport_" + attr
- attr_s = "show_object_select_" + attr
-
icon_v = 'HIDE_OFF' if getattr(view, attr_v) else 'HIDE_ON'
- icon_s = 'RESTRICT_SELECT_OFF' if getattr(view, attr_s) else 'RESTRICT_SELECT_ON'
row = col.row(align=True)
row.alignment = 'RIGHT'
row.label(text=attr_name)
row.prop(view, attr_v, text="", icon=icon_v, emboss=False)
- rowsub = row.row(align=True)
- rowsub.active = getattr(view, attr_v)
- rowsub.prop(view, attr_s, text="", icon=icon_s, emboss=False)
+
+ if show_select:
+ attr_s = "show_object_select_" + attr
+ icon_s = 'RESTRICT_SELECT_OFF' if getattr(view, attr_s) else 'RESTRICT_SELECT_ON'
+
+ rowsub = row.row(align=True)
+ rowsub.active = getattr(view, attr_v)
+ rowsub.prop(view, attr_s, text="", icon=icon_s, emboss=False)
+
+ def draw(self, context):
+ view = context.space_data
+ self.draw_ex(context, view, True)
class VIEW3D_PT_shading(Panel):