maint: added htrace ssgi

This commit is contained in:
Chris
2025-12-31 12:44:11 -05:00
parent 91ce080f51
commit 54f2d5a85f
203 changed files with 17634 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Extensions;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
[InitializeOnLoad]
public static class AssetWelcomeLoader
{
static AssetWelcomeLoader()
{
EditorApplication.delayCall += TryShowWelcome;
}
private static void TryShowWelcome()
{
if (SessionState.GetBool(HNames.HTRACE_WELCOME_SHOW_SESSION, false))
return;
SessionState.SetBool(HNames.HTRACE_WELCOME_SHOW_SESSION, true);
bool dontShowAgain = EditorPrefs.GetBool(HNames.HTRACE_SHOW_KEY, false);
string currentUnityVersion = Application.unityVersion;
string savedUnityVersion = EditorPrefs.GetString(HNames.HTRACE_UNITY_VERSION_KEY, string.Empty);
bool unityVersionChanged = savedUnityVersion != currentUnityVersion;
bool isLts = HExtensions.IsUnityLTS(currentUnityVersion);
bool shouldShowWelcome = !dontShowAgain || (unityVersionChanged && !isLts);
if (shouldShowWelcome)
{
AssetWelcomeWindow.ShowWindow();
}
EditorPrefs.SetString(HNames.HTRACE_UNITY_VERSION_KEY, currentUnityVersion);
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b548ee64286c45f48d34d1dc643c5c30
timeCreated: 1766077710
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/AssetWelcomeLoader.cs
uploadId: 840002

View File

@@ -0,0 +1,139 @@
#if UNITY_EDITOR
using System;
using HTraceSSGI.Scripts.Extensions;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEngine;
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
public class AssetWelcomeWindow : EditorWindow
{
private static Texture2D _icon;
public static void ShowWindow()
{
_icon = Resources.Load<Texture2D>("SSGI UI Card");
var window = GetWindow<AssetWelcomeWindow>("Welcome");
Vector2 minSize = new Vector2(600, 240);
if (HExtensions.IsUnityLTS(Application.unityVersion))
minSize.y -= 45;
if (_icon != null)
minSize.y += 100;
Vector2 maxSize = minSize - new Vector2(1, 1);
window.minSize = minSize;
window.maxSize = maxSize;
Rect main = EditorGUIUtility.GetMainWindowPosition();
window.position = new Rect(
main.x + (main.width - minSize.x) / 2,
main.y + (main.height - minSize.y) / 2,
minSize.x,
minSize.y
);
}
private void OnGUI()
{
if (_icon != null)
{
GUILayout.Space(5);
Rect rect = GUILayoutUtility.GetAspectRect((float)_icon.width / _icon.height);
rect.xMin += 4;
rect.xMax -= 4;
GUI.DrawTexture(rect, _icon, ScaleMode.ScaleToFit);
EditorGUILayout.Space(5f);
}
GUILayout.Space(5);
GUILayout.Label($"Thank you for purchasing {HNames.ASSET_NAME_FULL_WITH_DOTS}!", EditorStyles.boldLabel);
GUILayout.Space(5);
DrawUnityVersionWarning();
GUILayout.Space(10);
var richLabel = new GUIStyle(EditorStyles.wordWrappedLabel)
{
richText = true
};
GUILayout.Label(
"Please make sure to read the <b>Documentation</b> before using the asset.\n" +
"If you run into any issues, check the <b>Known Issues</b> and <b>FAQ</b> sections before reporting a bug.",
richLabel
);
GUILayout.Space(5);
DrawLinksLine();
GUILayout.Space(10);
GUILayout.Label(
"Shortcuts to the Documentation, Discord support channel, and Bug Report form " +
"can be found at the bottom of the HTrace UI.",
EditorStyles.wordWrappedLabel
);
GUILayout.Space(15);
bool dontShow = GUILayout.Toggle(
EditorPrefs.GetBool(HNames.HTRACE_SHOW_KEY, false),
"Don't show next time"
);
EditorPrefs.SetBool(HNames.HTRACE_SHOW_KEY, dontShow);
GUILayout.Space(10);
if (GUILayout.Button("I understand, close window"))
{
Close();
}
}
private static void DrawUnityVersionWarning()
{
string unityVersion = Application.unityVersion;
if (!HExtensions.IsUnityLTS(unityVersion))
{
EditorGUILayout.HelpBox(
$"The current Unity version ({unityVersion}) is not an LTS release.\n" +
"Bug fixes for non-LTS releases are not guaranteed.",
MessageType.Warning
);
}
}
private static void DrawLinksLine()
{
EditorGUILayout.BeginHorizontal();
DrawLinkButton("Documentation", HNames.HTRACE_SSGI_DOCUMENTATION_LINK);
GUILayout.Label("|", GUILayout.Width(10));
DrawLinkButton("Known Issues", HNames.HTRACE_SSGI_DOCUMENTATION_LINK_KNOWN_ISSUES);
GUILayout.Label("|", GUILayout.Width(10));
DrawLinkButton("FAQ", HNames.HTRACE_SSGI_DOCUMENTATION_LINK_FAQ);
EditorGUILayout.EndHorizontal();
}
private static void DrawLinkButton(string label, string url)
{
var style = new GUIStyle(EditorStyles.linkLabel)
{
wordWrap = false
};
if (GUILayout.Button(label, style, GUILayout.Width(EditorStyles.linkLabel.CalcSize(new GUIContent(label)).x)))
{
Application.OpenURL(url);
}
}
}
}
#endif

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 37241604af0a4e2ea194f52d530a3b97
timeCreated: 1766077786
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/AssetWelcomeWindow.cs
uploadId: 840002

View File

@@ -0,0 +1,98 @@
using HTraceSSGI.Scripts.Globals;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
#if UNITY_EDITOR
public class HBugReporterWindow : EditorWindow
{
private string _reportData = "";
private GUIStyle _styleLabel;
private Vector2 _scrollPosition = Vector2.zero;
[MenuItem("Window/HTrace/Report a Bug HTrace SSGI", false, priority: 32)]
public static void ShowWindow()
{
var window = GetWindow<HBugReporterWindow>(false, "Report Bug", true);
window.minSize = new Vector2(400, 330);
}
void OnEnable()
{
_reportData = "";
var pipeline = HRenderer.CurrentHRenderPipeline.ToString();
_reportData += $"{HNames.ASSET_NAME_FULL} Version: {HNames.HTRACE_SSGI_VERSION}" + "\n";
_reportData += "\n";
_reportData += "Unity Version: " + Application.unityVersion + "\n";
_reportData += "Pipeline: " + pipeline + "\n";
_reportData += "Platform: " + Application.platform + "\n";
_reportData += "Graphics API: " + SystemInfo.graphicsDeviceType + "\n";
_reportData += "\n";
_reportData += "OS: " + SystemInfo.operatingSystem + "\n";
_reportData += "Graphics: " + SystemInfo.graphicsDeviceName + "\n";
_reportData += "\n";
_reportData += "Additional details:\n";
}
void OnGUI()
{
SetGUIStyles();
GUILayout.Space(-2);
GUILayout.BeginHorizontal();
GUILayout.Space(15);
GUILayout.BeginVertical();
_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, false, GUILayout.Width(this.position.width - 28), GUILayout.Height(this.position.height - 80));
GUILayout.Label(_reportData, _styleLabel);
GUILayout.Space(15);
if (GUILayout.Button("Copy Details To Clipboard", GUILayout.Height(24)))
{
var copyData = _reportData;
GUIUtility.systemCopyBuffer = copyData;
}
if (GUILayout.Button("Report Bug on Discord", GUILayout.Height(24)))
{
Application.OpenURL(HNames.HTRACE_DISCORD_BUGS_SSGI_LINK);
}
GUILayout.FlexibleSpace();
GUILayout.Space(20);
GUILayout.EndScrollView();
GUILayout.EndVertical();
GUILayout.Space(13);
GUILayout.EndHorizontal();
}
void SetGUIStyles()
{
_styleLabel = new GUIStyle(EditorStyles.label)
{
richText = true,
};
}
}
#endif
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dba5cecf144f410fb38b07e1de8c0ca1
timeCreated: 1757344409
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/HBugReporterWindow.cs
uploadId: 840002

