Merge branch 'Zode-particles-sourcecode'
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using FlaxEditor.Content;
|
using FlaxEditor.Content;
|
||||||
using FlaxEditor.CustomEditors;
|
using FlaxEditor.CustomEditors;
|
||||||
|
using FlaxEditor.GUI;
|
||||||
using FlaxEditor.Scripting;
|
using FlaxEditor.Scripting;
|
||||||
using FlaxEditor.Surface;
|
using FlaxEditor.Surface;
|
||||||
using FlaxEditor.Viewport.Previews;
|
using FlaxEditor.Viewport.Previews;
|
||||||
@@ -114,6 +115,7 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
private readonly PropertiesProxy _properties;
|
private readonly PropertiesProxy _properties;
|
||||||
private Tab _previewTab;
|
private Tab _previewTab;
|
||||||
|
private ToolStripButton _showSourceCodeButton;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public ParticleEmitterWindow(Editor editor, AssetItem item)
|
public ParticleEmitterWindow(Editor editor, AssetItem item)
|
||||||
@@ -146,7 +148,8 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
// Toolstrip
|
// Toolstrip
|
||||||
SurfaceUtils.PerformCommonSetup(this, _toolstrip, _surface, out _saveButton, out _undoButton, out _redoButton);
|
SurfaceUtils.PerformCommonSetup(this, _toolstrip, _surface, out _saveButton, out _undoButton, out _redoButton);
|
||||||
_toolstrip.AddButton(editor.Icons.Code64, ShowSourceCode).LinkTooltip("Show generated shader source code");
|
_showSourceCodeButton = _toolstrip.AddButton(editor.Icons.Code64, ShowSourceCode);
|
||||||
|
_showSourceCodeButton.LinkTooltip("Show generated shader source code");
|
||||||
_toolstrip.AddSeparator();
|
_toolstrip.AddSeparator();
|
||||||
_toolstrip.AddButton(editor.Icons.Docs64, () => Platform.OpenUrl(Utilities.Constants.DocsUrl + "manual/particles/index.html")).LinkTooltip("See documentation to learn more");
|
_toolstrip.AddButton(editor.Icons.Docs64, () => Platform.OpenUrl(Utilities.Constants.DocsUrl + "manual/particles/index.html")).LinkTooltip("See documentation to learn more");
|
||||||
}
|
}
|
||||||
@@ -285,5 +288,15 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public SearchAssetTypes AssetType => SearchAssetTypes.ParticleEmitter;
|
public SearchAssetTypes AssetType => SearchAssetTypes.ParticleEmitter;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
base.Update(deltaTime);
|
||||||
|
|
||||||
|
if (_asset == null)
|
||||||
|
return;
|
||||||
|
_showSourceCodeButton.Enabled = _asset.HasShaderCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -440,4 +440,18 @@ bool ParticleEmitter::Save(const StringView& path)
|
|||||||
return SaveSurface(data);
|
return SaveSurface(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ParticleEmitter::HasShaderCode() const
|
||||||
|
{
|
||||||
|
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
|
#endif
|
||||||
|
|||||||
@@ -173,6 +173,11 @@ public:
|
|||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
void GetReferences(Array<Guid>& assets, Array<String>& files) const override;
|
void GetReferences(Array<Guid>& assets, Array<String>& files) const override;
|
||||||
bool Save(const StringView& path = StringView::Empty) override;
|
bool Save(const StringView& path = StringView::Empty) override;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the particle emitter has valid shader code present.
|
||||||
|
/// </summary>
|
||||||
|
API_PROPERTY() bool HasShaderCode() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
Reference in New Issue
Block a user