From f1824f8b5ed99ded86cae1c39056cd5152e46046 Mon Sep 17 00:00:00 2001 From: Chromium <62724067+Chromum@users.noreply.github.com> Date: Sat, 3 May 2025 06:10:58 +0100 Subject: [PATCH] SCARY STUFF VERY EARLY --- Editor/Scripts/Editor/Batching.meta | 3 + Editor/Scripts/Editor/Batching/Batcher.cs | 20 ++++++ .../Scripts/Editor/Batching/Batcher.cs.meta | 3 + Editor/Scripts/Editor/Batching/Window.meta | 8 +++ .../Editor/Batching/Window/BatchingWindow.cs | 66 +++++++++++++++++++ .../Batching/Window/BatchingWindow.cs.meta | 12 ++++ .../Editor/Batching/Window/BatchingWindow.uss | 5 ++ .../Batching/Window/BatchingWindow.uss.meta | 11 ++++ .../Batching/Window/BatchingWindow.uxml | 3 + .../Batching/Window/BatchingWindow.uxml.meta | 10 +++ .../Image/From Path Nodes/FromPathNode.cs | 2 +- .../Types/Image/Variable Node/VariableNode.cs | 7 +- .../ImageProcessingGraphAssetEditorWindow.cs | 6 ++ 13 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 Editor/Scripts/Editor/Batching.meta create mode 100644 Editor/Scripts/Editor/Batching/Batcher.cs create mode 100644 Editor/Scripts/Editor/Batching/Batcher.cs.meta create mode 100644 Editor/Scripts/Editor/Batching/Window.meta create mode 100644 Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs create mode 100644 Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs.meta create mode 100644 Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss create mode 100644 Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss.meta create mode 100644 Editor/Scripts/Editor/Batching/Window/BatchingWindow.uxml create mode 100644 Editor/Scripts/Editor/Batching/Window/BatchingWindow.uxml.meta diff --git a/Editor/Scripts/Editor/Batching.meta b/Editor/Scripts/Editor/Batching.meta new file mode 100644 index 0000000..da0d46a --- /dev/null +++ b/Editor/Scripts/Editor/Batching.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 32f2e21024994d43a7bc90a006dcd70f +timeCreated: 1746242052 \ No newline at end of file diff --git a/Editor/Scripts/Editor/Batching/Batcher.cs b/Editor/Scripts/Editor/Batching/Batcher.cs new file mode 100644 index 0000000..a7b16e1 --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Batcher.cs @@ -0,0 +1,20 @@ +using UnityEditor; +using UnityEngine; + +namespace ImageProcessingGraph.Editor.Batching +{ + public class Batcher + { + [MenuItem("Assets/Batch Graph", true)] + private static bool ValidateAsAsset() + { + return Selection.activeObject is ImageProcessingGraphAsset; + } + + [MenuItem("Assets/Batch Graph")] + private static void OpenBatchWindow() + { + BatchingWindow.OpenBatchingWindow(Selection.activeObject as ImageProcessingGraphAsset); + } + } +} \ No newline at end of file diff --git a/Editor/Scripts/Editor/Batching/Batcher.cs.meta b/Editor/Scripts/Editor/Batching/Batcher.cs.meta new file mode 100644 index 0000000..5982fd1 --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Batcher.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ba9a14be40ae49b190ae8dd220fb7448 +timeCreated: 1746242057 \ No newline at end of file diff --git a/Editor/Scripts/Editor/Batching/Window.meta b/Editor/Scripts/Editor/Batching/Window.meta new file mode 100644 index 0000000..9bf8dec --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Window.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6b66fa4b0ee2864fb8ffb9d435a9f54 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs new file mode 100644 index 0000000..7e77ab1 --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs @@ -0,0 +1,66 @@ +using ImageProcessingGraph.Editor; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; + +using System.Collections.Generic; +using ImageProcessingGraph.Editor.Nodes.Types.Image.Variable_Node; +using UnityEditor; +using UnityEditor.UIElements; +using UnityEngine; +using UnityEngine.UIElements; + +public class BatchingWindow : EditorWindow +{ + [SerializeField] + private VisualTreeAsset m_VisualTreeAsset = default; + + [SerializeField] + private ImageProcessingGraphAsset m_ImageProcessingGraphAsset; + + private static Dictionary s_OpenWindows = new(); + private List variableNodeFoldouts = new(); + + public static void OpenBatchingWindow(ImageProcessingGraphAsset asset) + { + if (s_OpenWindows.TryGetValue(asset, out BatchingWindow existingWindow)) + { + existingWindow.Focus(); + return; + } + + BatchingWindow window = CreateInstance(); + window.titleContent = new GUIContent($"{asset.name} Batcher"); + window.m_ImageProcessingGraphAsset = asset; + window.Show(); + + s_OpenWindows[asset] = window; + } + + private void OnDestroy() + { + if (m_ImageProcessingGraphAsset != null) + s_OpenWindows.Remove(m_ImageProcessingGraphAsset); + } + + public void CreateGUI() + { + VisualElement root = rootVisualElement; + var VariableNodes = m_ImageProcessingGraphAsset.GetAllVariableNodesWithTypes(); + + foreach (var VARIABLE in VariableNodes) + { + VariableNodeBase node = VARIABLE.node as VariableNodeBase; + + PropertyField pField = new PropertyField(); + pField.AddToClassList("unity-property-field__inspector-property"); + root.Add(pField); + + ListView listView = new ListView(); + listView.AddToClassList("unity-list-view--with-footer"); + listView.AddToClassList("unity-list-view--with-header"); + pField.Add(listView); + + } + } +} diff --git a/Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs.meta b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs.meta new file mode 100644 index 0000000..923b248 --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: df3ef54632d074a4ba43a0d64818221f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - m_VisualTreeAsset: {fileID: 9197481963319205126, guid: 22c3ed385a3ddb541b517dcf84c10c50, type: 3} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss new file mode 100644 index 0000000..218263a --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss @@ -0,0 +1,5 @@ +.custom-label { + font-size: 20px; + -unity-font-style: bold; + color: rgb(68, 138, 255); +} \ No newline at end of file diff --git a/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss.meta b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss.meta new file mode 100644 index 0000000..a49f98a --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91d4a8403aa650147a5dd86a09928f14 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 diff --git a/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uxml b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uxml new file mode 100644 index 0000000..4952bc7 --- /dev/null +++ b/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uxml @@ -0,0 +1,3 @@ + +