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

Function GetDescriptorWithExt

engine/resource/src/resource.cpp:1400–1423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1398}
1399
1400Result GetDescriptorWithExt(HFactory factory, uint64_t hashed_name, const uint64_t* exts, uint32_t ext_count, HResourceDescriptor* descriptor)
1401{
1402 ResourceDescriptor* tmp_descriptor = factory->m_Resources->Get(hashed_name);
1403 if (!tmp_descriptor) {
1404 return RESULT_NOT_LOADED;
1405 }
1406
1407 ResourceType* type = (ResourceType*) tmp_descriptor->m_ResourceType;
1408 bool ext_match = ext_count == 0;
1409 if (!ext_match) {
1410 for (uint32_t i = 0; i < ext_count; ++i) {
1411 if (type->m_ExtensionHash == exts[i]) {
1412 ext_match = true;
1413 break;
1414 }
1415 }
1416 }
1417 if (ext_match) {
1418 *descriptor = tmp_descriptor;
1419 return RESULT_OK;
1420 } else {
1421 return RESULT_INVALID_FILE_EXTENSION;
1422 }
1423}
1424
1425void IncRef(HFactory factory, HResourceDescriptor rd)
1426{

Callers 2

TEST_PFunction · 0.85
SetResourcePropertyFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by 1

TEST_PFunction · 0.68