MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SaveSurface

Method SaveSurface

Source/Engine/Particles/ParticleEmitter.cpp:444–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442#if USE_EDITOR
443
444bool ParticleEmitter::SaveSurface(const BytesContainer& data)
445{
446 if (OnCheckSave())
447 return true;
448 ScopeLock lock(Locker);
449
450 // Release all chunks
451 for (int32 i = 0; i < ASSET_FILE_DATA_CHUNKS; i++)
452 ReleaseChunk(i);
453
454 // Clear particle emitter info
455 Platform::MemoryClear(&_shaderHeader, sizeof(_shaderHeader));
456 _shaderHeader.ParticleEmitter.GraphVersion = PARTICLE_GPU_GRAPH_VERSION;
457 _shaderHeader.ParticleEmitter.CustomDataSize = 0;
458
459 // Set Visject Surface data
460 auto visjectSurfaceChunk = GetOrCreateChunk(SHADER_FILE_CHUNK_VISJECT_SURFACE);
461 ASSERT(visjectSurfaceChunk != nullptr);
462 visjectSurfaceChunk->Data.Copy(data);
463
464 if (SaveShaderAsset())
465 {
466 LOG(Error, "Cannot save \'{0}\'", ToString());
467 return true;
468 }
469
470#if COMPILE_WITH_SHADER_CACHE_MANAGER
471 // Invalidate shader cache
472 ShaderCacheManager::RemoveCache(GetID());
473#endif
474
475 return false;
476}
477
478void ParticleEmitter::GetReferences(Array<Guid>& assets, Array<String>& files) const
479{

Callers

nothing calls this directly

Calls 4

MemoryClearFunction · 0.85
GetIDFunction · 0.85
ToStringFunction · 0.50
CopyMethod · 0.45

Tested by

no test coverage detected