[Bf-blender-cvs] [c34d0fbee24] xr-controller-support: Update with changes from D10942
Peter Kim
noreply at git.blender.org
Tue May 18 15:07:10 CEST 2021
Commit: c34d0fbee249360aadbbd1d46a32a9c7ef2af55d
Author: Peter Kim
Date: Fri Apr 30 19:54:03 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBc34d0fbee249360aadbbd1d46a32a9c7ef2af55d
Update with changes from D10942
Except for motion capture object autokeying (will be added again once
a good way to get the blender context from wm_xr_session is found),
functionality remains the same as before.
===================================================================
M intern/ghost/CMakeLists.txt
M intern/ghost/GHOST_C-api.h
M intern/ghost/GHOST_Types.h
M intern/ghost/intern/GHOST_C-api.cpp
A intern/ghost/intern/GHOST_XrAction.cpp
A intern/ghost/intern/GHOST_XrAction.h
M intern/ghost/intern/GHOST_XrContext.cpp
M intern/ghost/intern/GHOST_XrContext.h
M intern/ghost/intern/GHOST_XrSession.cpp
M intern/ghost/intern/GHOST_XrSession.h
M intern/ghost/intern/GHOST_Xr_intern.h
M source/blender/makesrna/intern/rna_xr.c
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/xr/intern/wm_xr_actions.c
M source/blender/windowmanager/xr/intern/wm_xr_intern.h
M source/blender/windowmanager/xr/intern/wm_xr_operators.c
M source/blender/windowmanager/xr/intern/wm_xr_session.c
M source/blender/windowmanager/xr/wm_xr.h
===================================================================
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 1739659ab88..45021e3ee01 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -438,6 +438,7 @@ endif()
if(WITH_XR_OPENXR)
list(APPEND SRC
intern/GHOST_Xr.cpp
+ intern/GHOST_XrAction.cpp
intern/GHOST_XrContext.cpp
intern/GHOST_XrEvent.cpp
intern/GHOST_XrGraphicsBinding.cpp
@@ -446,6 +447,7 @@ if(WITH_XR_OPENXR)
GHOST_IXrContext.h
intern/GHOST_IXrGraphicsBinding.h
+ intern/GHOST_XrAction.h
intern/GHOST_XrContext.h
intern/GHOST_XrException.h
intern/GHOST_XrSession.h
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 50245347e9a..b823bfbb880 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -1064,7 +1064,7 @@ GHOST_TSuccess GHOST_XrEventsHandle(GHOST_XrContextHandle xr_context);
/**
* Create an OpenXR action set for input/output.
*/
-int GHOST_XrCreateActionSet(GHOST_XrContextHandle xr_context, const char *action_set_name);
+int GHOST_XrCreateActionSet(GHOST_XrContextHandle xr_context, const GHOST_XrActionSetInfo *info);
/**
* Destroy a previously created OpenXR action set.
@@ -1109,7 +1109,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
- const GHOST_XrActionBindingsInfo *infos);
+ const GHOST_XrActionProfileInfo *infos);
/**
* Destroy previously created bindings for OpenXR actions.
@@ -1117,7 +1117,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
GHOST_TUns32 count,
- const GHOST_XrActionBindingsInfo *infos);
+ const GHOST_XrActionProfileInfo *infos);
/**
* Attach all created action sets to the current OpenXR session.
@@ -1132,22 +1132,12 @@ int GHOST_XrAttachActionSets(GHOST_XrContextHandle xr_context);
*/
int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set_name);
-/**
- * Get the states of OpenXR actions.
- */
-int GHOST_XrGetActionStates(GHOST_XrContextHandle xr_context,
- const char *action_set_name,
- GHOST_TUns32 count,
- GHOST_XrActionInfo *r_infos);
-
/**
* Apply an OpenXR haptic output action.
*/
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name,
const char *action_name,
- GHOST_TUns32 count,
- const char *const *subaction_paths,
const GHOST_TInt64 *duration,
const float *frequency,
const float *amplitude);
@@ -1157,10 +1147,34 @@ int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name,
- const char *action_name,
- GHOST_TUns32 count,
- const char *const *subaction_paths);
-#endif
+ const char *action_name);
+
+/**
+ * Get action set custom data (owned by Blender, not GHOST).
+ */
+void *GHOST_XrGetActionSetCustomdata(GHOST_XrContextHandle xr_context,
+ const char *action_set_name);
+
+/**
+ * Get action custom data (owned by Blender, not GHOST).
+ */
+void *GHOST_XrGetActionCustomdata(GHOST_XrContextHandle xr_context,
+ const char *action_set_name,
+ const char *action_name);
+
+/**
+ * Get the number of actions in an action set.
+ */
+unsigned int GHOST_XrGetActionCount(GHOST_XrContextHandle xr_context, const char *action_set_name);
+
+/**
+ * Get custom data for all actions in an action set.
+ */
+void GHOST_XrGetActionCustomdatas(GHOST_XrContextHandle xr_context,
+ const char *action_set_name,
+ void **r_customdatas);
+
+#endif /* WITH_XR_OPENXR */
#ifdef __cplusplus
}
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 823f99f0601..6038c9dd293 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -631,8 +631,9 @@ typedef enum GHOST_TXrGraphicsBinding {
typedef void (*GHOST_XrErrorHandlerFn)(const struct GHOST_XrError *);
-typedef void (*GHOST_XrSessionCreateFn)(void *customdata);
+typedef void (*GHOST_XrSessionCreateFn)();
typedef void (*GHOST_XrSessionExitFn)(void *customdata);
+typedef void (*GHOST_XrCustomdataFreeFn)(void *customdata);
typedef void *(*GHOST_XrGraphicsContextBindFn)(void);
typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_ContextHandle graphics_context);
@@ -664,7 +665,6 @@ typedef struct {
GHOST_XrPose base_pose;
GHOST_XrSessionCreateFn create_fn;
- void *create_customdata;
GHOST_XrSessionExitFn exit_fn;
void *exit_customdata;
} GHOST_XrSessionBeginInfo;
@@ -694,6 +694,13 @@ typedef struct GHOST_XrError {
void *customdata;
} GHOST_XrError;
+typedef struct GHOST_XrActionSetInfo {
+ const char *name;
+
+ GHOST_XrCustomdataFreeFn customdata_free_fn;
+ void *customdata; /* wmXrActionSet */
+} GHOST_XrActionSetInfo;
+
/** XR action type. Enum values match those in OpenXR's
* XrActionType enum for consistency. */
typedef enum GHOST_XrActionType {
@@ -711,6 +718,9 @@ typedef struct GHOST_XrActionInfo {
const char **subaction_paths;
/** States for each subaction path. */
void *states;
+
+ GHOST_XrCustomdataFreeFn customdata_free_fn;
+ void *customdata; /* wmXrAction */
} GHOST_XrActionInfo;
typedef struct GHOST_XrActionSpaceInfo {
@@ -721,17 +731,17 @@ typedef struct GHOST_XrActionSpaceInfo {
const GHOST_XrPose *poses;
} GHOST_XrActionSpaceInfo;
-typedef struct GHOST_XrActionBinding {
+typedef struct GHOST_XrActionBindingInfo {
const char *action_name;
GHOST_TUns32 count_interaction_paths;
/** Interaction path: User (subaction) path + component path. */
const char **interaction_paths;
-} GHOST_XrActionBinding;
+} GHOST_XrActionBindingInfo;
-typedef struct GHOST_XrActionBindingsInfo {
- const char *interaction_profile_path;
+typedef struct GHOST_XrActionProfileInfo {
+ const char *profile_path;
GHOST_TUns32 count_bindings;
- const GHOST_XrActionBinding *bindings;
-} GHOST_XrActionBindingsInfo;
+ const GHOST_XrActionBindingInfo *bindings;
+} GHOST_XrActionProfileInfo;
-#endif
+#endif /* WITH_XR_OPENXR */
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index bc43cd05d4b..742dba90fcb 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -954,11 +954,12 @@ int GHOST_XrSessionNeedsUpsideDownDrawing(const GHOST_XrContextHandle xr_context
return 0; /* Only reached if exception is thrown. */
}
-int GHOST_XrCreateActionSet(GHOST_XrContextHandle xr_contexthandle, const char *action_set_name)
+int GHOST_XrCreateActionSet(GHOST_XrContextHandle xr_contexthandle,
+ const GHOST_XrActionSetInfo *info)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
- GHOST_XR_CAPI_CALL_RET(xr_session->createActionSet(action_set_name), xr_context);
+ GHOST_XR_CAPI_CALL_RET(xr_session->createActionSet(*info), xr_context);
return 0;
}
@@ -966,7 +967,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_contexthandle, const char
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
- GHOST_XR_CAPI_CALL(xr_session->destroyActionSet(action_set_name, true), xr_context);
+ GHOST_XR_CAPI_CALL(xr_session->destroyActionSet(action_set_name), xr_context);
}
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
@@ -1015,7 +1016,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
GHOST_TUns32 count,
- const GHOST_XrActionBindingsInfo *infos)
+ const GHOST_XrActionProfileInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
@@ -1027,7 +1028,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
GHOST_TUns32 count,
- const GHOST_XrActionBindingsInfo *infos)
+ const GHOST_XrActionProfileInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
GHOST_XrSession *xr_session = xr_context->getSession();
@@ -1050,46 +1051,66 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti
return 0;
}
-int GHOST_XrGetActionStates(GHOST_XrContextHandle xr_contexthandle,
- const char *action_set_name,
- GHOST_TUns32 count,
- GHOST_XrActionInfo *r_infos)
-{
- GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
- GHOST_XrSession *xr_session = xr_context->getSession();
- GHOST_XR_CAPI_CALL_RET(xr_session->getActionStates(action_set_name, count, r_infos), xr_context);
- return 0;
-}
-
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthan
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list