CumBuckets
This commit is contained in:
parent
1b941d6531
commit
687c52df62
@ -1,50 +1,51 @@
|
|||||||
using ImageProcessingGraph.Editor.Windows;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Callbacks;
|
using UnityEditor.Callbacks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ImageProcessingGraph.Editor.Nodes.Types.Image.Variable_Node;
|
using AssetGraph.Core.GraphElements;
|
||||||
|
using AssetGraph.Nodes;
|
||||||
|
using ImageProcessingGraph.Editor;
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using Debug = UnityEngine.Debug;
|
using Debug = UnityEngine.Debug;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
[CreateAssetMenu(menuName = "Image Processing Graph/New Graph")]
|
[CreateAssetMenu(menuName = "Image Processing Graph/New Graph")]
|
||||||
public class ImageProcessingGraphAsset : ScriptableObject
|
public class AssetGraphData : ScriptableObject
|
||||||
{
|
{
|
||||||
[SerializeReference] private List<BaseImageNode> nodes;
|
[SerializeField] private List<AssetGraphNode> nodes;
|
||||||
[SerializeField] private List<GraphConnection> connections;
|
[SerializeField] private List<GraphConnection> connections;
|
||||||
[SerializeReference] public List<BaseImageNode> runOrder;
|
[SerializeField] public List<AssetGraphNode> runOrder;
|
||||||
[SerializeField] public List<IPT_StickyNoteData> stickyNotes;
|
[SerializeField] public List<AssetGraphStickyNoteData> stickyNotes;
|
||||||
|
|
||||||
public List<BaseImageNode> Nodes => nodes;
|
public List<AssetGraphNode> Nodes => nodes;
|
||||||
public List<GraphConnection> Connections => connections;
|
public List<GraphConnection> Connections => connections;
|
||||||
|
|
||||||
public delegate void OnRunEvent();
|
public delegate void OnRunEvent();
|
||||||
public event OnRunEvent OnRun;
|
public event OnRunEvent OnRun;
|
||||||
public OnRunEvent OnRunEnd;
|
public OnRunEvent OnRunEnd;
|
||||||
|
|
||||||
public ImageProcessingGraphAsset()
|
public AssetGraphData()
|
||||||
{
|
{
|
||||||
nodes = new List<BaseImageNode>();
|
nodes = new List<AssetGraphNode>();
|
||||||
connections = new List<GraphConnection>();
|
connections = new List<GraphConnection>();
|
||||||
stickyNotes = new List<IPT_StickyNoteData>();
|
stickyNotes = new List<AssetGraphStickyNoteData>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[OnOpenAsset(1)]
|
[OnOpenAsset(1)]
|
||||||
public static bool OpenGraphAsset(int instanceID, int line)
|
public static bool OpenGraphAsset(int instanceID, int line)
|
||||||
{
|
{
|
||||||
var asset = EditorUtility.InstanceIDToObject(instanceID) as ImageProcessingGraphAsset;
|
var asset = EditorUtility.InstanceIDToObject(instanceID) as AssetGraphData;
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphEditorWindow.Open(asset);
|
AssetGraphEditorWindow.Open(asset);
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunGraph()
|
public void RunGraph()
|
||||||
@ -79,9 +80,9 @@ namespace ImageProcessingGraph.Editor
|
|||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<(BaseImageNode node, System.Type type)> GetAllVariableNodesWithTypes()
|
public List<(AssetGraphNode node, System.Type type)> GetAllVariableNodesWithTypes()
|
||||||
{
|
{
|
||||||
var result = new List<(BaseImageNode node, System.Type type)>();
|
var result = new List<(AssetGraphNode node, System.Type type)>();
|
||||||
|
|
||||||
foreach (var node in nodes)
|
foreach (var node in nodes)
|
||||||
{
|
{
|
||||||
@ -100,18 +101,11 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<AssetGraphNode> GetExecutionOrder(List<AssetGraphNode> nodes, List<GraphConnection> connections, bool debug = false)
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Computes a topological execution order of nodes based on their dependencies.
|
|
||||||
/// Throws if a cycle is detected or nodes are missing from the input list.
|
|
||||||
/// </summary>
|
|
||||||
public List<BaseImageNode> GetExecutionOrder(List<BaseImageNode> nodes, List<GraphConnection> connections, bool debug = false)
|
|
||||||
{
|
{
|
||||||
// === Initialization ===
|
// === Initialization ===
|
||||||
var nodeMap = new Dictionary<string, BaseImageNode>(nodes.Count);
|
var nodeMap = new Dictionary<string, AssetGraphNode>(nodes.Count);
|
||||||
var adjList = new Dictionary<string, List<string>>(nodes.Count);
|
var adjList = new Dictionary<string, List<string>>(nodes.Count);
|
||||||
var inDegree = new Dictionary<string, int>(nodes.Count);
|
var inDegree = new Dictionary<string, int>(nodes.Count);
|
||||||
|
|
||||||
@ -148,7 +142,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// === Topological Sort (Kahn's Algorithm) ===
|
// === Topological Sort (Kahn's Algorithm) ===
|
||||||
var executionOrder = new List<BaseImageNode>(nodes.Count);
|
var executionOrder = new List<AssetGraphNode>(nodes.Count);
|
||||||
var queue = new Queue<string>(nodes.Count);
|
var queue = new Queue<string>(nodes.Count);
|
||||||
|
|
||||||
foreach (var kvp in inDegree)
|
foreach (var kvp in inDegree)
|
3
Editor/Scripts/Editor/Attributes.meta
Normal file
3
Editor/Scripts/Editor/Attributes.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 43834c706e924da6b7f11712b89420bc
|
||||||
|
timeCreated: 1747472390
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.NodeAttributes
|
namespace AssetGraph.Core.Attributes
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class NodeInfoAttribute : Attribute
|
public class NodeInfoAttribute : Attribute
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 32f2e21024994d43a7bc90a006dcd70f
|
|
||||||
timeCreated: 1746242052
|
|
@ -1,20 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ba9a14be40ae49b190ae8dd220fb7448
|
|
||||||
timeCreated: 1746242057
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b6b66fa4b0ee2864fb8ffb9d435a9f54
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,63 +0,0 @@
|
|||||||
using ImageProcessingGraph.Editor;
|
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UIElements;
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using ImageProcessingGraph.Editor.Nodes.Types.Image.Variable_Node;
|
|
||||||
using UnityEditor.UIElements;
|
|
||||||
|
|
||||||
public class BatchingWindow : EditorWindow
|
|
||||||
{
|
|
||||||
[SerializeField]
|
|
||||||
private VisualTreeAsset m_VisualTreeAsset = default;
|
|
||||||
|
|
||||||
[SerializeField]
|
|
||||||
private ImageProcessingGraphAsset m_ImageProcessingGraphAsset;
|
|
||||||
|
|
||||||
private static Dictionary<ImageProcessingGraphAsset, BatchingWindow> s_OpenWindows = new();
|
|
||||||
private List<Foldout> variableNodeFoldouts = new();
|
|
||||||
|
|
||||||
public static void OpenBatchingWindow(ImageProcessingGraphAsset asset)
|
|
||||||
{
|
|
||||||
if (s_OpenWindows.TryGetValue(asset, out BatchingWindow existingWindow))
|
|
||||||
{
|
|
||||||
existingWindow.Focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BatchingWindow window = CreateInstance<BatchingWindow>();
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
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:
|
|
@ -1,5 +0,0 @@
|
|||||||
.custom-label {
|
|
||||||
font-size: 20px;
|
|
||||||
-unity-font-style: bold;
|
|
||||||
color: rgb(68, 138, 255);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 91d4a8403aa650147a5dd86a09928f14
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
disableValidation: 0
|
|
@ -1,3 +0,0 @@
|
|||||||
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
|
||||||
<Style src="project://database/Assets/Unity%20Image%20Processing/Editor/Scripts/Editor/Batching/Window/BatchingWindow.uss?fileID=7433441132597879392&guid=91d4a8403aa650147a5dd86a09928f14&type=3#BatchingWindow" />
|
|
||||||
</engine:UXML>
|
|
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 22c3ed385a3ddb541b517dcf84c10c50
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
|
@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
|
||||||
{
|
|
||||||
public class IPT_Preferences : ScriptableObject
|
|
||||||
{
|
|
||||||
public bool debugMode = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 80dcc02594d68e3439df7dc743c9d4b2
|
|
@ -3,77 +3,51 @@ using System.IO;
|
|||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A structure that holds image pixel data and its dimensions.
|
namespace AssetGraph.Core.DataTypes
|
||||||
/// </summary>
|
|
||||||
[Serializable]
|
|
||||||
public struct ImageData
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
[Serializable]
|
||||||
/// The pixel data of the image in Color32 format.
|
|
||||||
/// </summary>
|
|
||||||
public NativeArray<Color32> PixelData;
|
|
||||||
|
|
||||||
/// <summary>
|
public struct ImageData
|
||||||
/// The width and height of the image (width, height).
|
|
||||||
/// </summary>
|
|
||||||
public (int width, int height) Dimensions;
|
|
||||||
|
|
||||||
public bool isRGBA;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="ImageData"/> struct using existing pixel data and dimensions.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="imageData">The pixel data as a NativeArray of Color32.</param>
|
|
||||||
/// <param name="widthHeight">A tuple containing the width and height of the image.</param>
|
|
||||||
public ImageData(NativeArray<Color32> imageData, (int width, int height) widthHeight, bool isRgba)
|
|
||||||
{
|
{
|
||||||
PixelData = imageData;
|
public NativeArray<Color32> PixelData;
|
||||||
Dimensions = widthHeight;
|
public (int width, int height) Dimensions;
|
||||||
isRGBA = isRgba;
|
public bool isRGBA;
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
public ImageData(NativeArray<Color32> imageData, (int width, int height) widthHeight, bool isRgba)
|
||||||
/// Initializes a new instance of the <see cref="ImageData"/> struct from a Texture2D object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sourceTexture">The source texture to extract pixel data from.</param>
|
|
||||||
public ImageData(Texture2D sourceTexture)
|
|
||||||
{
|
|
||||||
PixelData = new NativeArray<Color32>(sourceTexture.GetPixelData<Color32>(0), Allocator.Persistent);
|
|
||||||
Dimensions = (sourceTexture.width, sourceTexture.height);
|
|
||||||
isRGBA = sourceTexture.format == TextureFormat.RGBA32;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the width of the image.
|
|
||||||
/// </summary>
|
|
||||||
public int Width => Dimensions.width;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the height of the image.
|
|
||||||
/// </summary>
|
|
||||||
public int Height => Dimensions.height;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Converts the ImageData back into a new Texture2D.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A Texture2D object created from the stored pixel data.</returns>
|
|
||||||
public Texture2D ToTexture2D()
|
|
||||||
{
|
|
||||||
var texture = new Texture2D(Width, Height, TextureFormat.RGBA32, false);
|
|
||||||
texture.LoadRawTextureData(PixelData);
|
|
||||||
texture.Apply();
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ExportPNG(string path)
|
|
||||||
{
|
|
||||||
Texture2D texture = this.ToTexture2D();
|
|
||||||
byte[] data = texture.EncodeToPNG();
|
|
||||||
|
|
||||||
if (data != null)
|
|
||||||
{
|
{
|
||||||
System.IO.File.WriteAllBytes(path, data);
|
PixelData = imageData;
|
||||||
|
Dimensions = widthHeight;
|
||||||
|
isRGBA = isRgba;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageData(Texture2D sourceTexture)
|
||||||
|
{
|
||||||
|
PixelData = new NativeArray<Color32>(sourceTexture.GetPixelData<Color32>(0), Allocator.Persistent);
|
||||||
|
Dimensions = (sourceTexture.width, sourceTexture.height);
|
||||||
|
isRGBA = sourceTexture.format == TextureFormat.RGBA32;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Width => Dimensions.width;
|
||||||
|
public int Height => Dimensions.height;
|
||||||
|
|
||||||
|
public Texture2D ToTexture2D()
|
||||||
|
{
|
||||||
|
var texture = new Texture2D(Width, Height, TextureFormat.RGBA32, false);
|
||||||
|
texture.LoadRawTextureData(PixelData);
|
||||||
|
texture.Apply();
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExportPNG(string path)
|
||||||
|
{
|
||||||
|
Texture2D texture = this.ToTexture2D();
|
||||||
|
byte[] data = texture.EncodeToPNG();
|
||||||
|
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
File.WriteAllBytes(path, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,46 +2,22 @@
|
|||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
/// <summary>
|
namespace AssetGraph.Core.DataTypes
|
||||||
/// Represents a single image channel (e.g., Red, Green, Blue, Alpha) as a 1D byte array,
|
|
||||||
/// along with the original image dimensions.
|
|
||||||
/// </summary>
|
|
||||||
public struct SplitChannelData
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
public struct SplitChannelData
|
||||||
/// The 8-bit intensity values for a single image channel, stored in row-major order.
|
|
||||||
/// </summary>
|
|
||||||
public byte[] ChannelData;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The width and height of the channel data (width, height).
|
|
||||||
/// </summary>
|
|
||||||
public (int width, int height) Dimensions;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="SplitChannelData"/> struct
|
|
||||||
/// using channel data and dimensions.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="channelData">The byte array representing the single channel values.</param>
|
|
||||||
/// <param name="widthHeight">A tuple of (width, height) representing the dimensions.</param>
|
|
||||||
public SplitChannelData(byte[] channelData, (int width, int height) widthHeight)
|
|
||||||
{
|
{
|
||||||
ChannelData = channelData;
|
public byte[] ChannelData;
|
||||||
Dimensions = widthHeight;
|
public (int width, int height) Dimensions;
|
||||||
|
|
||||||
|
public SplitChannelData(byte[] channelData, (int width, int height) widthHeight)
|
||||||
|
{
|
||||||
|
ChannelData = channelData;
|
||||||
|
Dimensions = widthHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Width => Dimensions.width;
|
||||||
|
public int Height => Dimensions.height;
|
||||||
|
public bool IsValid => ChannelData != null && ChannelData.Length == Width * Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
}
|
||||||
/// Gets the width of the channel data.
|
|
||||||
/// </summary>
|
|
||||||
public int Width => Dimensions.width;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the height of the channel data.
|
|
||||||
/// </summary>
|
|
||||||
public int Height => Dimensions.height;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether the channel data is valid (non-null and matches the expected size).
|
|
||||||
/// </summary>
|
|
||||||
public bool IsValid => ChannelData != null && ChannelData.Length == Width * Height;
|
|
||||||
}
|
|
3
Editor/Scripts/Editor/GraphElements.meta
Normal file
3
Editor/Scripts/Editor/GraphElements.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 458de9252a6744148203b96771e2ad90
|
||||||
|
timeCreated: 1747472377
|
@ -3,10 +3,10 @@ using UnityEditor.Experimental.GraphView;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Core.GraphElements
|
||||||
{
|
{
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class IPT_StickyNoteData
|
public class AssetGraphStickyNoteData
|
||||||
{
|
{
|
||||||
[SerializeField] private string guid;
|
[SerializeField] private string guid;
|
||||||
[SerializeField] private string title;
|
[SerializeField] private string title;
|
||||||
@ -23,7 +23,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
public Rect Position { get => position; set => position = value; }
|
public Rect Position { get => position; set => position = value; }
|
||||||
public Vector2 Size { get => size; set => size = value; }
|
public Vector2 Size { get => size; set => size = value; }
|
||||||
|
|
||||||
public IPT_StickyNoteData(string title)
|
public AssetGraphStickyNoteData(string title)
|
||||||
{
|
{
|
||||||
this.guid = Guid.NewGuid().ToString();
|
this.guid = Guid.NewGuid().ToString();
|
||||||
}
|
}
|
||||||
@ -31,14 +31,14 @@ namespace ImageProcessingGraph.Editor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class IPT_StickyNote : StickyNote
|
public class AssetGraphStickyNote : StickyNote
|
||||||
{
|
{
|
||||||
private IPT_StickyNoteData data;
|
private AssetGraphStickyNoteData data;
|
||||||
public IPT_StickyNoteData Data => data;
|
public AssetGraphStickyNoteData Data => data;
|
||||||
|
|
||||||
private ImageProcessingGraphViewWindow window;
|
private AssetGraphViewWindow window;
|
||||||
|
|
||||||
public IPT_StickyNote(IPT_StickyNoteData data, ImageProcessingGraphViewWindow window)
|
public AssetGraphStickyNote(AssetGraphStickyNoteData data, AssetGraphViewWindow window)
|
||||||
{
|
{
|
||||||
this.theme = StickyNoteTheme.Black;
|
this.theme = StickyNoteTheme.Black;
|
||||||
this.window = window;
|
this.window = window;
|
@ -6,7 +6,7 @@ using UnityEditor.UIElements;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Core.GraphElements
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class GreyscaleValue
|
public class GreyscaleValue
|
3
Editor/Scripts/Editor/GraphViewOverwrites.meta
Normal file
3
Editor/Scripts/Editor/GraphViewOverwrites.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1403355e956148e3a298f151e782e76c
|
||||||
|
timeCreated: 1747472333
|
@ -1,9 +1,9 @@
|
|||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
public class IPT_Edge : Edge
|
public class AssetGraphEdge : Edge
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
@ -1,15 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector;
|
using AssetGraph.Nodes;
|
||||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
public class IPTPort : Port
|
public class AssetGraphPort : Port
|
||||||
{
|
{
|
||||||
public FieldInfo fieldInfo;
|
public FieldInfo fieldInfo;
|
||||||
private VisualElement _exposedPropertyContainer;
|
private VisualElement _exposedPropertyContainer;
|
||||||
@ -32,18 +31,14 @@ namespace ImageProcessingGraph.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IPTPort(Orientation portOrientation, Direction portDirection, Capacity portCapacity, Type type) : base(portOrientation, portDirection, portCapacity, type)
|
protected AssetGraphPort(Orientation portOrientation, Direction portDirection, Capacity portCapacity, Type type) : base(portOrientation, portDirection, portCapacity, type)
|
||||||
{
|
{
|
||||||
this.tooltip = $"{this.portType.ToString()}";
|
this.tooltip = $"{this.portType.ToString()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Connect(Edge edge)
|
public override void Connect(Edge edge)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphNodeVisual IPTVis = this.node as ImageProcessingGraphNodeVisual;
|
if (this.node is AssetGraphNodeEditor IPTVis && IPTVis.GraphNode is GenericConnection)
|
||||||
|
|
||||||
IPTPort extenalPort = null;
|
|
||||||
|
|
||||||
if (IPTVis.GraphNode is GenericConnection bleh)
|
|
||||||
{
|
{
|
||||||
foreach (var port in IPTVis.AllPorts)
|
foreach (var port in IPTVis.AllPorts)
|
||||||
{
|
{
|
||||||
@ -57,15 +52,15 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
public override void Disconnect(Edge edge)
|
public override void Disconnect(Edge edge)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphNodeVisual IPTVis = this.node as ImageProcessingGraphNodeVisual;
|
AssetGraphNodeEditor IPTVis = this.node as AssetGraphNodeEditor;
|
||||||
|
|
||||||
if (IPTVis.GraphNode is GenericConnection bleh)
|
if (IPTVis != null && IPTVis.GraphNode is GenericConnection bleh)
|
||||||
{
|
{
|
||||||
bool allPortsDisconnected = true;
|
bool allPortsDisconnected = true;
|
||||||
|
|
||||||
foreach (var port in IPTVis.AllPorts)
|
foreach (var port in IPTVis.AllPorts)
|
||||||
{
|
{
|
||||||
if (port.connections != null && port.connections.Count() > 0)
|
if (port.connections != null && port.connections.Any())
|
||||||
{
|
{
|
||||||
allPortsDisconnected = false;
|
allPortsDisconnected = false;
|
||||||
break;
|
break;
|
||||||
@ -94,9 +89,9 @@ namespace ImageProcessingGraph.Editor
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPTPort Create(IEdgeConnectorListener connectorListener, bool isInput, Type type)
|
public static AssetGraphPort Create(IEdgeConnectorListener connectorListener, bool isInput, Type type)
|
||||||
{
|
{
|
||||||
var port = new IPTPort(Orientation.Horizontal, isInput ? Direction.Input : Direction.Output,
|
var port = new AssetGraphPort(Orientation.Horizontal, isInput ? Direction.Input : Direction.Output,
|
||||||
isInput ? Capacity.Single : Capacity.Multi, type)
|
isInput ? Capacity.Single : Capacity.Multi, type)
|
||||||
{
|
{
|
||||||
m_EdgeConnector = new EdgeConnector<Edge>(connectorListener),
|
m_EdgeConnector = new EdgeConnector<Edge>(connectorListener),
|
@ -2,16 +2,18 @@ using System;
|
|||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Input = ImageProcessingGraph.Editor.Nodes.NodeAttributes.Input;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using AssetGraph.Core;
|
||||||
|
using AssetGraph.Core.Attributes;
|
||||||
|
using ImageProcessingGraph.Editor;
|
||||||
|
using Input = AssetGraph.Core.Attributes.Input;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public abstract class BaseImageNode
|
public abstract class AssetGraphNode
|
||||||
{
|
{
|
||||||
[SerializeField] private string guid;
|
[SerializeField] private string guid;
|
||||||
|
|
||||||
@ -24,12 +26,12 @@ namespace ImageProcessingGraph.Editor
|
|||||||
public string ID => guid;
|
public string ID => guid;
|
||||||
public Rect Position => position;
|
public Rect Position => position;
|
||||||
|
|
||||||
public ImageProcessingGraphAsset asset;
|
public AssetGraphData asset;
|
||||||
|
|
||||||
public delegate void OnFailed();
|
public delegate void OnFailed();
|
||||||
public event OnFailed onFailed;
|
public event OnFailed onFailed;
|
||||||
|
|
||||||
public BaseImageNode()
|
public AssetGraphNode()
|
||||||
{
|
{
|
||||||
guid = Guid.NewGuid().ToString();
|
guid = Guid.NewGuid().ToString();
|
||||||
}
|
}
|
||||||
@ -48,7 +50,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
// Find the connection that leads to this input property
|
// Find the connection that leads to this input property
|
||||||
GraphConnection connection = default;
|
GraphConnection connection = default;
|
||||||
|
|
||||||
foreach (var conn in asset.Connections)
|
foreach (GraphConnection conn in asset.Connections)
|
||||||
{
|
{
|
||||||
if (conn.inputPort.nodeID == this.ID)
|
if (conn.inputPort.nodeID == this.ID)
|
||||||
{
|
{
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using UnityEditor.Experimental.GraphView;
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
|
||||||
{
|
|
||||||
public class ExposedPropertyPort : Port
|
|
||||||
{
|
|
||||||
protected ExposedPropertyPort(Orientation portOrientation, Direction portDirection, Capacity portCapacity, Type type) : base(portOrientation, portDirection, portCapacity, type)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 31313dec455d4407bb6fffc7b167dabb
|
|
||||||
timeCreated: 1743744035
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: dbd7cd37cae147f3a54f12c52ef54217
|
|
||||||
timeCreated: 1742158168
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 587f3b2d6fad453fbf6664066f807f21
|
|
||||||
timeCreated: 1745299284
|
|
@ -1,18 +1,19 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfoAttribute("Invert Channel", "Adjustments/InvertChannel", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvertChannel")]
|
[NodeInfo("Invert Channel", "Adjustments/InvertChannel", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvertChannel")]
|
||||||
public class ChannelInvertNode : BaseImageNode
|
public class ChannelInvertNode : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("Input Channel")]
|
[Core.Attributes.Input("Input Channel")]
|
||||||
public SplitChannelData inputChannel;
|
public SplitChannelData inputChannel;
|
||||||
|
|
||||||
[NodeAttributes.Output("Output Channel")]
|
[Core.Attributes.Output("Output Channel")]
|
||||||
public SplitChannelData outputChannel;
|
public SplitChannelData outputChannel;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
@ -6,15 +7,15 @@ using UnityEngine;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfoAttribute("Desaturate", "Adjustments/Desaturate", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FDesaturate")]
|
[NodeInfo("Desaturate", "Adjustments/Desaturate", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FDesaturate")]
|
||||||
public class Texture2DDesaturate : BaseImageNode
|
public class Texture2DDesaturate : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("")]
|
[Core.Attributes.Input("")]
|
||||||
public ImageData inputTexture;
|
public ImageData inputTexture;
|
||||||
|
|
||||||
[NodeAttributes.Output("")]
|
[Core.Attributes.Output("")]
|
||||||
public ImageData outputTexture;
|
public ImageData outputTexture;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfoAttribute("Invert", "Adjustments/Invert", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvert")]
|
[NodeInfo("Invert", "Adjustments/Invert", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvert")]
|
||||||
public class Texture2DInvert : BaseImageNode
|
public class Texture2DInvert : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("")]
|
[Core.Attributes.Input("")]
|
||||||
public ImageData inputTexture;
|
public ImageData inputTexture;
|
||||||
|
|
||||||
[NodeAttributes.Output("")]
|
[Core.Attributes.Output("")]
|
||||||
public ImageData outputTexture;
|
public ImageData outputTexture;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
|
@ -1,27 +1,28 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfo("RGBA Combine", "Channels/RGBA Combine", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBACombine")]
|
[NodeInfo("RGBA Combine", "Channels/RGBA Combine", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBACombine")]
|
||||||
public class RGBASCombine : BaseImageNode
|
public class RGBASCombine : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("R")]
|
[Core.Attributes.Input("R")]
|
||||||
public SplitChannelData r;
|
public SplitChannelData r;
|
||||||
|
|
||||||
[NodeAttributes.Input("G")]
|
[Core.Attributes.Input("G")]
|
||||||
public SplitChannelData g;
|
public SplitChannelData g;
|
||||||
|
|
||||||
[NodeAttributes.Input("B")]
|
[Core.Attributes.Input("B")]
|
||||||
public SplitChannelData b;
|
public SplitChannelData b;
|
||||||
|
|
||||||
[NodeAttributes.Input("A")]
|
[Core.Attributes.Input("A")]
|
||||||
public SplitChannelData a;
|
public SplitChannelData a;
|
||||||
|
|
||||||
[NodeAttributes.Output("")]
|
[Core.Attributes.Output("")]
|
||||||
public ImageData inputTexture;
|
public ImageData inputTexture;
|
||||||
|
|
||||||
// Job struct for combining RGBA channels
|
// Job struct for combining RGBA channels
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfoAttribute("RGBA Split", "Channels/RGBA Split", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBASplit")]
|
[NodeInfo("RGBA Split", "Channels/RGBA Split", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBASplit")]
|
||||||
public class RGBASplit : BaseImageNode
|
public class RGBASplit : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("")]
|
[Core.Attributes.Input("")]
|
||||||
public ImageData inputTexture;
|
public ImageData inputTexture;
|
||||||
|
|
||||||
[NodeAttributes.Output("R")]
|
[Core.Attributes.Output("R")]
|
||||||
public SplitChannelData r;
|
public SplitChannelData r;
|
||||||
[NodeAttributes.Output("G")]
|
[Core.Attributes.Output("G")]
|
||||||
public SplitChannelData g;
|
public SplitChannelData g;
|
||||||
[NodeAttributes.Output("B")]
|
[Core.Attributes.Output("B")]
|
||||||
public SplitChannelData b;
|
public SplitChannelData b;
|
||||||
[NodeAttributes.Output("A")]
|
[Core.Attributes.Output("A")]
|
||||||
public SplitChannelData a;
|
public SplitChannelData a;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfoAttribute("Get Dimensions", "Dimensions/Get Dimensions", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FGetDimensions")]
|
[NodeInfo("Get Dimensions", "Dimensions/Get Dimensions", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FGetDimensions")]
|
||||||
public class TextureGetDimensions : BaseImageNode
|
public class TextureGetDimensions : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("")]
|
[Core.Attributes.Input("")]
|
||||||
public ImageData inputTexture;
|
public ImageData inputTexture;
|
||||||
|
|
||||||
[NodeAttributes.Output("Width")]
|
[Core.Attributes.Output("Width")]
|
||||||
public int width;
|
public int width;
|
||||||
|
|
||||||
[NodeAttributes.Output("Height")]
|
[Core.Attributes.Output("Height")]
|
||||||
public int height;
|
public int height;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
using System.ComponentModel.Composition.Primitives;
|
using System.ComponentModel.Composition.Primitives;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Output
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfo("Texture Export", "Export/Texture Export", true,docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FTexture2DOutput")]
|
[NodeInfo("Texture Export", "Export/Texture Export", true,docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FTexture2DOutput")]
|
||||||
public class Texture2DOutput : BaseImageNode
|
public class Texture2DOutput : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("")] public ImageData inputPixels;
|
[Core.Attributes.Input("")] public ImageData inputPixels;
|
||||||
[NodeAttributes.Input("File Name")] public string fileName;
|
[Core.Attributes.Input("File Name")] public string fileName;
|
||||||
[NodeAttributes.Input("File Directory")] public string fileDirectory;
|
[Core.Attributes.Input("File Directory")] public string fileDirectory;
|
||||||
|
|
||||||
public enum ExportType
|
public enum ExportType
|
||||||
{
|
{
|
||||||
@ -19,10 +20,10 @@ namespace ImageProcessingGraph.Editor.Nodes.Output
|
|||||||
PNG
|
PNG
|
||||||
}
|
}
|
||||||
|
|
||||||
[NodeAttributes.Input("Export Type")] public ExportType exportType;
|
[Core.Attributes.Input("Export Type")] public ExportType exportType;
|
||||||
[NodeAttributes.Input("Texture Type")] public TextureImporterType textureType;
|
[Core.Attributes.Input("Texture Type")] public TextureImporterType textureType;
|
||||||
|
|
||||||
[NodeAttributes.Output("Output Texture")] public Texture2D textureOutput;
|
[Core.Attributes.Output("Output Texture")] public Texture2D textureOutput;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Security.Policy;
|
using System.Security.Policy;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.From_Path_Nodes
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
public class FromPathNode<T> : BaseImageNode where T : UnityEngine.Object
|
public class FromPathNode<T> : AssetGraphNode where T : UnityEngine.Object
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("Path")] public string path;
|
[Core.Attributes.Input("Path")] public string path;
|
||||||
[NodeAttributes.Output("Output")] public T output;
|
[Core.Attributes.Output("Output")] public T output;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Import_Nodes
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfo("Texture Import", "Imports/Import Texture", docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FTexture2DImport")]
|
[NodeInfo("Texture Import", "Imports/Import Texture", docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FTexture2DImport")]
|
||||||
public class Texture2DImport : BaseImageNode
|
public class Texture2DImport : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("")]
|
[Core.Attributes.Input("")]
|
||||||
public Texture2D textureImport;
|
public Texture2D textureImport;
|
||||||
|
|
||||||
[NodeAttributes.Output("")]
|
[Core.Attributes.Output("")]
|
||||||
public ImageData textureOutput;
|
public ImageData textureOutput;
|
||||||
[NodeAttributes.Output("File Name")]
|
[Core.Attributes.Output("File Name")]
|
||||||
public string fileName;
|
public string fileName;
|
||||||
[NodeAttributes.Output("File Directory")]
|
[Core.Attributes.Output("File Directory")]
|
||||||
public string filePath;
|
public string filePath;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
|
using AssetGraph.Core.GraphElements;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Utilities
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
public class SingleChannelColor
|
public class SingleChannelColor
|
||||||
{
|
{
|
||||||
[NodeInfoAttribute("Channel Color", "Utility/Channel Color", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FSingleChannelColor")]
|
[NodeInfo("Channel Color", "Utility/Channel Color", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FSingleChannelColor")]
|
||||||
public class SingleColorChannel : BaseImageNode
|
public class SingleColorChannel : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("Color")] public GreyscaleValue range;
|
[Core.Attributes.Input("Color")] public GreyscaleValue range;
|
||||||
|
|
||||||
[NodeAttributes.Input("Width")] public int Width;
|
[Core.Attributes.Input("Width")] public int Width;
|
||||||
|
|
||||||
[NodeAttributes.Input("Height")] public int Height;
|
[Core.Attributes.Input("Height")] public int Height;
|
||||||
|
|
||||||
[NodeAttributes.Output("Color")] public SplitChannelData OutputColor;
|
[Core.Attributes.Output("Color")] public SplitChannelData OutputColor;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.DataTypes;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Unity.Collections;
|
using Unity.Collections;
|
||||||
using Unity.Jobs;
|
using Unity.Jobs;
|
||||||
using Unity.Burst;
|
using Unity.Burst;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Utilities.ViewNode
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfo("View Texture", "Utility/View Texture", false, null , editorType: typeof(ViewTextureNodeEditor), docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FViewImageNode")]
|
[NodeInfo("View Texture", "Utility/View Texture", false, null , editorType: typeof(ViewTextureNodeEditor), docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FViewImageNode")]
|
||||||
public partial class ViewTextureNode : BaseImageNode
|
public partial class ViewTextureNode : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("Texture")] public Texture2D texture;
|
[Core.Attributes.Input("Texture")] public Texture2D texture;
|
||||||
[NodeAttributes.Input("Image Data")] public ImageData imageData;
|
[Core.Attributes.Input("Image Data")] public ImageData imageData;
|
||||||
|
|
||||||
public delegate void OnImageUpdated();
|
public delegate void OnImageUpdated();
|
||||||
public OnImageUpdated onImageUpdated;
|
public OnImageUpdated onImageUpdated;
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
using AssetGraph.Core;
|
||||||
using UnityEditor.UIElements;
|
using UnityEditor.UIElements;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Utilities.ViewNode
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
public class ViewTextureNodeEditor : ImageProcessingGraphNodeVisual
|
public class ViewTextureNodeEditor : AssetGraphNodeEditor
|
||||||
{
|
{
|
||||||
private UnityEngine.UIElements.Image viewableImage;
|
private UnityEngine.UIElements.Image viewableImage;
|
||||||
private Foldout foldout;
|
private Foldout foldout;
|
||||||
private VisualElement buttonRow;
|
private VisualElement buttonRow;
|
||||||
|
|
||||||
public ViewTextureNodeEditor(BaseImageNode node, ImageProcessingGraphViewWindow window) : base(node, window)
|
public ViewTextureNodeEditor(AssetGraphNode node, AssetGraphViewWindow window) : base(node, window)
|
||||||
{
|
{
|
||||||
//Port 0 is Texture2D
|
//Port 0 is Texture2D
|
||||||
//Port 1 is ImageData
|
//Port 1 is ImageData
|
||||||
|
|
||||||
IPTPort tex2DPort = InputPorts[0] as IPTPort;
|
AssetGraphPort tex2DPort = InputPorts[0] as AssetGraphPort;
|
||||||
IPTPort imageDataPort = InputPorts[1] as IPTPort;
|
AssetGraphPort imageDataPort = InputPorts[1] as AssetGraphPort;
|
||||||
|
|
||||||
tex2DPort.OnPortConnected += () => { imageDataPort.style.display = DisplayStyle.None; };
|
tex2DPort.OnPortConnected += () => { imageDataPort.style.display = DisplayStyle.None; };
|
||||||
|
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Nodes;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using AssetGraph.Core;
|
||||||
|
using AssetGraph.Core.Attributes;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Variable_Node
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
public class VariableNodeBase : BaseImageNode
|
public class VariableNodeBase : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("Variable Name")] public string variableName;
|
[Core.Attributes.Input("Variable Name")] public string variableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VariableNode<T> : VariableNodeBase
|
public class VariableNode<T> : VariableNodeBase
|
||||||
{
|
{
|
||||||
public T input;
|
public T input;
|
||||||
[NodeAttributes.Output("Output")] public T output;
|
[Core.Attributes.Output("Output")] public T output;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.String_Nodes
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfo("String Append", "String/Append", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Append")]
|
[NodeInfo("String Append", "String/Append", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Append")]
|
||||||
public class StringAppend : BaseImageNode
|
public class StringAppend : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("String A")] public string baseString;
|
[Core.Attributes.Input("String A")] public string baseString;
|
||||||
[NodeAttributes.Input("String B")] public string appendString;
|
[Core.Attributes.Input("String B")] public string appendString;
|
||||||
|
|
||||||
[NodeAttributes.Output("Appended String")] public string output;
|
[Core.Attributes.Output("Appended String")] public string output;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
@ -18,13 +18,13 @@ namespace ImageProcessingGraph.Editor.Nodes.String_Nodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NodeInfo("String Replace", "String/Replace", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Replace")]
|
[NodeInfo("String Replace", "String/Replace", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Replace")]
|
||||||
public class StringReplace : BaseImageNode
|
public class StringReplace : AssetGraphNode
|
||||||
{
|
{
|
||||||
[NodeAttributes.Input("Original String")] public string original;
|
[Core.Attributes.Input("Original String")] public string original;
|
||||||
[NodeAttributes.Input("Old Value")] public string oldValue;
|
[Core.Attributes.Input("Old Value")] public string oldValue;
|
||||||
[NodeAttributes.Input("New Value")] public string newValue;
|
[Core.Attributes.Input("New Value")] public string newValue;
|
||||||
|
|
||||||
[NodeAttributes.Output("Replaced String")] public string output;
|
[Core.Attributes.Output("Replaced String")] public string output;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
@ -36,13 +36,13 @@ namespace ImageProcessingGraph.Editor.Nodes.String_Nodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NodeInfo("String Split", "String/Split", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Split")]
|
[NodeInfo("String Split", "String/Split", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Split")]
|
||||||
public class StringSplit : BaseImageNode
|
public class StringSplit : AssetGraphNode
|
||||||
{
|
{
|
||||||
[Input("Source String")] public string source;
|
[Input("Source String")] public string source;
|
||||||
[Input("Delimiter")] public string delimiter;
|
[Input("Delimiter")] public string delimiter;
|
||||||
|
|
||||||
[NodeAttributes.Output("Before Delimiter")] public string before;
|
[Core.Attributes.Output("Before Delimiter")] public string before;
|
||||||
[NodeAttributes.Output("After Delimiter")] public string after;
|
[Core.Attributes.Output("After Delimiter")] public string after;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
@ -1,19 +1,19 @@
|
|||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core;
|
||||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
using AssetGraph.Core.Attributes;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector
|
namespace AssetGraph.Nodes
|
||||||
{
|
{
|
||||||
[NodeInfo("", "Utility/Connection", false, null , editorType: typeof(GenericConnectionEditor), docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FUtils%2FGenericConnection")]
|
[NodeInfo("", "Utility/Connection", false, null , editorType: typeof(GenericConnectionEditor), docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FUtils%2FGenericConnection")]
|
||||||
public class GenericConnection : BaseImageNode
|
public class GenericConnection : AssetGraphNode
|
||||||
{
|
{
|
||||||
private System.Type internalType;
|
private System.Type internalType;
|
||||||
public System.Type InternalType { get { return internalType; } set { internalType = value; } }
|
public System.Type InternalType { get { return internalType; } set { internalType = value; } }
|
||||||
|
|
||||||
[NodeAttributes.Input(" ")] public object input;
|
[Core.Attributes.Input(" ")] public object input;
|
||||||
[NodeAttributes.Output(" ")] public object output;
|
[Core.Attributes.Output(" ")] public object output;
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
@ -21,9 +21,9 @@ namespace ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GenericConnectionEditor : ImageProcessingGraphNodeVisual
|
public class GenericConnectionEditor : AssetGraphNodeEditor
|
||||||
{
|
{
|
||||||
public GenericConnectionEditor(BaseImageNode node, ImageProcessingGraphViewWindow window) : base(node, window)
|
public GenericConnectionEditor(AssetGraphNode node, AssetGraphViewWindow window) : base(node, window)
|
||||||
{
|
{
|
||||||
this.Q("title").style.display = DisplayStyle.None;
|
this.Q("title").style.display = DisplayStyle.None;
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Windows
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
[CustomEditor(typeof(ImageProcessingGraphAsset))]
|
[CustomEditor(typeof(AssetGraphData))]
|
||||||
public class ImageProcessingGraphAssetEditorWindow : UnityEditor.Editor
|
public class AssetGraphDataEditor : UnityEditor.Editor
|
||||||
{
|
{
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("Open"))
|
if (GUILayout.Button("Open"))
|
||||||
{
|
{
|
||||||
ImageProcessingGraphEditorWindow.Open((ImageProcessingGraphAsset)target);
|
AssetGraphEditorWindow.Open((AssetGraphData)target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GUILayout.Button("Calculate Dependancy Graph"))
|
if(GUILayout.Button("Calculate Dependancy Graph"))
|
||||||
{
|
{
|
||||||
var bleh = (ImageProcessingGraphAsset)target;
|
var bleh = (AssetGraphData)target;
|
||||||
bleh.runOrder = bleh.GetExecutionOrder(bleh.Nodes, bleh.Connections, true);
|
bleh.runOrder = bleh.GetExecutionOrder(bleh.Nodes, bleh.Connections, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GUILayout.Button("Run Graph"))
|
if(GUILayout.Button("Run Graph"))
|
||||||
{
|
{
|
||||||
var bleh = (ImageProcessingGraphAsset)target;
|
var bleh = (AssetGraphData)target;
|
||||||
bleh.RunGraph();
|
bleh.RunGraph();
|
||||||
}
|
}
|
||||||
|
|
@ -1,21 +1,22 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using ImageProcessingGraph.Editor;
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEditor.MemoryProfiler;
|
using UnityEditor.MemoryProfiler;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
|
|
||||||
public class ImageProcessingGraphEdgeConnectorListener : IEdgeConnectorListener
|
public class AssetGraphEdgeConnector : IEdgeConnectorListener
|
||||||
{
|
{
|
||||||
private GraphViewChange m_GraphViewChange;
|
private GraphViewChange m_GraphViewChange;
|
||||||
private List<Edge> m_EdgesToCreate;
|
private List<Edge> m_EdgesToCreate;
|
||||||
private List<GraphElement> m_EdgesToDelete;
|
private List<GraphElement> m_EdgesToDelete;
|
||||||
|
|
||||||
private ImageProcessingGraphViewWindow window;
|
private AssetGraphViewWindow window;
|
||||||
|
|
||||||
public ImageProcessingGraphEdgeConnectorListener(ImageProcessingGraphViewWindow window)
|
public AssetGraphEdgeConnector(AssetGraphViewWindow window)
|
||||||
{
|
{
|
||||||
this.m_EdgesToCreate = new List<Edge>();
|
this.m_EdgesToCreate = new List<Edge>();
|
||||||
this.m_EdgesToDelete = new List<GraphElement>();
|
this.m_EdgesToDelete = new List<GraphElement>();
|
||||||
@ -31,8 +32,8 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
window.ChangeCoordinatesTo(window, window.cachedMousePos - window.Window.position.position);
|
window.ChangeCoordinatesTo(window, window.cachedMousePos - window.Window.position.position);
|
||||||
var graphMousePosition = window.contentViewContainer.WorldToLocal(mousePos);
|
var graphMousePosition = window.contentViewContainer.WorldToLocal(mousePos);
|
||||||
|
|
||||||
var searchProviderInstance = ScriptableObject.CreateInstance<ImageProcessingGraphSearchProvider.CustomSearchProviderForEdge>();
|
var searchProviderInstance = ScriptableObject.CreateInstance<AssetGraphSearchProvider.CustomSearchProviderForEdge>();
|
||||||
searchProviderInstance.Init(window.searchProvider, edge, (IPTPort)edge.input, (IPTPort)edge.output);
|
searchProviderInstance.Init(window.searchProvider, edge, (AssetGraphPort)edge.input, (AssetGraphPort)edge.output);
|
||||||
|
|
||||||
SearchWindow.Open(
|
SearchWindow.Open(
|
||||||
new SearchWindowContext(GUIUtility.GUIToScreenPoint(Event.current.mousePosition)),
|
new SearchWindowContext(GUIUtility.GUIToScreenPoint(Event.current.mousePosition)),
|
||||||
@ -53,7 +54,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
if (edge.input != null)
|
if (edge.input != null)
|
||||||
if (edge.input.node != null)
|
if (edge.input.node != null)
|
||||||
((ImageProcessingGraphNodeVisual)edge.input.node).ToggleExposedVariable((IPTPort)edge.input, true);
|
((AssetGraphNodeEditor)edge.input.node).ToggleExposedVariable((AssetGraphPort)edge.input, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +76,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
window.asset.Connections.Remove(VARIABLE);
|
window.asset.Connections.Remove(VARIABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
((ImageProcessingGraphNodeVisual)edge.input.node).ToggleExposedVariable((IPTPort)edge.input, true);
|
((AssetGraphNodeEditor)edge.input.node).ToggleExposedVariable((AssetGraphPort)edge.input, true);
|
||||||
|
|
||||||
|
|
||||||
this.m_EdgesToCreate.Clear();
|
this.m_EdgesToCreate.Clear();
|
@ -3,18 +3,18 @@ using UnityEditor;
|
|||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Windows
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
public class ImageProcessingGraphEditorWindow : EditorWindow
|
public class AssetGraphEditorWindow : EditorWindow
|
||||||
{
|
{
|
||||||
[SerializeField] private ImageProcessingGraphAsset currentGraph;
|
[SerializeField] private AssetGraphData currentGraph;
|
||||||
[SerializeField] private SerializedObject serializedObject;
|
[SerializeField] private SerializedObject serializedObject;
|
||||||
[SerializeField] private ImageProcessingGraphViewWindow currentView;
|
[SerializeField] private AssetGraphViewWindow currentView;
|
||||||
public ImageProcessingGraphAsset CurrentGraph => currentGraph;
|
public AssetGraphData CurrentGraph => currentGraph;
|
||||||
|
|
||||||
public static void Open(ImageProcessingGraphAsset asset)
|
public static void Open(AssetGraphData asset)
|
||||||
{
|
{
|
||||||
var existingWindows = Resources.FindObjectsOfTypeAll<ImageProcessingGraphEditorWindow>();
|
var existingWindows = Resources.FindObjectsOfTypeAll<AssetGraphEditorWindow>();
|
||||||
foreach (var w in existingWindows)
|
foreach (var w in existingWindows)
|
||||||
{
|
{
|
||||||
if (w.CurrentGraph == asset)
|
if (w.CurrentGraph == asset)
|
||||||
@ -24,9 +24,9 @@ namespace ImageProcessingGraph.Editor.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var window = CreateWindow<ImageProcessingGraphEditorWindow>(typeof(SceneView));
|
var window = CreateWindow<AssetGraphEditorWindow>(typeof(SceneView));
|
||||||
window.titleContent = new GUIContent($"{asset.name}",
|
window.titleContent = new GUIContent($"{asset.name}",
|
||||||
EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image);
|
EditorGUIUtility.ObjectContent(null, typeof(AssetGraphData)).image);
|
||||||
window.Load(asset);
|
window.Load(asset);
|
||||||
window.Focus();
|
window.Focus();
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ namespace ImageProcessingGraph.Editor.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load(ImageProcessingGraphAsset asset)
|
public void Load(AssetGraphData asset)
|
||||||
{
|
{
|
||||||
currentGraph = asset;
|
currentGraph = asset;
|
||||||
DrawGraph();
|
DrawGraph();
|
||||||
@ -59,7 +59,7 @@ namespace ImageProcessingGraph.Editor.Windows
|
|||||||
public void DrawGraph()
|
public void DrawGraph()
|
||||||
{
|
{
|
||||||
serializedObject = new SerializedObject(currentGraph);
|
serializedObject = new SerializedObject(currentGraph);
|
||||||
currentView = new ImageProcessingGraphViewWindow(serializedObject, this);
|
currentView = new AssetGraphViewWindow(serializedObject, this);
|
||||||
currentView.graphViewChanged += OnChange;
|
currentView.graphViewChanged += OnChange;
|
||||||
rootVisualElement.Add(currentView);
|
rootVisualElement.Add(currentView);
|
||||||
}
|
}
|
@ -2,32 +2,33 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Core.GraphElements;
|
||||||
|
using AssetGraph.Nodes;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEditor.UIElements;
|
using UnityEditor.UIElements;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
using Input = ImageProcessingGraph.Editor.Nodes.NodeAttributes.Input;
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
public class ImageProcessingGraphNodeVisual : Node
|
public class AssetGraphNodeEditor : Node
|
||||||
{
|
{
|
||||||
private BaseImageNode graphNode;
|
private AssetGraphNode graphNode;
|
||||||
public BaseImageNode GraphNode => graphNode;
|
public AssetGraphNode GraphNode => graphNode;
|
||||||
|
|
||||||
public List<Port> AllPorts = new List<Port>();
|
public List<Port> AllPorts = new List<Port>();
|
||||||
public List<Port> InputPorts { get; }
|
public List<Port> InputPorts { get; }
|
||||||
public List<Port> OutputPorts { get; }
|
public List<Port> OutputPorts { get; }
|
||||||
|
|
||||||
public ImageProcessingGraphViewWindow window;
|
public AssetGraphViewWindow window;
|
||||||
|
|
||||||
private StyleSheet defaaStyleSheet;
|
private StyleSheet defaaStyleSheet;
|
||||||
private StyleSheet errorStyleSheet;
|
private StyleSheet errorStyleSheet;
|
||||||
private NodeInfoAttribute info;
|
private NodeInfoAttribute info;
|
||||||
|
|
||||||
public ImageProcessingGraphNodeVisual(BaseImageNode node, ImageProcessingGraphViewWindow window)
|
public AssetGraphNodeEditor(AssetGraphNode node, AssetGraphViewWindow window)
|
||||||
{
|
{
|
||||||
this.AddToClassList("image-node-visual");
|
this.AddToClassList("image-node-visual");
|
||||||
this.window = window;
|
this.window = window;
|
||||||
@ -49,16 +50,16 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
this.InputPorts = new List<Port>();
|
this.InputPorts = new List<Port>();
|
||||||
this.OutputPorts = new List<Port>();
|
this.OutputPorts = new List<Port>();
|
||||||
|
|
||||||
List<Input> inputs = new List<Input>();
|
List<AssetGraph.Core.Attributes.Input> inputs = new List<AssetGraph.Core.Attributes.Input>();
|
||||||
List<FieldInfo> inputFieldInfo = new List<FieldInfo>();
|
List<FieldInfo> inputFieldInfo = new List<FieldInfo>();
|
||||||
List<FieldInfo> outputFieldInfo = new List<FieldInfo>();
|
List<FieldInfo> outputFieldInfo = new List<FieldInfo>();
|
||||||
|
|
||||||
FieldInfo[] fields = typeInfo.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
FieldInfo[] fields = typeInfo.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
{
|
{
|
||||||
if (field.GetCustomAttribute(typeof(Input)) != null)
|
if (field.GetCustomAttribute(typeof(AssetGraph.Core.Attributes.Input)) != null)
|
||||||
{
|
{
|
||||||
Input input = field.GetCustomAttribute<Input>();
|
AssetGraph.Core.Attributes.Input input = field.GetCustomAttribute<AssetGraph.Core.Attributes.Input>();
|
||||||
inputs.Add(input);
|
inputs.Add(input);
|
||||||
inputFieldInfo.Add(field);
|
inputFieldInfo.Add(field);
|
||||||
}
|
}
|
||||||
@ -104,9 +105,9 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
for (var index = 0; index < fields.Count; index++)
|
for (var index = 0; index < fields.Count; index++)
|
||||||
{
|
{
|
||||||
var field = fields[index];
|
var field = fields[index];
|
||||||
var port = IPTPort.Create(window.edgeConnectorListener, true, field.FieldType);
|
var port = AssetGraphPort.Create(window.edgeConnectorListener, true, field.FieldType);
|
||||||
|
|
||||||
string label = field.GetCustomAttribute<Input>().Label;
|
string label = field.GetCustomAttribute<Core.Attributes.Input>().Label;
|
||||||
if (label != "")
|
if (label != "")
|
||||||
port.portName = label;
|
port.portName = label;
|
||||||
InputPorts.Add(port);
|
InputPorts.Add(port);
|
||||||
@ -125,7 +126,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
for (var index = 0; index < fields.Count; index++)
|
for (var index = 0; index < fields.Count; index++)
|
||||||
{
|
{
|
||||||
var field = fields[index];
|
var field = fields[index];
|
||||||
var port = IPTPort.Create(window.edgeConnectorListener, false, field.FieldType);
|
var port = AssetGraphPort.Create(window.edgeConnectorListener, false, field.FieldType);
|
||||||
|
|
||||||
string label = field.GetCustomAttribute<Output>().Label;
|
string label = field.GetCustomAttribute<Output>().Label;
|
||||||
if (label != "")
|
if (label != "")
|
||||||
@ -142,7 +143,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
public void ExposeVariableToPort(Port port, FieldInfo field)
|
public void ExposeVariableToPort(Port port, FieldInfo field)
|
||||||
{
|
{
|
||||||
VisualElement NewElement = new VisualElement();
|
VisualElement NewElement = new VisualElement();
|
||||||
var ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer;
|
var ExposedPropertyContainer = ((AssetGraphPort)port).ExposedPropertyContainer;
|
||||||
Type containerType = null;
|
Type containerType = null;
|
||||||
|
|
||||||
if (ExposedPropertyContainer == null)
|
if (ExposedPropertyContainer == null)
|
||||||
@ -154,8 +155,8 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
containerType = the.GetType();
|
containerType = the.GetType();
|
||||||
|
|
||||||
NewElement.Add(the);
|
NewElement.Add(the);
|
||||||
((IPTPort)port).ExposedPropertyContainer = the;
|
((AssetGraphPort)port).ExposedPropertyContainer = the;
|
||||||
ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer;
|
ExposedPropertyContainer = ((AssetGraphPort)port).ExposedPropertyContainer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -249,9 +250,9 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
public void ToggleExposedVariable(Port port, bool value)
|
public void ToggleExposedVariable(Port port, bool value)
|
||||||
{
|
{
|
||||||
IPTPort iptPort = port as IPTPort;
|
AssetGraphPort assetGraphPort = port as AssetGraphPort;
|
||||||
if(iptPort.ExposedPropertyContainer != null)
|
if(assetGraphPort.ExposedPropertyContainer != null)
|
||||||
iptPort.ExposedPropertyContainer.style.display = value ? DisplayStyle.Flex : DisplayStyle.None;
|
assetGraphPort.ExposedPropertyContainer.style.display = value ? DisplayStyle.Flex : DisplayStyle.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VisualElement CreatePropertyFieldForType(Type type, object value)
|
private VisualElement CreatePropertyFieldForType(Type type, object value)
|
@ -2,14 +2,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
|
using AssetGraph.Nodes;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
using Input = ImageProcessingGraph.Editor.Nodes.NodeAttributes.Input;
|
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
public struct SearchContextElement
|
public struct SearchContextElement
|
||||||
{
|
{
|
||||||
@ -31,9 +31,9 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ImageProcessingGraphSearchProvider : ScriptableObject, ISearchWindowProvider
|
public class AssetGraphSearchProvider : ScriptableObject, ISearchWindowProvider
|
||||||
{
|
{
|
||||||
public ImageProcessingGraphViewWindow graph;
|
public AssetGraphViewWindow graph;
|
||||||
public VisualElement target;
|
public VisualElement target;
|
||||||
|
|
||||||
public static List<SearchContextElement> elements;
|
public static List<SearchContextElement> elements;
|
||||||
@ -59,7 +59,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
foreach (var field in Fields)
|
foreach (var field in Fields)
|
||||||
{
|
{
|
||||||
if (field.GetCustomAttribute<Input>() != null)
|
if (field.GetCustomAttribute<Core.Attributes.Input>() != null)
|
||||||
ImportPortTypes.Add(ImportPortTypes.Count, field.FieldType);
|
ImportPortTypes.Add(ImportPortTypes.Count, field.FieldType);
|
||||||
if (field.GetCustomAttribute<Output>() != null)
|
if (field.GetCustomAttribute<Output>() != null)
|
||||||
OutputPortTypes.Add(OutputPortTypes.Count, field.FieldType);
|
OutputPortTypes.Add(OutputPortTypes.Count, field.FieldType);
|
||||||
@ -127,7 +127,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
SearchContextElement element = (SearchContextElement)SearchTreeEntry.userData;
|
SearchContextElement element = (SearchContextElement)SearchTreeEntry.userData;
|
||||||
|
|
||||||
BaseImageNode node = (BaseImageNode)element.target;
|
AssetGraphNode node = (AssetGraphNode)element.target;
|
||||||
node.SetPosition(new Rect(graphMousePosition, new Vector2()));
|
node.SetPosition(new Rect(graphMousePosition, new Vector2()));
|
||||||
graph.Add(node);
|
graph.Add(node);
|
||||||
node.asset = graph.asset;
|
node.asset = graph.asset;
|
||||||
@ -145,7 +145,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
var sourcePort = edge.output ?? edge.input;
|
var sourcePort = edge.output ?? edge.input;
|
||||||
bool isSourceOutput = edge.output != null;
|
bool isSourceOutput = edge.output != null;
|
||||||
Type targetType = (sourcePort as IPTPort)?.portType;
|
Type targetType = (sourcePort as AssetGraphPort)?.portType;
|
||||||
|
|
||||||
if (targetType == null)
|
if (targetType == null)
|
||||||
{
|
{
|
||||||
@ -162,7 +162,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
var fields = type.GetFields();
|
var fields = type.GetFields();
|
||||||
|
|
||||||
// Get all ports
|
// Get all ports
|
||||||
var inputPorts = fields.Where(f => f.GetCustomAttribute<Input>() != null).ToList();
|
var inputPorts = fields.Where(f => f.GetCustomAttribute<Core.Attributes.Input>() != null).ToList();
|
||||||
var outputPorts = fields.Where(f => f.GetCustomAttribute<Output>() != null).ToList();
|
var outputPorts = fields.Where(f => f.GetCustomAttribute<Output>() != null).ToList();
|
||||||
|
|
||||||
// REVERSED LOGIC:
|
// REVERSED LOGIC:
|
||||||
@ -205,7 +205,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
// Add compatible port entries
|
// Add compatible port entries
|
||||||
foreach (var portField in compatiblePorts)
|
foreach (var portField in compatiblePorts)
|
||||||
{
|
{
|
||||||
var portList = portField.GetCustomAttribute<Input>() != null ? inputPorts : outputPorts;
|
var portList = portField.GetCustomAttribute<Core.Attributes.Input>() != null ? inputPorts : outputPorts;
|
||||||
int portIndex = portList.IndexOf(portField);
|
int portIndex = portList.IndexOf(portField);
|
||||||
|
|
||||||
var portTitle = $"{attr.Title}: {portField.Name}";
|
var portTitle = $"{attr.Title}: {portField.Name}";
|
||||||
@ -227,12 +227,12 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
public class CustomSearchProviderForEdge : ScriptableObject, ISearchWindowProvider
|
public class CustomSearchProviderForEdge : ScriptableObject, ISearchWindowProvider
|
||||||
{
|
{
|
||||||
private ImageProcessingGraphSearchProvider original;
|
private AssetGraphSearchProvider original;
|
||||||
private Edge edge;
|
private Edge edge;
|
||||||
private IPTPort inputPort;
|
private AssetGraphPort inputPort;
|
||||||
private IPTPort outputPort;
|
private AssetGraphPort outputPort;
|
||||||
|
|
||||||
public CustomSearchProviderForEdge(ImageProcessingGraphSearchProvider original, Edge edge, IPTPort inputPort, IPTPort outputPort)
|
public CustomSearchProviderForEdge(AssetGraphSearchProvider original, Edge edge, AssetGraphPort inputPort, AssetGraphPort outputPort)
|
||||||
{
|
{
|
||||||
this.original = original;
|
this.original = original;
|
||||||
this.edge = edge;
|
this.edge = edge;
|
||||||
@ -240,8 +240,8 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
this.outputPort = outputPort;
|
this.outputPort = outputPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(ImageProcessingGraphSearchProvider original, Edge edge, IPTPort inputPort,
|
public void Init(AssetGraphSearchProvider original, Edge edge, AssetGraphPort inputPort,
|
||||||
IPTPort outputPort)
|
AssetGraphPort outputPort)
|
||||||
{
|
{
|
||||||
this.original = original;
|
this.original = original;
|
||||||
this.edge = edge;
|
this.edge = edge;
|
||||||
@ -262,7 +262,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
|||||||
|
|
||||||
SearchContextElement element = (SearchContextElement)selectedEntry.userData;
|
SearchContextElement element = (SearchContextElement)selectedEntry.userData;
|
||||||
|
|
||||||
BaseImageNode node = (BaseImageNode)element.target;
|
AssetGraphNode node = (AssetGraphNode)element.target;
|
||||||
node.SetPosition(new Rect(graphMousePosition, new Vector2()));
|
node.SetPosition(new Rect(graphMousePosition, new Vector2()));
|
||||||
original.graph.Add(node);
|
original.graph.Add(node);
|
||||||
node.asset = original.graph.asset;
|
node.asset = original.graph.asset;
|
@ -2,31 +2,31 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
using AssetGraph.Core.Attributes;
|
||||||
using ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector;
|
using AssetGraph.Core.GraphElements;
|
||||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
using AssetGraph.Nodes;
|
||||||
using ImageProcessingGraph.Editor.Windows;
|
using ImageProcessingGraph.Editor;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Experimental.GraphView;
|
using UnityEditor.Experimental.GraphView;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace ImageProcessingGraph.Editor
|
namespace AssetGraph.Core
|
||||||
{
|
{
|
||||||
public class ImageProcessingGraphViewWindow : GraphView
|
public class AssetGraphViewWindow : GraphView
|
||||||
{
|
{
|
||||||
internal ImageProcessingGraphAsset asset;
|
internal AssetGraphData asset;
|
||||||
private SerializedObject serializedObject;
|
private SerializedObject serializedObject;
|
||||||
private ImageProcessingGraphEditorWindow window;
|
private AssetGraphEditorWindow window;
|
||||||
public ImageProcessingGraphEditorWindow Window => window;
|
public AssetGraphEditorWindow Window => window;
|
||||||
|
|
||||||
public List<ImageProcessingGraphNodeVisual> graphNodes;
|
public List<AssetGraphNodeEditor> graphNodes;
|
||||||
public Dictionary<string, ImageProcessingGraphNodeVisual> nodeDictionary;
|
public Dictionary<string, AssetGraphNodeEditor> nodeDictionary;
|
||||||
public Dictionary<Edge, GraphConnection> connectionDictionary;
|
public Dictionary<Edge, GraphConnection> connectionDictionary;
|
||||||
public Dictionary<string, IPT_StickyNote> stickyNoteDictionary;
|
public Dictionary<string, AssetGraphStickyNote> stickyNoteDictionary;
|
||||||
|
|
||||||
internal ImageProcessingGraphSearchProvider searchProvider;
|
internal AssetGraphSearchProvider searchProvider;
|
||||||
public ImageProcessingGraphEdgeConnectorListener edgeConnectorListener;
|
public AssetGraphEdgeConnector edgeConnectorListener;
|
||||||
|
|
||||||
private bool isDropdownEnabled = false;
|
private bool isDropdownEnabled = false;
|
||||||
public Vector2 cachedMousePos;
|
public Vector2 cachedMousePos;
|
||||||
@ -36,20 +36,20 @@ namespace ImageProcessingGraph.Editor
|
|||||||
private Button outputRunOrder;
|
private Button outputRunOrder;
|
||||||
private Button makeStickyNode;
|
private Button makeStickyNode;
|
||||||
|
|
||||||
public ImageProcessingGraphViewWindow(SerializedObject obeject, ImageProcessingGraphEditorWindow window)
|
public AssetGraphViewWindow(SerializedObject obeject, AssetGraphEditorWindow window)
|
||||||
{
|
{
|
||||||
this.serializedObject = obeject;
|
this.serializedObject = obeject;
|
||||||
this.asset = obeject.targetObject as ImageProcessingGraphAsset;
|
this.asset = obeject.targetObject as AssetGraphData;
|
||||||
|
|
||||||
this.graphNodes = new List<ImageProcessingGraphNodeVisual>();
|
this.graphNodes = new List<AssetGraphNodeEditor>();
|
||||||
nodeDictionary = new Dictionary<string, ImageProcessingGraphNodeVisual>();
|
nodeDictionary = new Dictionary<string, AssetGraphNodeEditor>();
|
||||||
stickyNoteDictionary = new Dictionary<string, IPT_StickyNote>();
|
stickyNoteDictionary = new Dictionary<string, AssetGraphStickyNote>();
|
||||||
connectionDictionary = new Dictionary<Edge, GraphConnection>();
|
connectionDictionary = new Dictionary<Edge, GraphConnection>();
|
||||||
|
|
||||||
searchProvider = ScriptableObject.CreateInstance<ImageProcessingGraphSearchProvider>();
|
searchProvider = ScriptableObject.CreateInstance<AssetGraphSearchProvider>();
|
||||||
searchProvider.graph = this;
|
searchProvider.graph = this;
|
||||||
|
|
||||||
edgeConnectorListener = new ImageProcessingGraphEdgeConnectorListener(this);
|
edgeConnectorListener = new AssetGraphEdgeConnector(this);
|
||||||
|
|
||||||
this.nodeCreationRequest = ShowSearchWindow;
|
this.nodeCreationRequest = ShowSearchWindow;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
makeStickyNode.clicked += () =>
|
makeStickyNode.clicked += () =>
|
||||||
{
|
{
|
||||||
var noteData = new IPT_StickyNoteData("");
|
var noteData = new AssetGraphStickyNoteData("");
|
||||||
asset.stickyNotes.Add(noteData);
|
asset.stickyNotes.Add(noteData);
|
||||||
this.DrawStickyNote(noteData);
|
this.DrawStickyNote(noteData);
|
||||||
};
|
};
|
||||||
@ -223,9 +223,9 @@ namespace ImageProcessingGraph.Editor
|
|||||||
Add(dropdownButton);
|
Add(dropdownButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImageProcessingGraphNodeVisual GetNode(string NodeID)
|
private AssetGraphNodeEditor GetNode(string NodeID)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphNodeVisual node = null;
|
AssetGraphNodeEditor node = null;
|
||||||
nodeDictionary.TryGetValue(NodeID, out node);
|
nodeDictionary.TryGetValue(NodeID, out node);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -294,9 +294,9 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
private Type GetPortEffectiveType(Port port)
|
private Type GetPortEffectiveType(Port port)
|
||||||
{
|
{
|
||||||
if (port is IPTPort iptPort)
|
if (port is AssetGraphPort iptPort)
|
||||||
{
|
{
|
||||||
if (iptPort.node is ImageProcessingGraphNodeVisual vis &&
|
if (iptPort.node is AssetGraphNodeEditor vis &&
|
||||||
vis.GraphNode is GenericConnection conn &&
|
vis.GraphNode is GenericConnection conn &&
|
||||||
conn.InternalType != null)
|
conn.InternalType != null)
|
||||||
{
|
{
|
||||||
@ -316,12 +316,12 @@ namespace ImageProcessingGraph.Editor
|
|||||||
if (graphviewchange.movedElements != null)
|
if (graphviewchange.movedElements != null)
|
||||||
{
|
{
|
||||||
Undo.RecordObject(serializedObject.targetObject, "Moved Graph Elements");
|
Undo.RecordObject(serializedObject.targetObject, "Moved Graph Elements");
|
||||||
foreach (var VARIABLE in graphviewchange.movedElements.OfType<ImageProcessingGraphNodeVisual>())
|
foreach (var VARIABLE in graphviewchange.movedElements.OfType<AssetGraphNodeEditor>())
|
||||||
{
|
{
|
||||||
VARIABLE.SavePosition();
|
VARIABLE.SavePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var VARIABLE in graphviewchange.movedElements.OfType<IPT_StickyNote>())
|
foreach (var VARIABLE in graphviewchange.movedElements.OfType<AssetGraphStickyNote>())
|
||||||
{
|
{
|
||||||
VARIABLE.SavePosition();
|
VARIABLE.SavePosition();
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
if (graphviewchange.elementsToRemove != null)
|
if (graphviewchange.elementsToRemove != null)
|
||||||
{
|
{
|
||||||
List<ImageProcessingGraphNodeVisual> nodesToRemove = graphviewchange.elementsToRemove.OfType<ImageProcessingGraphNodeVisual>().ToList();
|
List<AssetGraphNodeEditor> nodesToRemove = graphviewchange.elementsToRemove.OfType<AssetGraphNodeEditor>().ToList();
|
||||||
List<Edge> edges = graphviewchange.elementsToRemove.OfType<Edge>().ToList();
|
List<Edge> edges = graphviewchange.elementsToRemove.OfType<Edge>().ToList();
|
||||||
|
|
||||||
if (nodesToRemove.Count > 0)
|
if (nodesToRemove.Count > 0)
|
||||||
@ -376,8 +376,8 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
public void CreateEdge(Edge edge)
|
public void CreateEdge(Edge edge)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphNodeVisual outputNode = (ImageProcessingGraphNodeVisual)edge.output.node;
|
AssetGraphNodeEditor outputNode = (AssetGraphNodeEditor)edge.output.node;
|
||||||
ImageProcessingGraphNodeVisual inputNode = (ImageProcessingGraphNodeVisual)edge.input.node;
|
AssetGraphNodeEditor inputNode = (AssetGraphNodeEditor)edge.input.node;
|
||||||
|
|
||||||
|
|
||||||
int outputIndex = outputNode.OutputPorts.IndexOf(edge.output);
|
int outputIndex = outputNode.OutputPorts.IndexOf(edge.output);
|
||||||
@ -391,8 +391,8 @@ namespace ImageProcessingGraph.Editor
|
|||||||
edge.output.Connect(edge);
|
edge.output.Connect(edge);
|
||||||
edge.input.Connect(edge);
|
edge.input.Connect(edge);
|
||||||
|
|
||||||
IPTPort portIn = (IPTPort)edge.output;
|
AssetGraphPort portIn = (AssetGraphPort)edge.output;
|
||||||
IPTPort portOut = (IPTPort)edge.output;
|
AssetGraphPort portOut = (AssetGraphPort)edge.output;
|
||||||
|
|
||||||
if (portIn.fieldInfo != null)
|
if (portIn.fieldInfo != null)
|
||||||
inputNode.ToggleExposedVariable(edge.input, false);
|
inputNode.ToggleExposedVariable(edge.input, false);
|
||||||
@ -411,9 +411,9 @@ namespace ImageProcessingGraph.Editor
|
|||||||
edge.output.Disconnect(edge);
|
edge.output.Disconnect(edge);
|
||||||
edge.input.Disconnect(edge);
|
edge.input.Disconnect(edge);
|
||||||
|
|
||||||
ImageProcessingGraphNodeVisual inputNode = (ImageProcessingGraphNodeVisual)edge.input.node;
|
AssetGraphNodeEditor inputNode = (AssetGraphNodeEditor)edge.input.node;
|
||||||
|
|
||||||
IPTPort portIn = (IPTPort)edge.input;
|
AssetGraphPort portIn = (AssetGraphPort)edge.input;
|
||||||
|
|
||||||
if(portIn.fieldInfo != null)
|
if(portIn.fieldInfo != null)
|
||||||
inputNode.ToggleExposedVariable(edge.input, true);
|
inputNode.ToggleExposedVariable(edge.input, true);
|
||||||
@ -432,20 +432,20 @@ namespace ImageProcessingGraph.Editor
|
|||||||
{
|
{
|
||||||
foreach (GraphConnection conn in asset.Connections)
|
foreach (GraphConnection conn in asset.Connections)
|
||||||
{
|
{
|
||||||
ImageProcessingGraphNodeVisual inputNode = GetNode(conn.inputPort.nodeID);
|
AssetGraphNodeEditor inputNode = GetNode(conn.inputPort.nodeID);
|
||||||
ImageProcessingGraphNodeVisual outputNode = GetNode(conn.outputPort.nodeID);
|
AssetGraphNodeEditor outputNode = GetNode(conn.outputPort.nodeID);
|
||||||
|
|
||||||
if (inputNode != null && outputNode != null)
|
if (inputNode != null && outputNode != null)
|
||||||
{
|
{
|
||||||
IPTPort inPort = inputNode.InputPorts[conn.inputPort.portID] as IPTPort;
|
AssetGraphPort inPort = inputNode.InputPorts[conn.inputPort.portID] as AssetGraphPort;
|
||||||
IPTPort outPort = outputNode.OutputPorts[conn.outputPort.portID] as IPTPort;
|
AssetGraphPort outPort = outputNode.OutputPorts[conn.outputPort.portID] as AssetGraphPort;
|
||||||
|
|
||||||
Edge edge = inPort.ConnectTo(outPort);
|
Edge edge = inPort.ConnectTo(outPort);
|
||||||
AddElement(edge);
|
AddElement(edge);
|
||||||
connectionDictionary.Add(edge, conn);
|
connectionDictionary.Add(edge, conn);
|
||||||
conn.SetInternalEdge(edge);
|
conn.SetInternalEdge(edge);
|
||||||
|
|
||||||
((ImageProcessingGraphNodeVisual)inPort.node).ToggleExposedVariable(inPort, false);
|
((AssetGraphNodeEditor)inPort.node).ToggleExposedVariable(inPort, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -496,13 +496,13 @@ namespace ImageProcessingGraph.Editor
|
|||||||
#region Nodes
|
#region Nodes
|
||||||
private void DrawNodes()
|
private void DrawNodes()
|
||||||
{
|
{
|
||||||
foreach (ImageProcessingGraphNodeVisual node in graphNodes)
|
foreach (AssetGraphNodeEditor node in graphNodes)
|
||||||
{
|
{
|
||||||
RemoveElement(node);
|
RemoveElement(node);
|
||||||
}
|
}
|
||||||
graphNodes.Clear();
|
graphNodes.Clear();
|
||||||
|
|
||||||
foreach (KeyValuePair<string, ImageProcessingGraphNodeVisual> node in nodeDictionary)
|
foreach (KeyValuePair<string, AssetGraphNodeEditor> node in nodeDictionary)
|
||||||
{
|
{
|
||||||
RemoveElement(node.Value);
|
RemoveElement(node.Value);
|
||||||
}
|
}
|
||||||
@ -514,20 +514,20 @@ namespace ImageProcessingGraph.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddNodeToGraph(BaseImageNode node)
|
private void AddNodeToGraph(AssetGraphNode node)
|
||||||
{
|
{
|
||||||
node.typeName = node.GetType().AssemblyQualifiedName;
|
node.typeName = node.GetType().AssemblyQualifiedName;
|
||||||
|
|
||||||
var infoAttr = node.GetType().GetCustomAttribute<NodeInfoAttribute>();
|
var infoAttr = node.GetType().GetCustomAttribute<NodeInfoAttribute>();
|
||||||
|
|
||||||
ImageProcessingGraphNodeVisual editorNode = null;
|
AssetGraphNodeEditor editorNode = null;
|
||||||
if (typeof(ImageProcessingGraphNodeVisual).IsAssignableFrom(infoAttr.EditorType))
|
if (typeof(AssetGraphNodeEditor).IsAssignableFrom(infoAttr.EditorType))
|
||||||
{
|
{
|
||||||
editorNode = (ImageProcessingGraphNodeVisual)Activator.CreateInstance(infoAttr.EditorType, node, this);
|
editorNode = (AssetGraphNodeEditor)Activator.CreateInstance(infoAttr.EditorType, node, this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
editorNode = new ImageProcessingGraphNodeVisual(node, this);
|
editorNode = new AssetGraphNodeEditor(node, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
editorNode.SetPosition(node.Position);
|
editorNode.SetPosition(node.Position);
|
||||||
@ -539,7 +539,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
AddElement(editorNode);
|
AddElement(editorNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(BaseImageNode node)
|
public void Add(AssetGraphNode node)
|
||||||
{
|
{
|
||||||
Undo.RecordObject(serializedObject.targetObject, "Added Node");
|
Undo.RecordObject(serializedObject.targetObject, "Added Node");
|
||||||
asset.Nodes.Add(node);
|
asset.Nodes.Add(node);
|
||||||
@ -550,7 +550,7 @@ namespace ImageProcessingGraph.Editor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveNode(ImageProcessingGraphNodeVisual variable)
|
private void RemoveNode(AssetGraphNodeEditor variable)
|
||||||
{
|
{
|
||||||
List<GraphConnection> connectionsToRemove = new List<GraphConnection>();
|
List<GraphConnection> connectionsToRemove = new List<GraphConnection>();
|
||||||
|
|
||||||
@ -594,9 +594,9 @@ namespace ImageProcessingGraph.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPT_StickyNote DrawStickyNote(IPT_StickyNoteData stickyNote)
|
public AssetGraphStickyNote DrawStickyNote(AssetGraphStickyNoteData stickyNote)
|
||||||
{
|
{
|
||||||
IPT_StickyNote stickyNoteVisual = new IPT_StickyNote(stickyNote, this);
|
AssetGraphStickyNote stickyNoteVisual = new AssetGraphStickyNote(stickyNote, this);
|
||||||
|
|
||||||
stickyNoteVisual.SetPosition(stickyNote.Position);
|
stickyNoteVisual.SetPosition(stickyNote.Position);
|
||||||
stickyNoteVisual.style.width = stickyNote.Size.x;
|
stickyNoteVisual.style.width = stickyNote.Size.x;
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 024feeef7368f444696e947391b79685
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,21 +0,0 @@
|
|||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UIElements;
|
|
||||||
|
|
||||||
public class ImageProcessingGraphDocumentationWindow : EditorWindow
|
|
||||||
{
|
|
||||||
[SerializeField]
|
|
||||||
// private VisualTreeAsset m_VisualTreeAsset = default;
|
|
||||||
|
|
||||||
[MenuItem("Window/UI Toolkit/ImageProcessingGraphDocumentationWindow")]
|
|
||||||
public static void ShowExample()
|
|
||||||
{
|
|
||||||
ImageProcessingGraphDocumentationWindow wnd = GetWindow<ImageProcessingGraphDocumentationWindow>();
|
|
||||||
wnd.titleContent = new GUIContent("IPT Documentation");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateGUI()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 819da168f89268440b928bc0eb32e67e
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences:
|
|
||||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: 880795e34c2278d49b48c227716214de, type: 3}
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,5 +0,0 @@
|
|||||||
.custom-label {
|
|
||||||
font-size: 20px;
|
|
||||||
-unity-font-style: bold;
|
|
||||||
color: rgb(68, 138, 255);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a3d894085df56784383eca98ee7c9077
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
disableValidation: 0
|
|
@ -1,3 +0,0 @@
|
|||||||
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
|
||||||
<Style src="project://database/Assets/Unity%20Image%20Processing/Editor/Scripts/Editor/Windows/Documentation/ImageProcessingGraphDocumentationWindow.uss?fileID=7433441132597879392&guid=a3d894085df56784383eca98ee7c9077&type=3#ImageProcessingGraphDocumentationWindow" />
|
|
||||||
</engine:UXML>
|
|
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 880795e34c2278d49b48c227716214de
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 701fddc3e03215a47a5e29169f936f05
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,150 +0,0 @@
|
|||||||
using UnityEditor;
|
|
||||||
using UnityEditor.PackageManager.UI;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UIElements;
|
|
||||||
|
|
||||||
public class GettingStartedWindow : EditorWindow
|
|
||||||
{
|
|
||||||
private static Vector2 WindowSize = new Vector2(400, 600);
|
|
||||||
|
|
||||||
|
|
||||||
[MenuItem("Image Graph/Getting Started")]
|
|
||||||
public static void ShowExample()
|
|
||||||
{
|
|
||||||
GettingStartedWindow wnd = GetWindow<GettingStartedWindow>();
|
|
||||||
wnd.titleContent = new GUIContent("Getting Started Window");
|
|
||||||
wnd.minSize = WindowSize;
|
|
||||||
wnd.maxSize = WindowSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateGUI()
|
|
||||||
{
|
|
||||||
Foldout foldoutCreateGraph = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutCreateGraph.name = "CreateGraph";
|
|
||||||
foldoutCreateGraph.text = "Creating a Graph";
|
|
||||||
AddBulletLabel(foldoutCreateGraph, "CreateGraphLabel", "Right click in project view");
|
|
||||||
AddBulletLabel(foldoutCreateGraph, "PathLabel", "Create->Image Processing Graph->New Graph");
|
|
||||||
AddBulletLabel(foldoutCreateGraph, "NameAsset", "Name Asset as Desired");
|
|
||||||
}
|
|
||||||
foldoutCreateGraph.value = false;
|
|
||||||
rootVisualElement.Add(foldoutCreateGraph);
|
|
||||||
|
|
||||||
Foldout foldoutOpenGraph = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutOpenGraph.name = "OpenGraph";
|
|
||||||
foldoutOpenGraph.text = "Opening a Graph";
|
|
||||||
AddBulletLabel(foldoutOpenGraph, "DoubleClick", "Double click newly created asset or pre-existing asset");
|
|
||||||
AddBulletLabel(foldoutOpenGraph, "Inspector", "With a graph asset selected click the \"Open\" button");
|
|
||||||
}
|
|
||||||
foldoutOpenGraph.value = false;
|
|
||||||
rootVisualElement.Add(foldoutOpenGraph);
|
|
||||||
|
|
||||||
Foldout foldoutUsingTheGraph = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutUsingTheGraph.name = "Using the Graph";
|
|
||||||
foldoutUsingTheGraph.text = "Using the Graph";
|
|
||||||
|
|
||||||
Foldout foldoutCreatingNodes = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutCreatingNodes.name = "Creating Nodes";
|
|
||||||
foldoutCreatingNodes.text = "Creating Nodes";
|
|
||||||
|
|
||||||
AddBulletLabel(foldoutCreatingNodes, "HowToOpenSearch", "To open the node creation window press the \"Space\" button or Right Click -> Create Node");
|
|
||||||
AddBulletLabel(foldoutCreatingNodes, "Search Window", "With the Search window now open find the node you wish to create and press the \"Enter\" key; Or double left click");
|
|
||||||
AddBulletLabel(foldoutCreatingNodes, "Arrow Keys", "The search window can also be controlled with the arrow keys!");
|
|
||||||
}
|
|
||||||
foldoutCreatingNodes.value = false;
|
|
||||||
foldoutUsingTheGraph.Add(foldoutCreatingNodes);
|
|
||||||
|
|
||||||
Foldout foldoutDeletingNodes = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutDeletingNodes.name = "Deleting Nodes";
|
|
||||||
foldoutDeletingNodes.text = "Deleting Nodes";
|
|
||||||
|
|
||||||
AddBulletLabel(foldoutDeletingNodes, "Deleting Nodes", "To delete a node, you can click the \"Delete\" Key or Right Click -> Delete Node");
|
|
||||||
}
|
|
||||||
foldoutDeletingNodes.value = false;
|
|
||||||
foldoutUsingTheGraph.Add(foldoutDeletingNodes);
|
|
||||||
|
|
||||||
Foldout foldoutConnectingNodes = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutConnectingNodes.name = "Connecting Nodes";
|
|
||||||
foldoutConnectingNodes.text = "Connecting Nodes";
|
|
||||||
|
|
||||||
AddBulletLabel(foldoutConnectingNodes, "ConnectingNodes", "To connect two nodes you click and drag from one port to the other (Ports must be of same type)");
|
|
||||||
AddBulletLabel(foldoutConnectingNodes, "ConnectingNodesTooltip", "Hovering over a port will show its type", 1);
|
|
||||||
AddBulletLabel(foldoutConnectingNodes, "DroppingConnection", "Dropping a connection in empty space will open a contextual search window");
|
|
||||||
AddBulletLabel(foldoutConnectingNodes, "DroppingConnection1", "This window will only show nodes that are able to input/output to the port you dragged from.", 1);
|
|
||||||
}
|
|
||||||
foldoutConnectingNodes.value = false;
|
|
||||||
foldoutUsingTheGraph.Add(foldoutConnectingNodes);
|
|
||||||
|
|
||||||
Foldout foldoutDeletingConnections = new Foldout();
|
|
||||||
{
|
|
||||||
foldoutDeletingNodes.name = "Deleting Nodes";
|
|
||||||
foldoutDeletingNodes.text = "Deleting Nodes";
|
|
||||||
|
|
||||||
AddBulletLabel(foldoutDeletingNodes, "Deleting Nodes", "To delete a node, you can click the \"Delete\" Key or Right Click -> Delete Node");
|
|
||||||
}
|
|
||||||
foldoutDeletingNodes.value = false;
|
|
||||||
foldoutUsingTheGraph.Add(foldoutDeletingNodes);
|
|
||||||
}
|
|
||||||
foldoutUsingTheGraph.value = false;
|
|
||||||
rootVisualElement.Add(foldoutUsingTheGraph);
|
|
||||||
|
|
||||||
Label bottomLabel = new Label("For more details, check the Quick Start Guide:");
|
|
||||||
bottomLabel.style.marginTop = 20;
|
|
||||||
bottomLabel.style.unityFontStyleAndWeight = FontStyle.Bold;
|
|
||||||
rootVisualElement.Add(bottomLabel);
|
|
||||||
|
|
||||||
Label hyperlink = new Label("Quick Start Guide")
|
|
||||||
{
|
|
||||||
style =
|
|
||||||
{
|
|
||||||
color = Color.blue,
|
|
||||||
unityFontStyleAndWeight = FontStyle.Italic
|
|
||||||
}
|
|
||||||
};
|
|
||||||
hyperlink.RegisterCallback<ClickEvent>(ev => OpenQuickStartLink());
|
|
||||||
rootVisualElement.Add(hyperlink);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddBulletLabel(VisualElement container, string labelName, string labelText, int indentCount = 0)
|
|
||||||
{
|
|
||||||
var row = new VisualElement();
|
|
||||||
row.style.flexDirection = FlexDirection.Row;
|
|
||||||
row.style.marginBottom = 2;
|
|
||||||
row.style.marginLeft = indentCount * 16;
|
|
||||||
|
|
||||||
var bullet = new Label("•")
|
|
||||||
{
|
|
||||||
style =
|
|
||||||
{
|
|
||||||
width = 12,
|
|
||||||
unityFontStyleAndWeight = FontStyle.Bold,
|
|
||||||
marginRight = 4
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var labels = new Label(labelText)
|
|
||||||
{
|
|
||||||
name = labelName,
|
|
||||||
style =
|
|
||||||
{
|
|
||||||
unityFontStyleAndWeight = FontStyle.Normal,
|
|
||||||
whiteSpace = WhiteSpace.Normal,
|
|
||||||
flexGrow = 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
row.Add(bullet);
|
|
||||||
row.Add(labels);
|
|
||||||
container.Add(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenQuickStartLink()
|
|
||||||
{
|
|
||||||
Application.OpenURL("https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Guides/QuickStart");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: bdebc01d70ee90b46be92aff1599d2bd
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences:
|
|
||||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: 9566e7fc6d4ac8848bdc7762e84f3d3d, type: 3}
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,5 +0,0 @@
|
|||||||
.custom-label {
|
|
||||||
font-size: 20px;
|
|
||||||
-unity-font-style: bold;
|
|
||||||
color: rgb(68, 138, 255);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 966fc07be508c4244ba4c927e36a753a
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
disableValidation: 0
|
|
@ -1,5 +0,0 @@
|
|||||||
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
|
||||||
<Style src="project://database/Assets/Unity%20Image%20Processing/Editor/Scripts/Editor/Windows/Getting%20Started/GettingStartedWindow.uss?fileID=7433441132597879392&guid=966fc07be508c4244ba4c927e36a753a&type=3#GettingStartedWindow" />
|
|
||||||
<engine:Label text="Oogooooga :( " />
|
|
||||||
<engine:RadioButton label="Radio Button" />
|
|
||||||
</engine:UXML>
|
|
@ -1,10 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 9566e7fc6d4ac8848bdc7762e84f3d3d
|
|
||||||
ScriptedImporter:
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
|
Loading…
x
Reference in New Issue
Block a user