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

Function UpdateScene

engine/gui/src/gui.cpp:2427–2528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2425 }
2426
2427 Result UpdateScene(HScene scene, float dt)
2428 {
2429 Result result = RunScript(scene, SCRIPT_FUNCTION_UPDATE, LUA_NOREF, (void*)&dt);
2430
2431 uint32_t node_count = scene->m_Nodes.Size();
2432 InternalNode* nodes = scene->m_Nodes.Begin();
2433
2434 // It's needed in cases when texture reloaded using hot reload
2435 // There is no way to notify nodes about it
2436 if (dLib::IsDebugMode())
2437 {
2438 DM_PROFILE("DebugUpdateTextureSetAnimData");
2439 for (uint32_t i = 0; i < node_count; ++i)
2440 {
2441 InternalNode* node = &nodes[i];
2442 if (!node->m_Deleted)
2443 {
2444 UpdateTextureSetAnimData(scene, node);
2445 }
2446 }
2447 }
2448
2449 UpdateAnimations(scene, dt);
2450
2451 uint32_t total_nodes = 0;
2452 node_count = scene->m_Nodes.Size();
2453 nodes = scene->m_Nodes.Begin();
2454 for (uint32_t i = 0; i < node_count; ++i)
2455 {
2456 InternalNode* node = &nodes[i];
2457
2458 // Deferred deletion of nodes
2459 if (node->m_Deleted)
2460 {
2461 DeleteNode(scene, GetNodeHandle(node), false);
2462 node->m_Deleted = 0; // Make sure to clear deferred delete flag
2463 node_count = scene->m_Nodes.Size();
2464 }
2465 else if (node->m_Index != INVALID_INDEX)
2466 {
2467 ++total_nodes;
2468 if (node->m_Node.m_CustomType != 0)
2469 {
2470 scene->m_UpdateCustomNodeCallback(scene->m_CreateCustomNodeCallbackContext, scene, GetNodeHandle(node),
2471 node->m_Node.m_CustomType, node->m_Node.m_CustomData, dt);
2472 }
2473 }
2474 }
2475
2476 // Prune sleeping pfx instances
2477 uint32_t count = scene->m_AliveParticlefxs.Size();
2478 uint32_t i = 0;
2479 while (i < count)
2480 {
2481 ParticlefxComponent* c = &scene->m_AliveParticlefxs[i];
2482 if (dmParticle::IsSleeping(scene->m_ParticlefxContext, c->m_Instance))
2483 {
2484 if (c->m_Node != INVALID_HANDLE)

Callers 3

TEST_FFunction · 0.50
TEST_FFunction · 0.50
CompGuiUpdateFunction · 0.50

Calls 12

IsDebugModeFunction · 0.85
UpdateTextureSetAnimDataFunction · 0.85
ResetInternalNodeFunction · 0.85
RunScriptFunction · 0.70
UpdateAnimationsFunction · 0.70
DeleteNodeFunction · 0.70
GetNodeHandleFunction · 0.70
GetNodeFunction · 0.70
IsSleepingFunction · 0.50
DestroyInstanceFunction · 0.50
SizeMethod · 0.45
BeginMethod · 0.45

Tested by 2

TEST_FFunction · 0.40
TEST_FFunction · 0.40