Fix constant value sliders in material graphs to not be used due to shader compilations

This commit is contained in:
Wojtek Figat
2023-11-28 23:19:47 +01:00
parent d3a77c7a55
commit c6017a21f3
3 changed files with 12 additions and 0 deletions

View File

@@ -33,6 +33,10 @@ namespace FlaxEditor.Surface.Elements
Archetype = archetype;
ParentNode.ValuesChanged += OnNodeValuesChanged;
// Disable slider if surface doesn't allow it
if (!ParentNode.Surface.CanLivePreviewValueChanges)
_slideSpeed = 0.0f;
}
private void OnNodeValuesChanged()

View File

@@ -22,6 +22,9 @@ namespace FlaxEditor.Surface
{
}
/// <inheritdoc />
public override bool CanLivePreviewValueChanges => false;
/// <inheritdoc />
public override string GetTypeName(ScriptType type)
{

View File

@@ -534,6 +534,11 @@ namespace FlaxEditor.Surface
/// </summary>
public virtual bool CanSetParameters => false;
/// <summary>
/// Gets a value indicating whether surface supports/allows live previewing graph modifications due to value sliders and color pickers. True by default but disabled for shader surfaces that generate and compile shader source at flight.
/// </summary>
public virtual bool CanLivePreviewValueChanges => true;
/// <summary>
/// Determines whether the specified node archetype can be used in the surface.
/// </summary>