CumBuckets
This commit is contained in:
parent
1b941d6531
commit
687c52df62
@ -1,50 +1,51 @@
|
||||
using ImageProcessingGraph.Editor.Windows;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
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 Debug = UnityEngine.Debug;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace ImageProcessingGraph.Editor
|
||||
namespace AssetGraph.Core
|
||||
{
|
||||
[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;
|
||||
[SerializeReference] public List<BaseImageNode> runOrder;
|
||||
[SerializeField] public List<IPT_StickyNoteData> stickyNotes;
|
||||
[SerializeField] public List<AssetGraphNode> runOrder;
|
||||
[SerializeField] public List<AssetGraphStickyNoteData> stickyNotes;
|
||||
|
||||
public List<BaseImageNode> Nodes => nodes;
|
||||
public List<AssetGraphNode> Nodes => nodes;
|
||||
public List<GraphConnection> Connections => connections;
|
||||
|
||||
public delegate void OnRunEvent();
|
||||
public event OnRunEvent OnRun;
|
||||
public OnRunEvent OnRunEnd;
|
||||
|
||||
public ImageProcessingGraphAsset()
|
||||
public AssetGraphData()
|
||||
{
|
||||
nodes = new List<BaseImageNode>();
|
||||
nodes = new List<AssetGraphNode>();
|
||||
connections = new List<GraphConnection>();
|
||||
stickyNotes = new List<IPT_StickyNoteData>();
|
||||
stickyNotes = new List<AssetGraphStickyNoteData>();
|
||||
}
|
||||
|
||||
|
||||
[OnOpenAsset(1)]
|
||||
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)
|
||||
{
|
||||
ImageProcessingGraphEditorWindow.Open(asset);
|
||||
return true;
|
||||
AssetGraphEditorWindow.Open(asset);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RunGraph()
|
||||
@ -79,9 +80,9 @@ namespace ImageProcessingGraph.Editor
|
||||
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)
|
||||
{
|
||||
@ -100,18 +101,11 @@ namespace ImageProcessingGraph.Editor
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <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)
|
||||
|
||||
public List<AssetGraphNode> GetExecutionOrder(List<AssetGraphNode> nodes, List<GraphConnection> connections, bool debug = false)
|
||||
{
|
||||
// === 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 inDegree = new Dictionary<string, int>(nodes.Count);
|
||||
|
||||
@ -148,7 +142,7 @@ namespace ImageProcessingGraph.Editor
|
||||
}
|
||||
|
||||
// === 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);
|
||||
|
||||
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 ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
||||
|
||||
namespace ImageProcessingGraph.Editor.Nodes.NodeAttributes
|
||||
namespace AssetGraph.Core.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
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 UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A structure that holds image pixel data and its dimensions.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct ImageData
|
||||
|
||||
namespace AssetGraph.Core.DataTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// The pixel data of the image in Color32 format.
|
||||
/// </summary>
|
||||
public NativeArray<Color32> PixelData;
|
||||
[Serializable]
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
public struct ImageData
|
||||
{
|
||||
PixelData = imageData;
|
||||
Dimensions = widthHeight;
|
||||
isRGBA = isRgba;
|
||||
}
|
||||
public NativeArray<Color32> PixelData;
|
||||
public (int width, int height) Dimensions;
|
||||
public bool isRGBA;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
public ImageData(NativeArray<Color32> imageData, (int width, int height) widthHeight, bool isRgba)
|
||||
{
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
namespace AssetGraph.Core.DataTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// 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)
|
||||
public struct SplitChannelData
|
||||
{
|
||||
ChannelData = channelData;
|
||||
Dimensions = widthHeight;
|
||||
public byte[] ChannelData;
|
||||
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.UIElements;
|
||||
|
||||
namespace ImageProcessingGraph.Editor
|
||||
namespace AssetGraph.Core.GraphElements
|
||||
{
|
||||
[System.Serializable]
|
||||
public class IPT_StickyNoteData
|
||||
public class AssetGraphStickyNoteData
|
||||
{
|
||||
[SerializeField] private string guid;
|
||||
[SerializeField] private string title;
|
||||
@ -23,7 +23,7 @@ namespace ImageProcessingGraph.Editor
|
||||
public Rect Position { get => position; set => position = value; }
|
||||
public Vector2 Size { get => size; set => size = value; }
|
||||
|
||||
public IPT_StickyNoteData(string title)
|
||||
public AssetGraphStickyNoteData(string title)
|
||||
{
|
||||
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;
|
||||
public IPT_StickyNoteData Data => data;
|
||||
private AssetGraphStickyNoteData 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.window = window;
|
@ -6,7 +6,7 @@ using UnityEditor.UIElements;
|
||||
#endif
|
||||
|
||||
|
||||
namespace ImageProcessingGraph.Editor
|
||||
namespace AssetGraph.Core.GraphElements
|
||||
{
|
||||
[Serializable]
|
||||
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 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.Linq;
|
||||
using System.Reflection;
|
||||
using ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector;
|
||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
||||
using AssetGraph.Nodes;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace ImageProcessingGraph.Editor
|
||||
namespace AssetGraph.Core
|
||||
{
|
||||
public class IPTPort : Port
|
||||
public class AssetGraphPort : Port
|
||||
{
|
||||
public FieldInfo fieldInfo;
|
||||
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()}";
|
||||
}
|
||||
|
||||
public override void Connect(Edge edge)
|
||||
{
|
||||
ImageProcessingGraphNodeVisual IPTVis = this.node as ImageProcessingGraphNodeVisual;
|
||||
|
||||
IPTPort extenalPort = null;
|
||||
|
||||
if (IPTVis.GraphNode is GenericConnection bleh)
|
||||
if (this.node is AssetGraphNodeEditor IPTVis && IPTVis.GraphNode is GenericConnection)
|
||||
{
|
||||
foreach (var port in IPTVis.AllPorts)
|
||||
{
|
||||
@ -57,15 +52,15 @@ namespace ImageProcessingGraph.Editor
|
||||
|
||||
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;
|
||||
|
||||
foreach (var port in IPTVis.AllPorts)
|
||||
{
|
||||
if (port.connections != null && port.connections.Count() > 0)
|
||||
if (port.connections != null && port.connections.Any())
|
||||
{
|
||||
allPortsDisconnected = false;
|
||||
break;
|
||||
@ -94,9 +89,9 @@ namespace ImageProcessingGraph.Editor
|
||||
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)
|
||||
{
|
||||
m_EdgeConnector = new EdgeConnector<Edge>(connectorListener),
|
@ -2,16 +2,18 @@ using System;
|
||||
using System.Configuration;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using System.Collections.Generic;
|
||||
using Input = ImageProcessingGraph.Editor.Nodes.NodeAttributes.Input;
|
||||
using System.Linq;
|
||||
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]
|
||||
public abstract class BaseImageNode
|
||||
public abstract class AssetGraphNode
|
||||
{
|
||||
[SerializeField] private string guid;
|
||||
|
||||
@ -24,12 +26,12 @@ namespace ImageProcessingGraph.Editor
|
||||
public string ID => guid;
|
||||
public Rect Position => position;
|
||||
|
||||
public ImageProcessingGraphAsset asset;
|
||||
public AssetGraphData asset;
|
||||
|
||||
public delegate void OnFailed();
|
||||
public event OnFailed onFailed;
|
||||
|
||||
public BaseImageNode()
|
||||
public AssetGraphNode()
|
||||
{
|
||||
guid = Guid.NewGuid().ToString();
|
||||
}
|
||||
@ -48,7 +50,7 @@ namespace ImageProcessingGraph.Editor
|
||||
// Find the connection that leads to this input property
|
||||
GraphConnection connection = default;
|
||||
|
||||
foreach (var conn in asset.Connections)
|
||||
foreach (GraphConnection conn in asset.Connections)
|
||||
{
|
||||
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.Collections;
|
||||
using Unity.Jobs;
|
||||
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")]
|
||||
public class ChannelInvertNode : BaseImageNode
|
||||
[NodeInfo("Invert Channel", "Adjustments/InvertChannel", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvertChannel")]
|
||||
public class ChannelInvertNode : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("Input Channel")]
|
||||
[Core.Attributes.Input("Input Channel")]
|
||||
public SplitChannelData inputChannel;
|
||||
|
||||
[NodeAttributes.Output("Output Channel")]
|
||||
[Core.Attributes.Output("Output Channel")]
|
||||
public SplitChannelData outputChannel;
|
||||
|
||||
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.Collections;
|
||||
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")]
|
||||
public class Texture2DDesaturate : BaseImageNode
|
||||
[NodeInfo("Desaturate", "Adjustments/Desaturate", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FDesaturate")]
|
||||
public class Texture2DDesaturate : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("")]
|
||||
[Core.Attributes.Input("")]
|
||||
public ImageData inputTexture;
|
||||
|
||||
[NodeAttributes.Output("")]
|
||||
[Core.Attributes.Output("")]
|
||||
public ImageData outputTexture;
|
||||
|
||||
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.Collections;
|
||||
using Unity.Jobs;
|
||||
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")]
|
||||
public class Texture2DInvert : BaseImageNode
|
||||
[NodeInfo("Invert", "Adjustments/Invert", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvert")]
|
||||
public class Texture2DInvert : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("")]
|
||||
[Core.Attributes.Input("")]
|
||||
public ImageData inputTexture;
|
||||
|
||||
[NodeAttributes.Output("")]
|
||||
[Core.Attributes.Output("")]
|
||||
public ImageData outputTexture;
|
||||
|
||||
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.Collections;
|
||||
using Unity.Jobs;
|
||||
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")]
|
||||
public class RGBASCombine : BaseImageNode
|
||||
public class RGBASCombine : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("R")]
|
||||
[Core.Attributes.Input("R")]
|
||||
public SplitChannelData r;
|
||||
|
||||
[NodeAttributes.Input("G")]
|
||||
[Core.Attributes.Input("G")]
|
||||
public SplitChannelData g;
|
||||
|
||||
[NodeAttributes.Input("B")]
|
||||
[Core.Attributes.Input("B")]
|
||||
public SplitChannelData b;
|
||||
|
||||
[NodeAttributes.Input("A")]
|
||||
[Core.Attributes.Input("A")]
|
||||
public SplitChannelData a;
|
||||
|
||||
[NodeAttributes.Output("")]
|
||||
[Core.Attributes.Output("")]
|
||||
public ImageData inputTexture;
|
||||
|
||||
// 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.Collections;
|
||||
using Unity.Jobs;
|
||||
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")]
|
||||
public class RGBASplit : BaseImageNode
|
||||
[NodeInfo("RGBA Split", "Channels/RGBA Split", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBASplit")]
|
||||
public class RGBASplit : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("")]
|
||||
[Core.Attributes.Input("")]
|
||||
public ImageData inputTexture;
|
||||
|
||||
[NodeAttributes.Output("R")]
|
||||
[Core.Attributes.Output("R")]
|
||||
public SplitChannelData r;
|
||||
[NodeAttributes.Output("G")]
|
||||
[Core.Attributes.Output("G")]
|
||||
public SplitChannelData g;
|
||||
[NodeAttributes.Output("B")]
|
||||
[Core.Attributes.Output("B")]
|
||||
public SplitChannelData b;
|
||||
[NodeAttributes.Output("A")]
|
||||
[Core.Attributes.Output("A")]
|
||||
public SplitChannelData a;
|
||||
|
||||
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.Collections;
|
||||
using Unity.Jobs;
|
||||
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")]
|
||||
public class TextureGetDimensions : BaseImageNode
|
||||
[NodeInfo("Get Dimensions", "Dimensions/Get Dimensions", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FGetDimensions")]
|
||||
public class TextureGetDimensions : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("")]
|
||||
[Core.Attributes.Input("")]
|
||||
public ImageData inputTexture;
|
||||
|
||||
[NodeAttributes.Output("Width")]
|
||||
[Core.Attributes.Output("Width")]
|
||||
public int width;
|
||||
|
||||
[NodeAttributes.Output("Height")]
|
||||
[Core.Attributes.Output("Height")]
|
||||
public int height;
|
||||
|
||||
public override void Process()
|
||||
|
@ -1,17 +1,18 @@
|
||||
using System.ComponentModel.Composition.Primitives;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using AssetGraph.Core.DataTypes;
|
||||
using Unity.Collections;
|
||||
using UnityEditor;
|
||||
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")]
|
||||
public class Texture2DOutput : BaseImageNode
|
||||
public class Texture2DOutput : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("")] public ImageData inputPixels;
|
||||
[NodeAttributes.Input("File Name")] public string fileName;
|
||||
[NodeAttributes.Input("File Directory")] public string fileDirectory;
|
||||
[Core.Attributes.Input("")] public ImageData inputPixels;
|
||||
[Core.Attributes.Input("File Name")] public string fileName;
|
||||
[Core.Attributes.Input("File Directory")] public string fileDirectory;
|
||||
|
||||
public enum ExportType
|
||||
{
|
||||
@ -19,10 +20,10 @@ namespace ImageProcessingGraph.Editor.Nodes.Output
|
||||
PNG
|
||||
}
|
||||
|
||||
[NodeAttributes.Input("Export Type")] public ExportType exportType;
|
||||
[NodeAttributes.Input("Texture Type")] public TextureImporterType textureType;
|
||||
[Core.Attributes.Input("Export Type")] public ExportType exportType;
|
||||
[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()
|
||||
{
|
||||
|
@ -1,15 +1,15 @@
|
||||
using System.IO;
|
||||
using System.Security.Policy;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using UnityEditor;
|
||||
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;
|
||||
[NodeAttributes.Output("Output")] public T output;
|
||||
[Core.Attributes.Input("Path")] public string path;
|
||||
[Core.Attributes.Output("Output")] public T output;
|
||||
|
||||
public override void Process()
|
||||
{
|
||||
|
@ -1,22 +1,23 @@
|
||||
using System.IO;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using AssetGraph.Core.DataTypes;
|
||||
using Unity.Collections;
|
||||
using UnityEditor;
|
||||
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")]
|
||||
public class Texture2DImport : BaseImageNode
|
||||
public class Texture2DImport : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("")]
|
||||
[Core.Attributes.Input("")]
|
||||
public Texture2D textureImport;
|
||||
|
||||
[NodeAttributes.Output("")]
|
||||
[Core.Attributes.Output("")]
|
||||
public ImageData textureOutput;
|
||||
[NodeAttributes.Output("File Name")]
|
||||
[Core.Attributes.Output("File Name")]
|
||||
public string fileName;
|
||||
[NodeAttributes.Output("File Directory")]
|
||||
[Core.Attributes.Output("File Directory")]
|
||||
public string filePath;
|
||||
|
||||
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.Collections;
|
||||
using Unity.Jobs;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Utilities
|
||||
namespace AssetGraph.Nodes
|
||||
{
|
||||
public class SingleChannelColor
|
||||
{
|
||||
[NodeInfoAttribute("Channel Color", "Utility/Channel Color", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FSingleChannelColor")]
|
||||
public class SingleColorChannel : BaseImageNode
|
||||
[NodeInfo("Channel Color", "Utility/Channel Color", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FSingleChannelColor")]
|
||||
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()
|
||||
{
|
||||
|
@ -1,16 +1,17 @@
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using AssetGraph.Core.DataTypes;
|
||||
using UnityEngine;
|
||||
using Unity.Collections;
|
||||
using Unity.Jobs;
|
||||
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")]
|
||||
public partial class ViewTextureNode : BaseImageNode
|
||||
public partial class ViewTextureNode : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("Texture")] public Texture2D texture;
|
||||
[NodeAttributes.Input("Image Data")] public ImageData imageData;
|
||||
[Core.Attributes.Input("Texture")] public Texture2D texture;
|
||||
[Core.Attributes.Input("Image Data")] public ImageData imageData;
|
||||
|
||||
public delegate void OnImageUpdated();
|
||||
public OnImageUpdated onImageUpdated;
|
||||
|
@ -1,23 +1,23 @@
|
||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
||||
using AssetGraph.Core;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
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 Foldout foldout;
|
||||
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 1 is ImageData
|
||||
|
||||
IPTPort tex2DPort = InputPorts[0] as IPTPort;
|
||||
IPTPort imageDataPort = InputPorts[1] as IPTPort;
|
||||
AssetGraphPort tex2DPort = InputPorts[0] as AssetGraphPort;
|
||||
AssetGraphPort imageDataPort = InputPorts[1] as AssetGraphPort;
|
||||
|
||||
tex2DPort.OnPortConnected += () => { imageDataPort.style.display = DisplayStyle.None; };
|
||||
|
||||
|
@ -1,17 +1,19 @@
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Nodes;
|
||||
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 T input;
|
||||
[NodeAttributes.Output("Output")] public T output;
|
||||
[Core.Attributes.Output("Output")] public T output;
|
||||
|
||||
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")]
|
||||
public class StringAppend : BaseImageNode
|
||||
public class StringAppend : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("String A")] public string baseString;
|
||||
[NodeAttributes.Input("String B")] public string appendString;
|
||||
[Core.Attributes.Input("String A")] public string baseString;
|
||||
[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()
|
||||
{
|
||||
@ -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")]
|
||||
public class StringReplace : BaseImageNode
|
||||
public class StringReplace : AssetGraphNode
|
||||
{
|
||||
[NodeAttributes.Input("Original String")] public string original;
|
||||
[NodeAttributes.Input("Old Value")] public string oldValue;
|
||||
[NodeAttributes.Input("New Value")] public string newValue;
|
||||
[Core.Attributes.Input("Original String")] public string original;
|
||||
[Core.Attributes.Input("Old Value")] public string oldValue;
|
||||
[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()
|
||||
{
|
||||
@ -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")]
|
||||
public class StringSplit : BaseImageNode
|
||||
public class StringSplit : AssetGraphNode
|
||||
{
|
||||
[Input("Source String")] public string source;
|
||||
[Input("Delimiter")] public string delimiter;
|
||||
|
||||
[NodeAttributes.Output("Before Delimiter")] public string before;
|
||||
[NodeAttributes.Output("After Delimiter")] public string after;
|
||||
[Core.Attributes.Output("Before Delimiter")] public string before;
|
||||
[Core.Attributes.Output("After Delimiter")] public string after;
|
||||
|
||||
public override void Process()
|
||||
{
|
@ -1,19 +1,19 @@
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
||||
using AssetGraph.Core;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
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")]
|
||||
public class GenericConnection : BaseImageNode
|
||||
public class GenericConnection : AssetGraphNode
|
||||
{
|
||||
private System.Type internalType;
|
||||
public System.Type InternalType { get { return internalType; } set { internalType = value; } }
|
||||
|
||||
[NodeAttributes.Input(" ")] public object input;
|
||||
[NodeAttributes.Output(" ")] public object output;
|
||||
[Core.Attributes.Input(" ")] public object input;
|
||||
[Core.Attributes.Output(" ")] public object output;
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ImageProcessingGraph.Editor.Windows
|
||||
namespace AssetGraph.Core
|
||||
{
|
||||
[CustomEditor(typeof(ImageProcessingGraphAsset))]
|
||||
public class ImageProcessingGraphAssetEditorWindow : UnityEditor.Editor
|
||||
[CustomEditor(typeof(AssetGraphData))]
|
||||
public class AssetGraphDataEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (GUILayout.Button("Open"))
|
||||
{
|
||||
ImageProcessingGraphEditorWindow.Open((ImageProcessingGraphAsset)target);
|
||||
AssetGraphEditorWindow.Open((AssetGraphData)target);
|
||||
}
|
||||
|
||||
if(GUILayout.Button("Calculate Dependancy Graph"))
|
||||
{
|
||||
var bleh = (ImageProcessingGraphAsset)target;
|
||||
var bleh = (AssetGraphData)target;
|
||||
bleh.runOrder = bleh.GetExecutionOrder(bleh.Nodes, bleh.Connections, true);
|
||||
}
|
||||
|
||||
if(GUILayout.Button("Run Graph"))
|
||||
{
|
||||
var bleh = (ImageProcessingGraphAsset)target;
|
||||
var bleh = (AssetGraphData)target;
|
||||
bleh.RunGraph();
|
||||
}
|
||||
|
@ -1,21 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using ImageProcessingGraph.Editor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEditor.MemoryProfiler;
|
||||
using UnityEngine;
|
||||
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 List<Edge> m_EdgesToCreate;
|
||||
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_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);
|
||||
var graphMousePosition = window.contentViewContainer.WorldToLocal(mousePos);
|
||||
|
||||
var searchProviderInstance = ScriptableObject.CreateInstance<ImageProcessingGraphSearchProvider.CustomSearchProviderForEdge>();
|
||||
searchProviderInstance.Init(window.searchProvider, edge, (IPTPort)edge.input, (IPTPort)edge.output);
|
||||
var searchProviderInstance = ScriptableObject.CreateInstance<AssetGraphSearchProvider.CustomSearchProviderForEdge>();
|
||||
searchProviderInstance.Init(window.searchProvider, edge, (AssetGraphPort)edge.input, (AssetGraphPort)edge.output);
|
||||
|
||||
SearchWindow.Open(
|
||||
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.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);
|
||||
}
|
||||
|
||||
((ImageProcessingGraphNodeVisual)edge.input.node).ToggleExposedVariable((IPTPort)edge.input, true);
|
||||
((AssetGraphNodeEditor)edge.input.node).ToggleExposedVariable((AssetGraphPort)edge.input, true);
|
||||
|
||||
|
||||
this.m_EdgesToCreate.Clear();
|
@ -3,18 +3,18 @@ using UnityEditor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
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 ImageProcessingGraphViewWindow currentView;
|
||||
public ImageProcessingGraphAsset CurrentGraph => currentGraph;
|
||||
[SerializeField] private AssetGraphViewWindow currentView;
|
||||
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)
|
||||
{
|
||||
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}",
|
||||
EditorGUIUtility.ObjectContent(null, typeof(ImageProcessingGraphAsset)).image);
|
||||
EditorGUIUtility.ObjectContent(null, typeof(AssetGraphData)).image);
|
||||
window.Load(asset);
|
||||
window.Focus();
|
||||
}
|
||||
@ -50,7 +50,7 @@ namespace ImageProcessingGraph.Editor.Windows
|
||||
}
|
||||
}
|
||||
|
||||
public void Load(ImageProcessingGraphAsset asset)
|
||||
public void Load(AssetGraphData asset)
|
||||
{
|
||||
currentGraph = asset;
|
||||
DrawGraph();
|
||||
@ -59,7 +59,7 @@ namespace ImageProcessingGraph.Editor.Windows
|
||||
public void DrawGraph()
|
||||
{
|
||||
serializedObject = new SerializedObject(currentGraph);
|
||||
currentView = new ImageProcessingGraphViewWindow(serializedObject, this);
|
||||
currentView = new AssetGraphViewWindow(serializedObject, this);
|
||||
currentView.graphViewChanged += OnChange;
|
||||
rootVisualElement.Add(currentView);
|
||||
}
|
@ -2,32 +2,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using AssetGraph.Core.GraphElements;
|
||||
using AssetGraph.Nodes;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
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;
|
||||
public BaseImageNode GraphNode => graphNode;
|
||||
private AssetGraphNode graphNode;
|
||||
public AssetGraphNode GraphNode => graphNode;
|
||||
|
||||
public List<Port> AllPorts = new List<Port>();
|
||||
public List<Port> InputPorts { get; }
|
||||
public List<Port> OutputPorts { get; }
|
||||
|
||||
public ImageProcessingGraphViewWindow window;
|
||||
public AssetGraphViewWindow window;
|
||||
|
||||
private StyleSheet defaaStyleSheet;
|
||||
private StyleSheet errorStyleSheet;
|
||||
private NodeInfoAttribute info;
|
||||
|
||||
public ImageProcessingGraphNodeVisual(BaseImageNode node, ImageProcessingGraphViewWindow window)
|
||||
public AssetGraphNodeEditor(AssetGraphNode node, AssetGraphViewWindow window)
|
||||
{
|
||||
this.AddToClassList("image-node-visual");
|
||||
this.window = window;
|
||||
@ -49,16 +50,16 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
this.InputPorts = 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> outputFieldInfo = new List<FieldInfo>();
|
||||
|
||||
FieldInfo[] fields = typeInfo.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
|
||||
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);
|
||||
inputFieldInfo.Add(field);
|
||||
}
|
||||
@ -104,9 +105,9 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
for (var index = 0; index < fields.Count; 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 != "")
|
||||
port.portName = label;
|
||||
InputPorts.Add(port);
|
||||
@ -125,7 +126,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
for (var index = 0; index < fields.Count; 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;
|
||||
if (label != "")
|
||||
@ -142,7 +143,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
public void ExposeVariableToPort(Port port, FieldInfo field)
|
||||
{
|
||||
VisualElement NewElement = new VisualElement();
|
||||
var ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer;
|
||||
var ExposedPropertyContainer = ((AssetGraphPort)port).ExposedPropertyContainer;
|
||||
Type containerType = null;
|
||||
|
||||
if (ExposedPropertyContainer == null)
|
||||
@ -154,8 +155,8 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
containerType = the.GetType();
|
||||
|
||||
NewElement.Add(the);
|
||||
((IPTPort)port).ExposedPropertyContainer = the;
|
||||
ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer;
|
||||
((AssetGraphPort)port).ExposedPropertyContainer = the;
|
||||
ExposedPropertyContainer = ((AssetGraphPort)port).ExposedPropertyContainer;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -249,9 +250,9 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
|
||||
public void ToggleExposedVariable(Port port, bool value)
|
||||
{
|
||||
IPTPort iptPort = port as IPTPort;
|
||||
if(iptPort.ExposedPropertyContainer != null)
|
||||
iptPort.ExposedPropertyContainer.style.display = value ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
AssetGraphPort assetGraphPort = port as AssetGraphPort;
|
||||
if(assetGraphPort.ExposedPropertyContainer != null)
|
||||
assetGraphPort.ExposedPropertyContainer.style.display = value ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
}
|
||||
|
||||
private VisualElement CreatePropertyFieldForType(Type type, object value)
|
@ -2,14 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using AssetGraph.Nodes;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
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
|
||||
{
|
||||
@ -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 static List<SearchContextElement> elements;
|
||||
@ -59,7 +59,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
|
||||
foreach (var field in Fields)
|
||||
{
|
||||
if (field.GetCustomAttribute<Input>() != null)
|
||||
if (field.GetCustomAttribute<Core.Attributes.Input>() != null)
|
||||
ImportPortTypes.Add(ImportPortTypes.Count, field.FieldType);
|
||||
if (field.GetCustomAttribute<Output>() != null)
|
||||
OutputPortTypes.Add(OutputPortTypes.Count, field.FieldType);
|
||||
@ -127,7 +127,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
|
||||
SearchContextElement element = (SearchContextElement)SearchTreeEntry.userData;
|
||||
|
||||
BaseImageNode node = (BaseImageNode)element.target;
|
||||
AssetGraphNode node = (AssetGraphNode)element.target;
|
||||
node.SetPosition(new Rect(graphMousePosition, new Vector2()));
|
||||
graph.Add(node);
|
||||
node.asset = graph.asset;
|
||||
@ -145,7 +145,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
|
||||
var sourcePort = edge.output ?? edge.input;
|
||||
bool isSourceOutput = edge.output != null;
|
||||
Type targetType = (sourcePort as IPTPort)?.portType;
|
||||
Type targetType = (sourcePort as AssetGraphPort)?.portType;
|
||||
|
||||
if (targetType == null)
|
||||
{
|
||||
@ -162,7 +162,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
var fields = type.GetFields();
|
||||
|
||||
// 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();
|
||||
|
||||
// REVERSED LOGIC:
|
||||
@ -205,7 +205,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
// Add compatible port entries
|
||||
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);
|
||||
|
||||
var portTitle = $"{attr.Title}: {portField.Name}";
|
||||
@ -227,12 +227,12 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
|
||||
public class CustomSearchProviderForEdge : ScriptableObject, ISearchWindowProvider
|
||||
{
|
||||
private ImageProcessingGraphSearchProvider original;
|
||||
private AssetGraphSearchProvider original;
|
||||
private Edge edge;
|
||||
private IPTPort inputPort;
|
||||
private IPTPort outputPort;
|
||||
private AssetGraphPort inputPort;
|
||||
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.edge = edge;
|
||||
@ -240,8 +240,8 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
this.outputPort = outputPort;
|
||||
}
|
||||
|
||||
public void Init(ImageProcessingGraphSearchProvider original, Edge edge, IPTPort inputPort,
|
||||
IPTPort outputPort)
|
||||
public void Init(AssetGraphSearchProvider original, Edge edge, AssetGraphPort inputPort,
|
||||
AssetGraphPort outputPort)
|
||||
{
|
||||
this.original = original;
|
||||
this.edge = edge;
|
||||
@ -262,7 +262,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
|
||||
|
||||
SearchContextElement element = (SearchContextElement)selectedEntry.userData;
|
||||
|
||||
BaseImageNode node = (BaseImageNode)element.target;
|
||||
AssetGraphNode node = (AssetGraphNode)element.target;
|
||||
node.SetPosition(new Rect(graphMousePosition, new Vector2()));
|
||||
original.graph.Add(node);
|
||||
node.asset = original.graph.asset;
|
@ -2,31 +2,31 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
|
||||
using ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector;
|
||||
using ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Windows;
|
||||
using ImageProcessingGraph.Editor.Windows;
|
||||
using AssetGraph.Core.Attributes;
|
||||
using AssetGraph.Core.GraphElements;
|
||||
using AssetGraph.Nodes;
|
||||
using ImageProcessingGraph.Editor;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
using UnityEngine;
|
||||
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 ImageProcessingGraphEditorWindow window;
|
||||
public ImageProcessingGraphEditorWindow Window => window;
|
||||
private AssetGraphEditorWindow window;
|
||||
public AssetGraphEditorWindow Window => window;
|
||||
|
||||
public List<ImageProcessingGraphNodeVisual> graphNodes;
|
||||
public Dictionary<string, ImageProcessingGraphNodeVisual> nodeDictionary;
|
||||
public List<AssetGraphNodeEditor> graphNodes;
|
||||
public Dictionary<string, AssetGraphNodeEditor> nodeDictionary;
|
||||
public Dictionary<Edge, GraphConnection> connectionDictionary;
|
||||
public Dictionary<string, IPT_StickyNote> stickyNoteDictionary;
|
||||
public Dictionary<string, AssetGraphStickyNote> stickyNoteDictionary;
|
||||
|
||||
internal ImageProcessingGraphSearchProvider searchProvider;
|
||||
public ImageProcessingGraphEdgeConnectorListener edgeConnectorListener;
|
||||
internal AssetGraphSearchProvider searchProvider;
|
||||
public AssetGraphEdgeConnector edgeConnectorListener;
|
||||
|
||||
private bool isDropdownEnabled = false;
|
||||
public Vector2 cachedMousePos;
|
||||
@ -36,20 +36,20 @@ namespace ImageProcessingGraph.Editor
|
||||
private Button outputRunOrder;
|
||||
private Button makeStickyNode;
|
||||
|
||||
public ImageProcessingGraphViewWindow(SerializedObject obeject, ImageProcessingGraphEditorWindow window)
|
||||
public AssetGraphViewWindow(SerializedObject obeject, AssetGraphEditorWindow window)
|
||||
{
|
||||
this.serializedObject = obeject;
|
||||
this.asset = obeject.targetObject as ImageProcessingGraphAsset;
|
||||
this.asset = obeject.targetObject as AssetGraphData;
|
||||
|
||||
this.graphNodes = new List<ImageProcessingGraphNodeVisual>();
|
||||
nodeDictionary = new Dictionary<string, ImageProcessingGraphNodeVisual>();
|
||||
stickyNoteDictionary = new Dictionary<string, IPT_StickyNote>();
|
||||
this.graphNodes = new List<AssetGraphNodeEditor>();
|
||||
nodeDictionary = new Dictionary<string, AssetGraphNodeEditor>();
|
||||
stickyNoteDictionary = new Dictionary<string, AssetGraphStickyNote>();
|
||||
connectionDictionary = new Dictionary<Edge, GraphConnection>();
|
||||
|
||||
searchProvider = ScriptableObject.CreateInstance<ImageProcessingGraphSearchProvider>();
|
||||
searchProvider = ScriptableObject.CreateInstance<AssetGraphSearchProvider>();
|
||||
searchProvider.graph = this;
|
||||
|
||||
edgeConnectorListener = new ImageProcessingGraphEdgeConnectorListener(this);
|
||||
edgeConnectorListener = new AssetGraphEdgeConnector(this);
|
||||
|
||||
this.nodeCreationRequest = ShowSearchWindow;
|
||||
|
||||
@ -178,7 +178,7 @@ namespace ImageProcessingGraph.Editor
|
||||
|
||||
makeStickyNode.clicked += () =>
|
||||
{
|
||||
var noteData = new IPT_StickyNoteData("");
|
||||
var noteData = new AssetGraphStickyNoteData("");
|
||||
asset.stickyNotes.Add(noteData);
|
||||
this.DrawStickyNote(noteData);
|
||||
};
|
||||
@ -223,9 +223,9 @@ namespace ImageProcessingGraph.Editor
|
||||
Add(dropdownButton);
|
||||
}
|
||||
|
||||
private ImageProcessingGraphNodeVisual GetNode(string NodeID)
|
||||
private AssetGraphNodeEditor GetNode(string NodeID)
|
||||
{
|
||||
ImageProcessingGraphNodeVisual node = null;
|
||||
AssetGraphNodeEditor node = null;
|
||||
nodeDictionary.TryGetValue(NodeID, out node);
|
||||
return node;
|
||||
}
|
||||
@ -294,9 +294,9 @@ namespace ImageProcessingGraph.Editor
|
||||
|
||||
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 &&
|
||||
conn.InternalType != null)
|
||||
{
|
||||
@ -316,12 +316,12 @@ namespace ImageProcessingGraph.Editor
|
||||
if (graphviewchange.movedElements != null)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
foreach (var VARIABLE in graphviewchange.movedElements.OfType<IPT_StickyNote>())
|
||||
foreach (var VARIABLE in graphviewchange.movedElements.OfType<AssetGraphStickyNote>())
|
||||
{
|
||||
VARIABLE.SavePosition();
|
||||
}
|
||||
@ -329,7 +329,7 @@ namespace ImageProcessingGraph.Editor
|
||||
|
||||
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();
|
||||
|
||||
if (nodesToRemove.Count > 0)
|
||||
@ -376,8 +376,8 @@ namespace ImageProcessingGraph.Editor
|
||||
|
||||
public void CreateEdge(Edge edge)
|
||||
{
|
||||
ImageProcessingGraphNodeVisual outputNode = (ImageProcessingGraphNodeVisual)edge.output.node;
|
||||
ImageProcessingGraphNodeVisual inputNode = (ImageProcessingGraphNodeVisual)edge.input.node;
|
||||
AssetGraphNodeEditor outputNode = (AssetGraphNodeEditor)edge.output.node;
|
||||
AssetGraphNodeEditor inputNode = (AssetGraphNodeEditor)edge.input.node;
|
||||
|
||||
|
||||
int outputIndex = outputNode.OutputPorts.IndexOf(edge.output);
|
||||
@ -391,8 +391,8 @@ namespace ImageProcessingGraph.Editor
|
||||
edge.output.Connect(edge);
|
||||
edge.input.Connect(edge);
|
||||
|
||||
IPTPort portIn = (IPTPort)edge.output;
|
||||
IPTPort portOut = (IPTPort)edge.output;
|
||||
AssetGraphPort portIn = (AssetGraphPort)edge.output;
|
||||
AssetGraphPort portOut = (AssetGraphPort)edge.output;
|
||||
|
||||
if (portIn.fieldInfo != null)
|
||||
inputNode.ToggleExposedVariable(edge.input, false);
|
||||
@ -411,9 +411,9 @@ namespace ImageProcessingGraph.Editor
|
||||
edge.output.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)
|
||||
inputNode.ToggleExposedVariable(edge.input, true);
|
||||
@ -432,20 +432,20 @@ namespace ImageProcessingGraph.Editor
|
||||
{
|
||||
foreach (GraphConnection conn in asset.Connections)
|
||||
{
|
||||
ImageProcessingGraphNodeVisual inputNode = GetNode(conn.inputPort.nodeID);
|
||||
ImageProcessingGraphNodeVisual outputNode = GetNode(conn.outputPort.nodeID);
|
||||
AssetGraphNodeEditor inputNode = GetNode(conn.inputPort.nodeID);
|
||||
AssetGraphNodeEditor outputNode = GetNode(conn.outputPort.nodeID);
|
||||
|
||||
if (inputNode != null && outputNode != null)
|
||||
{
|
||||
IPTPort inPort = inputNode.InputPorts[conn.inputPort.portID] as IPTPort;
|
||||
IPTPort outPort = outputNode.OutputPorts[conn.outputPort.portID] as IPTPort;
|
||||
AssetGraphPort inPort = inputNode.InputPorts[conn.inputPort.portID] as AssetGraphPort;
|
||||
AssetGraphPort outPort = outputNode.OutputPorts[conn.outputPort.portID] as AssetGraphPort;
|
||||
|
||||
Edge edge = inPort.ConnectTo(outPort);
|
||||
AddElement(edge);
|
||||
connectionDictionary.Add(edge, conn);
|
||||
conn.SetInternalEdge(edge);
|
||||
|
||||
((ImageProcessingGraphNodeVisual)inPort.node).ToggleExposedVariable(inPort, false);
|
||||
((AssetGraphNodeEditor)inPort.node).ToggleExposedVariable(inPort, false);
|
||||
}
|
||||
|
||||
}
|
||||
@ -496,13 +496,13 @@ namespace ImageProcessingGraph.Editor
|
||||
#region Nodes
|
||||
private void DrawNodes()
|
||||
{
|
||||
foreach (ImageProcessingGraphNodeVisual node in graphNodes)
|
||||
foreach (AssetGraphNodeEditor node in graphNodes)
|
||||
{
|
||||
RemoveElement(node);
|
||||
}
|
||||
graphNodes.Clear();
|
||||
|
||||
foreach (KeyValuePair<string, ImageProcessingGraphNodeVisual> node in nodeDictionary)
|
||||
foreach (KeyValuePair<string, AssetGraphNodeEditor> node in nodeDictionary)
|
||||
{
|
||||
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;
|
||||
|
||||
var infoAttr = node.GetType().GetCustomAttribute<NodeInfoAttribute>();
|
||||
|
||||
ImageProcessingGraphNodeVisual editorNode = null;
|
||||
if (typeof(ImageProcessingGraphNodeVisual).IsAssignableFrom(infoAttr.EditorType))
|
||||
AssetGraphNodeEditor editorNode = null;
|
||||
if (typeof(AssetGraphNodeEditor).IsAssignableFrom(infoAttr.EditorType))
|
||||
{
|
||||
editorNode = (ImageProcessingGraphNodeVisual)Activator.CreateInstance(infoAttr.EditorType, node, this);
|
||||
editorNode = (AssetGraphNodeEditor)Activator.CreateInstance(infoAttr.EditorType, node, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
editorNode = new ImageProcessingGraphNodeVisual(node, this);
|
||||
editorNode = new AssetGraphNodeEditor(node, this);
|
||||
}
|
||||
|
||||
editorNode.SetPosition(node.Position);
|
||||
@ -539,7 +539,7 @@ namespace ImageProcessingGraph.Editor
|
||||
AddElement(editorNode);
|
||||
}
|
||||
|
||||
public void Add(BaseImageNode node)
|
||||
public void Add(AssetGraphNode node)
|
||||
{
|
||||
Undo.RecordObject(serializedObject.targetObject, "Added 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>();
|
||||
|
||||
@ -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.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