Cleanup code

#3546
This commit is contained in:
Wojtek Figat
2025-06-15 20:48:19 +02:00
parent 9464f97e16
commit 2f02ec52ed
3 changed files with 10 additions and 15 deletions

View File

@@ -288,16 +288,15 @@ namespace FlaxEditor.Windows.Assets
/// <inheritdoc />
public SearchAssetTypes AssetType => SearchAssetTypes.ParticleEmitter;
/// <inheritdoc />
public override void Update(float deltaTime)
{
base.Update(deltaTime);
if(_asset == null)
if (_asset == null)
return;
_showSourceCodeButton.Enabled = _asset.HasShaderCode();
_showSourceCodeButton.Enabled = _asset.HasShaderCode;
}
}
}

View File

@@ -440,20 +440,17 @@ bool ParticleEmitter::Save(const StringView& path)
return SaveSurface(data);
}
bool ParticleEmitter::HasShaderCode()
bool ParticleEmitter::HasShaderCode() const
{
if(SimulationMode != ParticlesSimulationMode::GPU)
{
if (SimulationMode != ParticlesSimulationMode::GPU)
return false;
}
#if COMPILE_WITH_PARTICLE_GPU_GRAPH && COMPILE_WITH_SHADER_COMPILER
if(_shaderHeader.ParticleEmitter.GraphVersion == PARTICLE_GPU_GRAPH_VERSION
#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
#endif
return false;
}

View File

@@ -175,10 +175,9 @@ public:
bool Save(const StringView& path = StringView::Empty) override;
/// <summary>
/// Determine if the particle emitter has valid shader code present.
/// Checks 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();
API_PROPERTY() bool HasShaderCode() const;
#endif
protected: