MCPcopy Create free account
hub / github.com/defold/defold / CountAnimatedNodes

Function CountAnimatedNodes

engine/modelc/src/modelimporter_gltf.cpp:1793–1816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1791}
1792
1793static uint32_t CountAnimatedNodes(Scene* scene, cgltf_data* gltf_data, cgltf_animation* animation, dmHashTable64<uint32_t>& node_to_index)
1794{
1795 node_to_index.SetCapacity((32*2)/3, 32);
1796
1797 for (size_t i = 0; i < animation->channels_count; ++i)
1798 {
1799 if (node_to_index.Full())
1800 {
1801 uint32_t new_capacity = node_to_index.Capacity() + 32;
1802 node_to_index.SetCapacity((new_capacity*2)/3, new_capacity);
1803 }
1804
1805 Node* target_node = TranslateNode(animation->channels[i].target_node, gltf_data, scene);
1806 dmhash_t node_name_hash = dmHashString64(target_node->m_Name);
1807
1808 uint32_t* prev_index = node_to_index.Get(node_name_hash);
1809 if (prev_index == 0)
1810 {
1811 node_to_index.Put(node_name_hash, node_to_index.Size());
1812 }
1813 }
1814
1815 return node_to_index.Size();
1816}
1817
1818static void LoadAnimations(Scene* scene, cgltf_data* gltf_data)
1819{

Callers 1

LoadAnimationsFunction · 0.85

Calls 7

TranslateNodeFunction · 0.85
SetCapacityMethod · 0.45
FullMethod · 0.45
CapacityMethod · 0.45
GetMethod · 0.45
PutMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected