[Bf-blender-cvs] [f58bebf6888] xr-controller-support: XR: Fix controller model world transforms

Peter Kim noreply at git.blender.org
Fri Aug 20 14:01:57 CEST 2021


Commit: f58bebf6888d53478113195b610b3c213055012b
Author: Peter Kim
Date:   Fri Aug 20 20:46:15 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBf58bebf6888d53478113195b610b3c213055012b

XR: Fix controller model world transforms

Fixes incorrect display of Reverb G2 controller model/animated parts.

Thanks to Werner Trunk for help with debugging.

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

M	intern/ghost/intern/GHOST_XrControllerModel.cpp

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

diff --git a/intern/ghost/intern/GHOST_XrControllerModel.cpp b/intern/ghost/intern/GHOST_XrControllerModel.cpp
index 4c240d73239..d943423eabb 100644
--- a/intern/ghost/intern/GHOST_XrControllerModel.cpp
+++ b/intern/ghost/intern/GHOST_XrControllerModel.cpp
@@ -547,7 +547,7 @@ void GHOST_XrControllerModel::updateComponents(XrSession session)
 
   for (uint32_t state_idx = 0; state_idx < count; ++state_idx) {
     const int32_t &node_idx = m_node_state_indices[state_idx];
-    if (node_idx > 0) {
+    if (node_idx >= 0) {
       const XrPosef &pose = node_states[state_idx].nodePose;
       Eigen::Matrix4f &m = *(Eigen::Matrix4f *)m_nodes[node_idx].local_transform;
       Eigen::Quaternionf q(
@@ -562,10 +562,10 @@ void GHOST_XrControllerModel::updateComponents(XrSession session)
   std::vector<Eigen::Matrix4f> world_transforms(m_nodes.size());
   uint32_t i = 0;
   for (const GHOST_XrControllerModelNode &node : m_nodes) {
-    world_transforms[i] = (node.parent_idx > 0) ? world_transforms[node.parent_idx] *
-                                                      *(Eigen::Matrix4f *)node.local_transform :
-                                                  *(Eigen::Matrix4f *)node.local_transform;
-    if (node.component_idx > 0) {
+    world_transforms[i] = (node.parent_idx >= 0) ? world_transforms[node.parent_idx] *
+                                                       *(Eigen::Matrix4f *)node.local_transform :
+                                                   *(Eigen::Matrix4f *)node.local_transform;
+    if (node.component_idx >= 0) {
       memcpy(m_components[node.component_idx].transform,
              world_transforms[i].data(),
              sizeof(m_components[node.component_idx].transform));



More information about the Bf-blender-cvs mailing list