Skip to content

Commit

Permalink
Чтобы ошибки по костям были более понятные
Browse files Browse the repository at this point in the history
  • Loading branch information
xrSimpodin committed Jul 5, 2024
1 parent 236a01b commit 3bdf2cf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ogsr_engine/Layers/xrRender/SkeletonAnimated.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class ECORE_API CKinematicsAnimated : public CKinematics, public IKinematicsAnim
void LL_SetChannelFactor(u16 channel, float factor);
CBlendInstance& LL_GetBlendInstance(u16 bone_id)
{
VERIFY(bone_id < LL_BoneCount());
ASSERT_FMT(bone_id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), bone_id);
return blend_instances[bone_id];
}

Expand Down
3 changes: 2 additions & 1 deletion ogsr_engine/Layers/xrRender/SkeletonCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ void CKinematics::Release()

void CKinematics::LL_SetBoneVisible(u16 bone_id, BOOL val, BOOL bRecursive)
{
R_ASSERT(bone_id < LL_BoneCount());
ASSERT_FMT(bone_id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), bone_id);

visimask.set(bone_id, !!val);
if (!visimask.is(bone_id))
{
Expand Down
8 changes: 4 additions & 4 deletions ogsr_engine/Layers/xrRender/SkeletonCustom.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,22 @@ class CKinematics : public FHierrarhyVisual, public IKinematics

CBoneData& _BCL LL_GetData(u16 bone_id)
{
VERIFY(bone_id < LL_BoneCount());
ASSERT_FMT(bone_id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), bone_id);
VERIFY(bones);
CBoneData& bd = *((*bones)[bone_id]);
return bd;
}

virtual const IBoneData& _BCL GetBoneData(u16 bone_id) const
{
VERIFY(bone_id < LL_BoneCount());
ASSERT_FMT(bone_id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), bone_id);
VERIFY(bones);
CBoneData& bd = *((*bones)[bone_id]);
return bd;
}
CBoneData* _BCL LL_GetBoneData(u16 bone_id)
{
VERIFY(bone_id < LL_BoneCount());
ASSERT_FMT(bone_id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), bone_id);
VERIFY(bones);
u32 sz = sizeof(vecBones);
u32 sz1 = sizeof(((*bones)[bone_id])->children);
Expand All @@ -222,7 +222,7 @@ class CKinematics : public FHierrarhyVisual, public IKinematics
ICF Fmatrix& LL_GetTransform_R(u16 bone_id) { return LL_GetBoneInstance(bone_id).mRenderTransform; } // rendering only
Fobb& LL_GetBox(u16 bone_id)
{
VERIFY(bone_id < LL_BoneCount());
ASSERT_FMT(bone_id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), bone_id);
return (*bones)[bone_id]->obb;
}
const Fbox& _BCL GetBox() const { return vis.box; }
Expand Down
3 changes: 2 additions & 1 deletion ogsr_engine/Layers/xrRender/SkeletonRigid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ void CKinematics::CLBone(const CBoneData* bd, CBoneInstance& bi, const Fmatrix*

void CKinematics::Bone_GetAnimPos(Fmatrix& pos, u16 id, u8 mask_channel, bool ignore_callbacks)
{
R_ASSERT(id < LL_BoneCount());
ASSERT_FMT(id < LL_BoneCount(), "!![%s] visual_name: [%s], invalid bone_id: [%u]", __FUNCTION__, dbg_name.c_str(), id);

CBoneInstance bi = LL_GetBoneInstance(id);
Fvector last_c = bi.mTransform.c;
BoneChain_Calculate(&LL_GetData(id), bi, mask_channel, ignore_callbacks);
Expand Down
6 changes: 5 additions & 1 deletion ogsr_engine/xrGame/attachment_owner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ void CAttachmentOwner::attach(CInventoryItem* inventory_item)
VERIFY(game_object && game_object->Visual());
if (m_attached_objects.empty())
game_object->add_visual_callback(AttachmentCallback);
attachable_item->set_bone_id(smart_cast<IKinematics*>(game_object->Visual())->LL_BoneID(attachable_item->bone_name()));
const u16 bone_id = smart_cast<IKinematics*>(game_object->Visual())->LL_BoneID(attachable_item->bone_name());
ASSERT_FMT(bone_id != BI_NONE, "!![%s] attach_bone_name [%s] in section [%s] not found in game object [%s] with visual [%s]", __FUNCTION__,
attachable_item->bone_name().c_str(), smart_cast<CGameObject*>(inventory_item)->cNameSect().c_str(), game_object->cNameSect().c_str(),
game_object->Visual()->getDebugName().c_str());
attachable_item->set_bone_id(bone_id);
m_attached_objects.push_back(smart_cast<CAttachableItem*>(inventory_item));

inventory_item->object().setVisible(true);
Expand Down

0 comments on commit 3bdf2cf

Please sign in to comment.