Add View button to edit Environment Probe texture asset

This commit is contained in:
Wojtek Figat
2026-01-13 10:36:07 +01:00
parent d9f90f726b
commit e3d1e8a5ea
3 changed files with 22 additions and 1 deletions

View File

@@ -21,10 +21,12 @@ namespace FlaxEditor.CustomEditors.Dedicated
if (Values.HasDifferentTypes == false)
{
var group = layout.Group("Bake");
var group = layout.Group("Probe");
group.Panel.ItemsMargin = new Margin(Utilities.Constants.UIMargin * 2);
_bake = group.Button("Bake").Button;
_bake.Clicked += BakeButtonClicked;
var view = group.Button("View", "Opens the probe texture viewer");
view.Button.Clicked += OnViewButtonClicked;
}
}
@@ -50,5 +52,14 @@ namespace FlaxEditor.CustomEditors.Dedicated
}
}
}
private void OnViewButtonClicked()
{
foreach (var value in Values)
{
if (value is EnvironmentProbe probe && probe.ProbeAsset)
Editor.Instance.ContentEditing.Open(probe.ProbeAsset);
}
}
}
}

View File

@@ -58,6 +58,11 @@ GPUTexture* EnvironmentProbe::GetProbe() const
return _probe ? _probe->GetTexture() : _probeTexture;
}
CubeTexture* EnvironmentProbe::GetProbeAsset() const
{
return _probe;
}
bool EnvironmentProbe::IsUsingCustomProbe() const
{
return _isUsingCustomProbe;

View File

@@ -91,6 +91,11 @@ public:
/// </summary>
API_PROPERTY() GPUTexture* GetProbe() const;
/// <summary>
/// Gets the probe texture asset used during rendering (baked or custom one). Returns null when using virtual probe with realtime generation.
/// </summary>
API_PROPERTY() CubeTexture* GetProbeAsset() const;
/// <summary>
/// True if probe is using custom cube texture (not baked).
/// </summary>