Make particle emitter editor window source code button disable itself is no source code is available

This commit is contained in:
Zode
2025-06-11 23:15:11 +03:00
committed by GitHub
parent eee4e55cf0
commit 27ac755bbe
3 changed files with 38 additions and 1 deletions

View File

@@ -440,4 +440,21 @@ bool ParticleEmitter::Save(const StringView& path)
return SaveSurface(data);
}
bool ParticleEmitter::HasShaderCode()
{
if(SimulationMode != ParticlesSimulationMode::GPU)
{
return false;
}
#if COMPILE_WITH_PARTICLE_GPU_GRAPH && COMPILE_WITH_SHADER_COMPILER
if(_shaderHeader.ParticleEmitter.GraphVersion == PARTICLE_GPU_GRAPH_VERSION
&& HasChunk(SHADER_FILE_CHUNK_SOURCE)
&& !HasDependenciesModified())
return true;
#endif
return false;
}
#endif

View File

@@ -173,6 +173,12 @@ public:
#if USE_EDITOR
void GetReferences(Array<Guid>& assets, Array<String>& files) const override;
bool Save(const StringView& path = StringView::Empty) override;
/// <summary>
/// Determine if the particle emitter has valid shader code present.
/// </summary>
/// <returns>True if particle emitter has shader code, otherwise false.</returns>
API_FUNCTION() bool HasShaderCode();
#endif
protected: