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

Function CalculateNodeSize

engine/gui/src/gui.cpp:1375–1405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1373 }
1374
1375 inline void CalculateNodeSize(InternalNode* in)
1376 {
1377 Node& n = in->m_Node;
1378 //TODO: Custom/ParticleFX shouldn't be singled out. It's the others that should be included
1379 if(n.m_SizeMode == SIZE_MODE_MANUAL || n.m_NodeType == NODE_TYPE_CUSTOM ||
1380 n.m_NodeType == NODE_TYPE_PARTICLEFX || n.m_TextureType != NODE_TEXTURE_TYPE_TEXTURE_SET ||
1381 n.m_TextureSetAnimDesc.m_TexCoords == 0x0)
1382 {
1383 return;
1384 }
1385
1386 const float* tc = GetNodeFlipbookAnimUVInternal(in);
1387 TextureSetAnimDesc* anim_desc = &n.m_TextureSetAnimDesc;
1388
1389 float w,h;
1390 if(tc[0] != tc[2] && tc[3] != tc[5])
1391 {
1392 // uv-rotated
1393 w = tc[2]-tc[0];
1394 h = tc[1]-tc[5];
1395 n.m_Properties[PROPERTY_SIZE][0] = h * (float)anim_desc->m_State.m_OriginalTextureHeight;
1396 n.m_Properties[PROPERTY_SIZE][1] = w * (float)anim_desc->m_State.m_OriginalTextureWidth;
1397 }
1398 else
1399 {
1400 w = tc[4]-tc[0];
1401 h = tc[3]-tc[1];
1402 n.m_Properties[PROPERTY_SIZE][0] = w * (float)anim_desc->m_State.m_OriginalTextureWidth;
1403 n.m_Properties[PROPERTY_SIZE][1] = h * (float)anim_desc->m_State.m_OriginalTextureHeight;
1404 }
1405 }
1406
1407 static void DeleteDynamicTextures(HScene scene)
1408 {

Callers 3

UpdateTextureFunction · 0.85
RenderSceneFunction · 0.85
PlayNodeFlipbookAnimFunction · 0.85

Calls 1

Tested by

no test coverage detected