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_space.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_space.c')
-rw-r--r--source/blender/makesrna/intern/rna_space.c77
1 files changed, 10 insertions, 67 deletions
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 032ef86c172..1a9e7f5aad8 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1515,12 +1515,8 @@ static void rna_SpaceView3D_mirror_xr_session_update(Main *main,
static int rna_SpaceView3D_icon_from_show_object_viewport_get(PointerRNA *ptr)
{
const View3D *v3d = (View3D *)ptr->data;
- /* Ignore selection values when view is off,
- * intent is to show if visible objects aren't selectable. */
- const int view_value = (v3d->object_type_exclude_viewport != 0);
- const int select_value = (v3d->object_type_exclude_select &
- ~v3d->object_type_exclude_viewport) != 0;
- return ICON_VIS_SEL_11 + (view_value << 1) + select_value;
+ return rna_object_type_visibility_icon_get_common(v3d->object_type_exclude_viewport,
+ &v3d->object_type_exclude_select);
}
static char *rna_View3DShading_path(PointerRNA *UNUSED(ptr))
@@ -4997,68 +4993,15 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_update(
prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_mirror_xr_session_update");
- {
- struct {
- const char *name;
- int type_mask;
- const char *identifier[2];
- } info[] = {
- {"Mesh", (1 << OB_MESH), {"show_object_viewport_mesh", "show_object_select_mesh"}},
- {"Curve",
- (1 << OB_CURVES_LEGACY),
- {"show_object_viewport_curve", "show_object_select_curve"}},
- {"Surface", (1 << OB_SURF), {"show_object_viewport_surf", "show_object_select_surf"}},
- {"Meta", (1 << OB_MBALL), {"show_object_viewport_meta", "show_object_select_meta"}},
- {"Font", (1 << OB_FONT), {"show_object_viewport_font", "show_object_select_font"}},
- {"Hair Curves",
- (1 << OB_CURVES),
- {"show_object_viewport_curves", "show_object_select_curves"}},
- {"Point Cloud",
- (1 << OB_POINTCLOUD),
- {"show_object_viewport_pointcloud", "show_object_select_pointcloud"}},
- {"Volume", (1 << OB_VOLUME), {"show_object_viewport_volume", "show_object_select_volume"}},
- {"Armature",
- (1 << OB_ARMATURE),
- {"show_object_viewport_armature", "show_object_select_armature"}},
- {"Lattice",
- (1 << OB_LATTICE),
- {"show_object_viewport_lattice", "show_object_select_lattice"}},
- {"Empty", (1 << OB_EMPTY), {"show_object_viewport_empty", "show_object_select_empty"}},
- {"Grease Pencil",
- (1 << OB_GPENCIL),
- {"show_object_viewport_grease_pencil", "show_object_select_grease_pencil"}},
- {"Camera", (1 << OB_CAMERA), {"show_object_viewport_camera", "show_object_select_camera"}},
- {"Light", (1 << OB_LAMP), {"show_object_viewport_light", "show_object_select_light"}},
- {"Speaker",
- (1 << OB_SPEAKER),
- {"show_object_viewport_speaker", "show_object_select_speaker"}},
- {"Light Probe",
- (1 << OB_LIGHTPROBE),
- {"show_object_viewport_light_probe", "show_object_select_light_probe"}},
- };
-
- const char *view_mask_member[2] = {
- "object_type_exclude_viewport",
- "object_type_exclude_select",
- };
- for (int mask_index = 0; mask_index < 2; mask_index++) {
- for (int type_index = 0; type_index < ARRAY_SIZE(info); type_index++) {
- prop = RNA_def_property(
- srna, info[type_index].identifier[mask_index], PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(
- prop, NULL, view_mask_member[mask_index], info[type_index].type_mask);
- RNA_def_property_ui_text(prop, info[type_index].name, "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING, NULL);
- }
- }
+ rna_def_object_type_visibility_flags_common(srna,
+ NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_SHADING);
- /* 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_SpaceView3D_icon_from_show_object_viewport_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Visibility Icon", "");
- }
+ /* 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_SpaceView3D_icon_from_show_object_viewport_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Visibility Icon", "");
/* Nested Structs */
prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);