[Bf-blender-cvs] [be7653fe52f] xr-controller-support: Cleanup: remove unnecessary double pointer usage

Peter Kim noreply at git.blender.org
Sat Aug 7 11:51:47 CEST 2021


Commit: be7653fe52ffb4bf0afac972f2e94a3601b1f157
Author: Peter Kim
Date:   Sat Aug 7 17:30:27 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBbe7653fe52ffb4bf0afac972f2e94a3601b1f157

Cleanup: remove unnecessary double pointer usage

===================================================================

M	intern/ghost/GHOST_C-api.h
M	intern/ghost/intern/GHOST_C-api.cpp
M	intern/ghost/intern/GHOST_XrAction.cpp
M	intern/ghost/intern/GHOST_XrAction.h
M	intern/ghost/intern/GHOST_XrSession.cpp
M	intern/ghost/intern/GHOST_XrSession.h
M	source/blender/makesrna/intern/rna_xr.c
M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/xr/intern/wm_xr_action.c
M	source/blender/windowmanager/xr/intern/wm_xr_intern.h
M	source/blender/windowmanager/xr/intern/wm_xr_session.c

===================================================================

diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index ae6e26229af..d3ef610a5ac 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 c5fce153d9d..08c0f38cdaa 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 5b0d8389f96..900e71ca45d 100644
--- a/intern/ghost/intern/GHOST_XrAction.cpp
+++ b/intern/ghost/intern/GHOST_XrAction.cpp
@@ -374,7 +374,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 &amplitude)
@@ -389,7 +389,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(
@@ -409,13 +409,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 9975385ea97..ce292e5a39a 100644
--- a/intern/ghost/intern/GHOST_XrAction.h
+++ b/intern/ghost/intern/GHOST_XrAction.h
@@ -104,11 +104,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 &amplitude);
-  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<XrPath, std::vector<XrActionSuggestedBinding>> &r_bindings) const;
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp
index f54fab4e6cf..9a74822a784 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -757,7 +757,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 &amplitude)
@@ -780,7 +780,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 abe9372124a..bdd3f3ee3d2 100644
--- a/intern/ghost/intern/GHOST_XrSession.h
+++ b/intern/ghost/intern/GHOST_XrSession.h
@@ -74,13 +74,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 &amplitude);
   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 536e5dee486..0b785f8bc78 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -931,7 +931,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) {
@@ -944,7 +943,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);
   }
 
@@ -956,7 +954,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,
@@ -1112,7 +1110,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,
                                    &amplitude);
@@ -1129,8 +1127,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/

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list