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 /source/blender/makesrna/intern/rna_xr.c
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 'source/blender/makesrna/intern/rna_xr.c')
-rw-r--r--source/blender/makesrna/intern/rna_xr.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c
index d8be9b7e80d..6f43afe23fe 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -691,6 +691,24 @@ static void rna_XrSessionSettings_use_absolute_tracking_set(PointerRNA *ptr, boo
# endif
}
+static int rna_XrSessionSettings_icon_from_show_object_viewport_get(PointerRNA *ptr)
+{
+# ifdef WITH_XR_OPENXR
+ const wmXrData *xr = rna_XrSession_wm_xr_data_get(ptr);
+ return rna_object_type_visibility_icon_get_common(
+ xr->session_settings.object_type_exclude_viewport,
+# if 0
+ /* For the future when selection in VR is reliably supported. */
+ &xr->session_settings.object_type_exclude_select
+# else
+ NULL
+# endif
+ );
+# else
+ return ICON_NONE;
+# endif
+}
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -1944,6 +1962,12 @@ static void rna_def_xr_session_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Custom Overlays", "Show custom VR overlays");
RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
+ prop = RNA_def_property(srna, "show_object_extras", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw_flags", V3D_OFSDRAW_SHOW_OBJECT_EXTRAS);
+ RNA_def_property_ui_text(
+ prop, "Show Object Extras", "Show object extras, including empties, lights, and cameras");
+ RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
+
prop = RNA_def_property(srna, "controller_draw_style", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, controller_draw_styles);
@@ -1982,6 +2006,15 @@ static void rna_def_xr_session_settings(BlenderRNA *brna)
"Absolute Tracking",
"Allow the VR tracking origin to be defined independently of the headset location");
RNA_def_property_update(prop, NC_WM | ND_XR_DATA_CHANGED, NULL);
+
+ rna_def_object_type_visibility_flags_common(srna, NC_WM | ND_XR_DATA_CHANGED);
+
+ /* Helper for drawing the icon. */
+ prop = RNA_def_property(srna, "icon_from_show_object_viewport", PROP_INT, PROP_NONE);
+ RNA_def_property_int_funcs(
+ prop, "rna_XrSessionSettings_icon_from_show_object_viewport_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Visibility Icon", "");
}
/** \} */