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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/include/ED_view3d_offscreen.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c10
-rw-r--r--source/blender/makesdna/DNA_view3d_enums.h1
-rw-r--r--source/blender/makesdna/DNA_xr_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_internal.h4
-rw-r--r--source/blender/makesrna/intern/rna_space.c77
-rw-r--r--source/blender/makesrna/intern/rna_space_api.c76
-rw-r--r--source/blender/makesrna/intern/rna_xr.c33
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_draw.c2
-rw-r--r--source/blender/windowmanager/xr/intern/wm_xr_session.c5
10 files changed, 146 insertions, 68 deletions
diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h
index 097308066f3..2217ace2e62 100644
--- a/source/blender/editors/include/ED_view3d_offscreen.h
+++ b/source/blender/editors/include/ED_view3d_offscreen.h
@@ -49,6 +49,8 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph,
struct Scene *scene,
struct View3DShading *shading_override,
eDrawType drawtype,
+ int object_type_exclude_viewport_override,
+ int object_type_exclude_select_override,
int winx,
int winy,
unsigned int draw_flags,
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 5a27349dc7f..5b068750d76 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1723,6 +1723,8 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
Scene *scene,
View3DShading *shading_override,
eDrawType drawtype,
+ int object_type_exclude_viewport_override,
+ int object_type_exclude_select_override,
int winx,
int winy,
uint draw_flags,
@@ -1785,7 +1787,10 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
/* Disable other overlays (set all available _HIDE_ flags). */
v3d.overlay.flag |= V3D_OVERLAY_HIDE_CURSOR | V3D_OVERLAY_HIDE_TEXT |
V3D_OVERLAY_HIDE_MOTION_PATHS | V3D_OVERLAY_HIDE_BONES |
- V3D_OVERLAY_HIDE_OBJECT_XTRAS | V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
+ V3D_OVERLAY_HIDE_OBJECT_ORIGINS;
+ if ((draw_flags & V3D_OFSDRAW_SHOW_OBJECT_EXTRAS) == 0) {
+ v3d.overlay.flag |= V3D_OVERLAY_HIDE_OBJECT_XTRAS;
+ }
v3d.flag |= V3D_HIDE_HELPLINES;
}
@@ -1793,6 +1798,9 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
v3d.flag |= V3D_XR_SESSION_SURFACE;
}
+ v3d.object_type_exclude_viewport = object_type_exclude_viewport_override;
+ v3d.object_type_exclude_select = object_type_exclude_select_override;
+
rv3d.persp = RV3D_PERSP;
v3d.clip_start = clip_start;
v3d.clip_end = clip_end;
diff --git a/source/blender/makesdna/DNA_view3d_enums.h b/source/blender/makesdna/DNA_view3d_enums.h
index f22adc5a462..99e22072045 100644
--- a/source/blender/makesdna/DNA_view3d_enums.h
+++ b/source/blender/makesdna/DNA_view3d_enums.h
@@ -19,6 +19,7 @@ typedef enum eV3DOffscreenDrawFlag {
V3D_OFSDRAW_SHOW_SELECTION = (1 << 3),
V3D_OFSDRAW_XR_SHOW_CONTROLLERS = (1 << 4),
V3D_OFSDRAW_XR_SHOW_CUSTOM_OVERLAYS = (1 << 5),
+ V3D_OFSDRAW_SHOW_OBJECT_EXTRAS = (1 << 6),
} eV3DOffscreenDrawFlag;
/** #View3DShading.light */
diff --git a/source/blender/makesdna/DNA_xr_types.h b/source/blender/makesdna/DNA_xr_types.h
index 09eab0d7bf7..44419c9763f 100644
--- a/source/blender/makesdna/DNA_xr_types.h
+++ b/source/blender/makesdna/DNA_xr_types.h
@@ -36,6 +36,10 @@ typedef struct XrSessionSettings {
float clip_start, clip_end;
int flag;
+
+ /** Object type settings to apply to VR view (unlike shading, not shared with window 3D-View). */
+ int object_type_exclude_viewport;
+ int object_type_exclude_select;
} XrSessionSettings;
typedef enum eXrSessionFlag {
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index b941245bcfc..bf4eec433c4 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -318,6 +318,10 @@ void rna_object_vcollayer_name_set(struct PointerRNA *ptr,
PointerRNA rna_object_shapekey_index_get(struct ID *id, int value);
int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current);
+void rna_def_object_type_visibility_flags_common(StructRNA *srna, int noteflag);
+int rna_object_type_visibility_icon_get_common(int object_type_exclude_viewport,
+ const int *object_type_exclude_select);
+
/* ViewLayer related functions defined in rna_scene.c but required in rna_layer.c */
void rna_def_freestyle_settings(struct BlenderRNA *brna);
struct PointerRNA rna_FreestyleLineSet_linestyle_get(struct PointerRNA *ptr);
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);
diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c
index 06bb2207b0a..b3896919275 100644
--- a/source/blender/makesrna/intern/rna_space_api.c
+++ b/source/blender/makesrna/intern/rna_space_api.c
@@ -4,6 +4,8 @@
* \ingroup RNA
*/
+#include "DNA_object_types.h"
+
#include "RNA_access.h"
#include "RNA_define.h"
@@ -17,6 +19,21 @@
# include "ED_screen.h"
# include "ED_text.h"
+int rna_object_type_visibility_icon_get_common(int object_type_exclude_viewport,
+ const int *object_type_exclude_select)
+{
+ const int view_value = (object_type_exclude_viewport != 0);
+
+ if (object_type_exclude_select) {
+ /* Ignore selection values when view is off,
+ * intent is to show if visible objects aren't selectable. */
+ const int select_value = (*object_type_exclude_select & ~object_type_exclude_viewport) != 0;
+ return ICON_VIS_SEL_11 + (view_value << 1) + select_value;
+ }
+
+ return view_value ? ICON_HIDE_ON : ICON_HIDE_OFF;
+}
+
static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d, bContext *C)
{
bScreen *screen = (bScreen *)id;
@@ -102,6 +119,65 @@ void RNA_api_space_text(StructRNA *srna)
RNA_def_function_output(func, parm);
}
+void rna_def_object_type_visibility_flags_common(StructRNA *srna, int noteflag)
+{
+ PropertyRNA *prop;
+
+ 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, noteflag, NULL);
+ }
+ }
+}
+
void RNA_api_space_filebrowser(StructRNA *srna)
{
FunctionRNA *func;
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", "");
}
/** \} */
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_draw.c b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
index 303ecca17f0..3b1acee2b99 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_draw.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_draw.c
@@ -160,6 +160,8 @@ void wm_xr_draw_view(const GHOST_XrDrawViewInfo *draw_view, void *customdata)
draw_data->scene,
&settings->shading,
(eDrawType)settings->shading.type,
+ settings->object_type_exclude_viewport,
+ settings->object_type_exclude_select,
draw_view->width,
draw_view->height,
display_flags,
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.c b/source/blender/windowmanager/xr/intern/wm_xr_session.c
index f1ccaadc1e4..0a76fd0a25f 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_session.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_session.c
@@ -1212,6 +1212,11 @@ void wm_xr_session_actions_update(wmWindowManager *wm)
xr->runtime->area = ED_area_offscreen_create(win, SPACE_VIEW3D);
}
+ /* Set XR area object type flags for operators. */
+ View3D *v3d = xr->runtime->area->spacedata.first;
+ v3d->object_type_exclude_viewport = settings->object_type_exclude_viewport;
+ v3d->object_type_exclude_select = settings->object_type_exclude_select;
+
wm_xr_session_events_dispatch(xr, xr_context, active_action_set, state, win);
}
}