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:
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm.c61
-rw-r--r--source/blender/windowmanager/intern/wm_files.c6
-rw-r--r--source/blender/windowmanager/intern/wm_window.c2
3 files changed, 68 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 40d9b0b9a35..d113669a998 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -95,6 +95,33 @@ static void window_manager_foreach_id(ID *id, LibraryForeachIDData *data)
static void write_wm_xr_data(BlendWriter *writer, wmXrData *xr_data)
{
BKE_screen_view3d_shading_blend_write(writer, &xr_data->session_settings.shading);
+
+ LISTBASE_FOREACH (XrActionMap *, am, &xr_data->session_settings.actionmaps) {
+ BLO_write_struct(writer, XrActionMap, am);
+
+ LISTBASE_FOREACH (XrActionMapItem *, ami, &am->items) {
+ BLO_write_struct(writer, XrActionMapItem, ami);
+ if (ami->op[0] && ami->op_properties) {
+ IDP_BlendWrite(writer, ami->op_properties);
+ }
+
+ LISTBASE_FOREACH (XrUserPath *, user_path, &ami->user_paths) {
+ BLO_write_struct(writer, XrUserPath, user_path);
+ }
+
+ LISTBASE_FOREACH (XrActionMapBinding *, amb, &ami->bindings) {
+ BLO_write_struct(writer, XrActionMapBinding, amb);
+
+ LISTBASE_FOREACH (XrComponentPath *, component_path, &amb->component_paths) {
+ BLO_write_struct(writer, XrComponentPath, component_path);
+ }
+ }
+ }
+ }
+
+ LISTBASE_FOREACH (XrMotionCaptureObject *, mocap_ob, &xr_data->session_settings.mocap_objects) {
+ BLO_write_struct(writer, XrMotionCaptureObject, mocap_ob);
+ }
}
static void window_manager_blend_write(BlendWriter *writer, ID *id, const void *id_address)
@@ -123,6 +150,36 @@ static void window_manager_blend_write(BlendWriter *writer, ID *id, const void *
static void direct_link_wm_xr_data(BlendDataReader *reader, wmXrData *xr_data)
{
BKE_screen_view3d_shading_blend_read_data(reader, &xr_data->session_settings.shading);
+
+ BLO_read_list(reader, &xr_data->session_settings.actionmaps);
+
+ LISTBASE_FOREACH (XrActionMap *, am, &xr_data->session_settings.actionmaps) {
+ BLO_read_list(reader, &am->items);
+
+ LISTBASE_FOREACH (XrActionMapItem *, ami, &am->items) {
+ if (ami->op[0] && ami->op_properties) {
+ BLO_read_data_address(reader, &ami->op_properties);
+ IDP_BlendDataRead(reader, &ami->op_properties);
+
+ ami->op_properties_ptr = MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr");
+ WM_operator_properties_create(ami->op_properties_ptr, ami->op);
+ ami->op_properties_ptr->data = ami->op_properties;
+ }
+ else {
+ ami->op_properties = NULL;
+ ami->op_properties_ptr = NULL;
+ }
+
+ BLO_read_list(reader, &ami->user_paths);
+ BLO_read_list(reader, &ami->bindings);
+
+ LISTBASE_FOREACH (XrActionMapBinding *, amb, &ami->bindings) {
+ BLO_read_list(reader, &amb->component_paths);
+ }
+ }
+ }
+
+ BLO_read_list(reader, &xr_data->session_settings.mocap_objects);
}
static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
@@ -216,6 +273,10 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id)
static void lib_link_wm_xr_data(BlendLibReader *reader, ID *parent_id, wmXrData *xr_data)
{
BLO_read_id_address(reader, parent_id->lib, &xr_data->session_settings.base_pose_object);
+
+ LISTBASE_FOREACH (XrMotionCaptureObject *, mocap_ob, &xr_data->session_settings.mocap_objects) {
+ BLO_read_id_address(reader, parent_id->lib, &mocap_ob->ob);
+ }
}
static void lib_link_workspace_instance_hook(BlendLibReader *reader,
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index a170fa9902b..45d192d227c 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -201,6 +201,12 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
WM_msgbus_destroy(wm->message_bus);
wm->message_bus = NULL;
}
+
+#ifdef WITH_XR_OPENXR
+ /* Free XR action maps and motion capture objects. */
+ WM_xr_actionmaps_free(&wm->xr.session_settings);
+ BLI_freelistN(&wm->xr.session_settings.mocap_objects);
+#endif
}
BLI_listbase_clear(&G_MAIN->wm);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 91ec45da6d4..104eda220cc 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1519,7 +1519,7 @@ void wm_window_process_events(const bContext *C)
#ifdef WITH_XR_OPENXR
/* XR events don't use the regular window queues. So here we don't only trigger
* processing/dispatching but also handling. */
- has_event |= wm_xr_events_handle(CTX_wm_manager(C));
+ has_event |= wm_xr_events_handle(C);
#endif
/* When there is no event, sleep 5 milliseconds not to use too much CPU when idle.