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

Method ToggleLayerVisibility

Code/CryEngine/CryEntitySystem/EntitySystem.cpp:3108–3148  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

3106
3107//////////////////////////////////////////////////////////////////////////
3108void CEntitySystem::ToggleLayerVisibility(const char* layer, bool isEnabled, bool includeParent)
3109{
3110 IEntityLayer* pLayer = FindLayer(layer);
3111 if (pLayer)
3112 {
3113 const bool bChange = pLayer->IsEnabled() != isEnabled;
3114 if (bChange)
3115 {
3116 // call the Enable() with a special set of parameters for faster operation (LiveCreate specific)
3117 pLayer->Enable(isEnabled, false, false);
3118
3119 // load/unload layer paks
3120 IResourceManager* pResMan = gEnv->pSystem->GetIResourceManager();
3121 if (pResMan)
3122 {
3123 if (isEnabled)
3124 {
3125 if (includeParent && (strlen(pLayer->GetParentName()) > 0))
3126 {
3127 pResMan->LoadLayerPak(pLayer->GetParentName());
3128 }
3129 else
3130 {
3131 pResMan->LoadLayerPak(pLayer->GetName());
3132 }
3133 }
3134 else
3135 {
3136 if (includeParent && strlen(pLayer->GetParentName()) > 0)
3137 {
3138 pResMan->UnloadLayerPak(pLayer->GetParentName());
3139 }
3140 else
3141 {
3142 pResMan->UnloadLayerPak(pLayer->GetName());
3143 }
3144 }
3145 }
3146 }
3147 }
3148}
3149
3150//////////////////////////////////////////////////////////////////////////
3151void CEntitySystem::ToggleLayersBySubstring(const char* pSearchSubstring, const char* pExceptionSubstring, bool isEnable)

Callers 1

ExecuteMethod · 0.80

Calls 8

strlenFunction · 0.85
GetIResourceManagerMethod · 0.80
GetParentNameMethod · 0.80
IsEnabledMethod · 0.45
EnableMethod · 0.45
LoadLayerPakMethod · 0.45
GetNameMethod · 0.45
UnloadLayerPakMethod · 0.45

Tested by

no test coverage detected