View File

@@ -0,0 +1,52 @@
//pipelinedefine
#define H_URP
#if UNITY_EDITOR
using HTraceSSGI.Scripts.Data.Private;
using HTraceSSGI.Scripts.Extensions;
using HTraceSSGI.Scripts.Globals;
using UnityEditor;
using UnityEditor.ShortcutManagement;
using UnityEngine;
using HTraceSSGI.Scripts.Infrastructure.URP;
namespace HTraceSSGI.Scripts.Editor.WindowsAndMenu
{
#if UNITY_EDITOR
public class HMenuAndFilesManager : EditorWindow
{
[MenuItem("GameObject/Rendering/HTrace Screen Space Global Illumination", false, priority: 30)]
static void CreateHTraceGameObject(MenuCommand menuCommand)
{
HTraceSSGI[] hTraces = FindObjectsOfType(typeof(HTraceSSGI)) as HTraceSSGI[];
if (hTraces != null && hTraces.Length > 0)
{
return;
}
GameObject go = new GameObject(HNames.ASSET_NAME);
GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject);
go.AddComponent<HTraceSSGI>();
Undo.RegisterCreatedObjectUndo(go, "Create " + go.name);
Selection.activeObject = go;
}
[MenuItem("Window/HTrace/Add HTrace SSGI Render Feature to active RendererData", false, priority: 32)]
private static void AddRenderFeature()
{
HRendererURP.AddHTraceRendererFeatureToUniversalRendererData();
}
[MenuItem("Window/HTrace/Open HTrace SSGI documentation", false, priority: 32)]
private static void OpenDocumentation()
{
Application.OpenURL(HNames.HTRACE_SSGI_DOCUMENTATION_LINK);
}
}
#endif
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4097973eb33709247ad51c90310a5018
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 336896
packageName: 'HTrace: Screen Space Global Illumination URP'
packageVersion: 1.2.0
assetPath: Assets/HTraceSSGI/Scripts/Editor/WindowsAndMenu/HMenuAndFilesManager.cs
uploadId: 840002