From 8422ffb4362edc65887f6b4f10e75a847bed923c Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 2 Sep 2016 20:47:57 -0700 Subject: [PATCH] Implement GetLocatorTransform --- Editor/ViewManager.cpp | 4 ++-- Runtime/Character/CAnimData.cpp | 12 ++++++++++-- Runtime/Character/CCharLayoutInfo.cpp | 9 +++++++++ Runtime/Character/CCharLayoutInfo.hpp | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index a6ae2ebb7..b17390b44 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -35,7 +35,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore) CAnimRes samusAnimRes(samusCharSet.id, 2, zeus::CVector3f{2.f, 2.f, 2.f}, 0, true); g_GameState->GetWorldTransitionManager()->EnableTransition(samusAnimRes, platModel.id, zeus::CVector3f::skOne, - bgModel.id, zeus::CVector3f::skOne, false); + bgModel.id, zeus::CVector3f::skOne, true); #endif SObjectTag areaTag = m_projManager.TagFromPath( @@ -70,7 +70,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore) m_videoVoice = m_voiceEngine->allocateNewStereoVoice(32000, &m_voiceCallback); m_videoVoice->start(); - //m_rootView->accessContentViews().clear(); + m_rootView->accessContentViews().clear(); m_rootView->accessContentViews().push_back(m_particleView.get()); m_rootView->updateSize(); } diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp index 325ac5245..b7d567c34 100644 --- a/Runtime/Character/CAnimData.cpp +++ b/Runtime/Character/CAnimData.cpp @@ -178,12 +178,20 @@ void CAnimData::CalcPlaybackAlignmentParms(const CAnimPlaybackParms& parms, zeus::CTransform CAnimData::GetLocatorTransform(CSegId id, const CCharAnimTime* time) const { - return {}; + if (id == 0xFF) + return {}; + + zeus::CTransform ret; + if (!x220_31_poseCached) + const_cast(this)->RecalcPoseBuilder(time); + + x2fc_poseBuilder.BuildTransform(id, ret); + return ret; } zeus::CTransform CAnimData::GetLocatorTransform(const std::string& name, const CCharAnimTime* time) const { - return {}; + return GetLocatorTransform(xcc_layoutData->GetSegIdFromString(name), time); } bool CAnimData::IsAnimTimeRemaining(float, const std::string& name) const diff --git a/Runtime/Character/CCharLayoutInfo.cpp b/Runtime/Character/CCharLayoutInfo.cpp index 9878f8c56..a5e0742f8 100644 --- a/Runtime/Character/CCharLayoutInfo.cpp +++ b/Runtime/Character/CCharLayoutInfo.cpp @@ -16,6 +16,15 @@ zeus::CVector3f CCharLayoutInfo::GetFromParentUnrotated(const CSegId& id) const } } +CSegId CCharLayoutInfo::GetSegIdFromString(const std::string& name) const +{ + auto it = x18_segIdMap.find(name); + if (it == x18_segIdMap.end()) + return {}; + + return (*it).second; +} + void CCharLayoutNode::Bone::read(CInputStream& in) { x0_parentId = CSegId(in); diff --git a/Runtime/Character/CCharLayoutInfo.hpp b/Runtime/Character/CCharLayoutInfo.hpp index 0b1427cc8..d9762b009 100644 --- a/Runtime/Character/CCharLayoutInfo.hpp +++ b/Runtime/Character/CCharLayoutInfo.hpp @@ -37,6 +37,7 @@ public: const std::shared_ptr& GetRootNode() const {return x0_node;} const CSegIdList& GetSegIdList() const {return x8_segIdList;} zeus::CVector3f GetFromParentUnrotated(const CSegId& id) const; + CSegId GetSegIdFromString(const std::string& name) const; }; CFactoryFnReturn FCharLayoutInfo(const SObjectTag&, CInputStream&, const CVParamTransfer&,