Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

  1. //====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =====//
  2. //
  3. // A list of DmeBoneWeight elements, replacing QC's $WeightList
  4. //
  5. //===========================================================================//
  6. #include "datamodel/dmelementfactoryhelper.h"
  7. #include "mdlobjects/dmeboneweight.h"
  8. #include "mdlobjects/dmebonemask.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. //-----------------------------------------------------------------------------
  12. // Expose this class to the scene database
  13. //-----------------------------------------------------------------------------
  14. IMPLEMENT_ELEMENT_FACTORY( DmeBoneMask, CDmeBoneMask );
  15. //-----------------------------------------------------------------------------
  16. //
  17. //-----------------------------------------------------------------------------
  18. void CDmeBoneMask::OnConstruction()
  19. {
  20. m_BoneWeights.Init( this, "boneWeightList" );
  21. }
  22. //-----------------------------------------------------------------------------
  23. //
  24. //-----------------------------------------------------------------------------
  25. void CDmeBoneMask::OnDestruction()
  26. {
  27. }
  28. //-----------------------------------------------------------------------------
  29. //
  30. //-----------------------------------------------------------------------------
  31. float CDmeBoneMask::GetBoneWeight( const char *pszBoneName )
  32. {
  33. for ( int i = 0; i < m_BoneWeights.Count(); ++i )
  34. {
  35. CDmeBoneWeight *pDmeBoneWeight = m_BoneWeights[i];
  36. if ( !pDmeBoneWeight )
  37. continue;
  38. if ( !V_stricmp( pszBoneName, pDmeBoneWeight->GetName() ) )
  39. return pDmeBoneWeight->m_flWeight.Get();
  40. }
  41. // Couldn't find the bone, return full weight
  42. return 1.0f;
  43. }