From a7bb537a61c7c680bc01896ccf27a02c9e7a688a Mon Sep 17 00:00:00 2001 From: Peter Kim Date: Sat, 7 Aug 2021 21:30:15 +0900 Subject: Cleanup: unnecessary double pointers in XR module No functional changes. --- intern/ghost/GHOST_C-api.h | 4 ++-- intern/ghost/intern/GHOST_C-api.cpp | 4 ++-- intern/ghost/intern/GHOST_XrAction.cpp | 8 ++++---- intern/ghost/intern/GHOST_XrAction.h | 4 ++-- intern/ghost/intern/GHOST_XrSession.cpp | 4 ++-- intern/ghost/intern/GHOST_XrSession.h | 4 ++-- source/blender/makesrna/intern/rna_xr.c | 9 +++------ source/blender/windowmanager/WM_api.h | 6 +++--- source/blender/windowmanager/xr/intern/wm_xr_action.c | 12 ++++++------ source/blender/windowmanager/xr/intern/wm_xr_intern.h | 4 ++-- 10 files changed, 28 insertions(+), 31 deletions(-) diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 83c67f83908..b78aac6f5eb 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -1102,7 +1102,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context, const char *action_set_name, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t *duration, const float *frequency, const float *amplitude); @@ -1113,7 +1113,7 @@ int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context, void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_context, const char *action_set_name, const char *action_name, - const char **subaction_path); + const char *subaction_path); /** * Get action set custom data (owned by Blender, not GHOST). diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index b1af5c131ab..a2871b46222 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -1005,7 +1005,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle, const char *action_set_name, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t *duration, const float *frequency, const float *amplitude) @@ -1022,7 +1022,7 @@ int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle, void GHOST_XrStopHapticAction(GHOST_XrContextHandle xr_contexthandle, const char *action_set_name, const char *action_name, - const char **subaction_path) + const char *subaction_path) { GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle; GHOST_XrSession *xr_session = xr_context->getSession(); diff --git a/intern/ghost/intern/GHOST_XrAction.cpp b/intern/ghost/intern/GHOST_XrAction.cpp index 07eb42c14e6..704b1ce9fac 100644 --- a/intern/ghost/intern/GHOST_XrAction.cpp +++ b/intern/ghost/intern/GHOST_XrAction.cpp @@ -375,7 +375,7 @@ void GHOST_XrAction::updateState(XrSession session, void GHOST_XrAction::applyHapticFeedback(XrSession session, const char *action_name, - const char **subaction_path_str, + const char *subaction_path_str, const int64_t &duration, const float &frequency, const float &litude) @@ -390,7 +390,7 @@ void GHOST_XrAction::applyHapticFeedback(XrSession session, haptic_info.action = m_action; if (subaction_path_str != nullptr) { - SubactionIndexMap::iterator it = m_subaction_indices.find(*subaction_path_str); + SubactionIndexMap::iterator it = m_subaction_indices.find(subaction_path_str); if (it != m_subaction_indices.end()) { haptic_info.subactionPath = m_subaction_paths[it->second]; CHECK_XR( @@ -410,13 +410,13 @@ void GHOST_XrAction::applyHapticFeedback(XrSession session, void GHOST_XrAction::stopHapticFeedback(XrSession session, const char *action_name, - const char **subaction_path_str) + const char *subaction_path_str) { XrHapticActionInfo haptic_info{XR_TYPE_HAPTIC_ACTION_INFO}; haptic_info.action = m_action; if (subaction_path_str != nullptr) { - SubactionIndexMap::iterator it = m_subaction_indices.find(*subaction_path_str); + SubactionIndexMap::iterator it = m_subaction_indices.find(subaction_path_str); if (it != m_subaction_indices.end()) { haptic_info.subactionPath = m_subaction_paths[it->second]; CHECK_XR(xrStopHapticFeedback(session, &haptic_info), diff --git a/intern/ghost/intern/GHOST_XrAction.h b/intern/ghost/intern/GHOST_XrAction.h index 70eaa694ae9..3e2224fe3ff 100644 --- a/intern/ghost/intern/GHOST_XrAction.h +++ b/intern/ghost/intern/GHOST_XrAction.h @@ -103,11 +103,11 @@ class GHOST_XrAction { const XrTime &predicted_display_time); void applyHapticFeedback(XrSession session, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t &duration, const float &frequency, const float &litude); - void stopHapticFeedback(XrSession session, const char *action_name, const char **subaction_path); + void stopHapticFeedback(XrSession session, const char *action_name, const char *subaction_path); void *getCustomdata(); void getBindings(std::map> &r_bindings) const; diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp index a63ce5c9344..4cab22ee676 100644 --- a/intern/ghost/intern/GHOST_XrSession.cpp +++ b/intern/ghost/intern/GHOST_XrSession.cpp @@ -754,7 +754,7 @@ bool GHOST_XrSession::syncActions(const char *action_set_name) bool GHOST_XrSession::applyHapticAction(const char *action_set_name, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t &duration, const float &frequency, const float &litude) @@ -777,7 +777,7 @@ bool GHOST_XrSession::applyHapticAction(const char *action_set_name, void GHOST_XrSession::stopHapticAction(const char *action_set_name, const char *action_name, - const char **subaction_path) + const char *subaction_path) { GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name); if (action_set == nullptr) { diff --git a/intern/ghost/intern/GHOST_XrSession.h b/intern/ghost/intern/GHOST_XrSession.h index ec15897058f..a76e11aede1 100644 --- a/intern/ghost/intern/GHOST_XrSession.h +++ b/intern/ghost/intern/GHOST_XrSession.h @@ -76,13 +76,13 @@ class GHOST_XrSession { bool syncActions(const char *action_set_name = nullptr); bool applyHapticAction(const char *action_set_name, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t &duration, const float &frequency, const float &litude); void stopHapticAction(const char *action_set_name, const char *action_name, - const char **subaction_path); + const char *subaction_path); /* Custom data (owned by Blender, not GHOST) accessors. */ void *getActionSetCustomdata(const char *action_set_name); diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c index 88e285d7cc2..4cab92ad878 100644 --- a/source/blender/makesrna/intern/rna_xr.c +++ b/source/blender/makesrna/intern/rna_xr.c @@ -612,7 +612,6 @@ static bool rna_XrSessionState_action_create(bContext *C, const bool is_button_action = (is_float_action || ami->type == XR_BOOLEAN_INPUT); wmOperatorType *ot = NULL; IDProperty *op_properties = NULL; - const char *haptic_name = NULL; int64_t haptic_duration_msec; if (is_button_action) { @@ -625,7 +624,6 @@ static bool rna_XrSessionState_action_create(bContext *C, } } - haptic_name = &ami->haptic_name[0]; haptic_duration_msec = (int64_t)(ami->haptic_duration * 1000.0f); } @@ -637,7 +635,7 @@ static bool rna_XrSessionState_action_create(bContext *C, subaction_paths, ot, op_properties, - is_button_action ? &haptic_name : NULL, + is_button_action ? ami->haptic_name : NULL, is_button_action ? &haptic_duration_msec : NULL, is_button_action ? &ami->haptic_frequency : NULL, is_button_action ? &ami->haptic_amplitude : NULL, @@ -793,7 +791,7 @@ bool rna_XrSessionState_haptic_action_apply(bContext *C, return WM_xr_haptic_action_apply(&wm->xr, action_set_name, action_name, - user_path[0] ? &user_path : NULL, + user_path[0] ? user_path : NULL, &duration_msec, &frequency, &litude); @@ -810,8 +808,7 @@ void rna_XrSessionState_haptic_action_stop(bContext *C, { # ifdef WITH_XR_OPENXR wmWindowManager *wm = CTX_wm_manager(C); - WM_xr_haptic_action_stop( - &wm->xr, action_set_name, action_name, user_path[0] ? &user_path : NULL); + WM_xr_haptic_action_stop(&wm->xr, action_set_name, action_name, user_path[0] ? user_path : NULL); # else UNUSED_VARS(C, action_set_name, action_name, user_path); # endif diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 02e8d42e0ff..3027df41e77 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -987,7 +987,7 @@ bool WM_xr_action_create(wmXrData *xr, const char **subaction_paths, struct wmOperatorType *ot, struct IDProperty *op_properties, - const char **haptic_name, + const char *haptic_name, const int64_t *haptic_duration, const float *haptic_frequency, const float *haptic_amplitude, @@ -1027,14 +1027,14 @@ bool WM_xr_action_state_get(const wmXrData *xr, bool WM_xr_haptic_action_apply(wmXrData *xr, const char *action_set_name, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t *duration, const float *frequency, const float *amplitude); void WM_xr_haptic_action_stop(wmXrData *xr, const char *action_set_name, const char *action_name, - const char **subaction_path); + const char *subaction_path); /* wm_xr_actionmap.c */ XrActionMap *WM_xr_actionmap_new(struct wmXrRuntimeData *runtime, diff --git a/source/blender/windowmanager/xr/intern/wm_xr_action.c b/source/blender/windowmanager/xr/intern/wm_xr_action.c index 2712fde51a8..ba347c537ec 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_action.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_action.c @@ -74,7 +74,7 @@ static wmXrAction *action_create(const char *action_name, const char **subaction_paths, wmOperatorType *ot, IDProperty *op_properties, - const char **haptic_name, + const char *haptic_name, const int64_t *haptic_duration, const float *haptic_frequency, const float *haptic_amplitude, @@ -134,8 +134,8 @@ static wmXrAction *action_create(const char *action_name, if (haptic_name) { BLI_assert(is_button_action); - action->haptic_name = MEM_mallocN(strlen(*haptic_name) + 1, "XrAction_HapticName"); - strcpy(action->haptic_name, *haptic_name); + action->haptic_name = MEM_mallocN(strlen(haptic_name) + 1, "XrAction_HapticName"); + strcpy(action->haptic_name, haptic_name); action->haptic_duration = *haptic_duration; action->haptic_frequency = *haptic_frequency; action->haptic_amplitude = *haptic_amplitude; @@ -232,7 +232,7 @@ bool WM_xr_action_create(wmXrData *xr, const char **subaction_paths, wmOperatorType *ot, IDProperty *op_properties, - const char **haptic_name, + const char *haptic_name, const int64_t *haptic_duration, const float *haptic_frequency, const float *haptic_amplitude, @@ -502,7 +502,7 @@ bool WM_xr_action_state_get(const wmXrData *xr, bool WM_xr_haptic_action_apply(wmXrData *xr, const char *action_set_name, const char *action_name, - const char **subaction_path, + const char *subaction_path, const int64_t *duration, const float *frequency, const float *amplitude) @@ -521,7 +521,7 @@ bool WM_xr_haptic_action_apply(wmXrData *xr, void WM_xr_haptic_action_stop(wmXrData *xr, const char *action_set_name, const char *action_name, - const char **subaction_path) + const char *subaction_path) { GHOST_XrStopHapticAction(xr->runtime->context, action_set_name, action_name, subaction_path); } diff --git a/source/blender/windowmanager/xr/intern/wm_xr_intern.h b/source/blender/windowmanager/xr/intern/wm_xr_intern.h index 4b1605d0f68..4d4df43f796 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_intern.h +++ b/source/blender/windowmanager/xr/intern/wm_xr_intern.h @@ -134,7 +134,7 @@ typedef struct wmXrAction { eXrAxisFlag *axis_flags; /** The currently active subaction path (if any) for modal actions. */ - char **active_modal_path; + const char *active_modal_path; /** Operator to be called on XR events. */ struct wmOperatorType *ot; @@ -155,7 +155,7 @@ typedef struct wmXrAction { typedef struct wmXrHapticAction { struct wmXrHapticAction *next, *prev; wmXrAction *action; - const char **subaction_path; + const char *subaction_path; int64_t time_start; } wmXrHapticAction; -- cgit v1.2.3