MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / EnableLayer

Method EnableLayer

Code/CryEngine/CryEntitySystem/EntitySystem.cpp:3421–3461  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

3419}
3420//////////////////////////////////////////////////////////////////////////
3421void CEntitySystem::EnableLayer(const char* layer, bool isEnable, bool isSerialized)
3422{
3423 if (!gEnv->p3DEngine->IsAreaActivationInUse())
3424 return;
3425 IEntityLayer* pLayer = FindLayer(layer);
3426 if (pLayer)
3427 {
3428 bool bEnableChange = pLayer->IsEnabledBrush() != isEnable;
3429
3430#if ENABLE_STATOSCOPE
3431 if (gEnv->pStatoscope && (pLayer->IsEnabled() != isEnable))
3432 {
3433 string userMarker = "LayerSwitching: ";
3434 userMarker += isEnable ? "Enable " : "Disable ";
3435 userMarker += layer;
3436 gEnv->pStatoscope->AddUserMarker("LayerSwitching", userMarker.c_str());
3437 }
3438#endif
3439
3440 pLayer->Enable(isEnable, isSerialized);
3441
3442 IResourceManager* pResMan = gEnv->pSystem->GetIResourceManager();
3443 if (bEnableChange && pResMan)
3444 {
3445 if (isEnable)
3446 {
3447 if (strlen(pLayer->GetParentName()) > 0)
3448 pResMan->LoadLayerPak(pLayer->GetParentName());
3449 else
3450 pResMan->LoadLayerPak(pLayer->GetName());
3451 }
3452 else
3453 {
3454 if (strlen(pLayer->GetParentName()) > 0)
3455 pResMan->UnloadLayerPak(pLayer->GetParentName());
3456 else
3457 pResMan->UnloadLayerPak(pLayer->GetName());
3458 }
3459 }
3460 }
3461}
3462
3463//////////////////////////////////////////////////////////////////////////
3464bool CEntitySystem::IsLayerEnabled(const char* layer, bool bMustBeLoaded) const

Callers 1

AnimateMethod · 0.45

Calls 12

strlenFunction · 0.85
IsAreaActivationInUseMethod · 0.80
IsEnabledBrushMethod · 0.80
GetIResourceManagerMethod · 0.80
GetParentNameMethod · 0.80
IsEnabledMethod · 0.45
AddUserMarkerMethod · 0.45
c_strMethod · 0.45
EnableMethod · 0.45
LoadLayerPakMethod · 0.45
GetNameMethod · 0.45
UnloadLayerPakMethod · 0.45

Tested by

no test coverage detected