Added Documentation Links

This commit is contained in:
Chromium 2025-05-11 13:06:33 +01:00
parent 0b7696fc79
commit 679f93c04d
27 changed files with 312 additions and 72 deletions

View File

@ -1,17 +0,0 @@
using UnityEngine;
using System.Collections;
public class NewMonoBehaviour : MonoBehaviour
{
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 78c0de359ceae406cb2985637a2e6c97

View File

@ -10,18 +10,21 @@ namespace ImageProcessingGraph.Editor.Nodes.NodeAttributes
private string menuItem;
private string ussPath;
private Type editorType;
private string docuementationURL;
public string Title => name;
public string MenuItem => menuItem;
public string UssPath => ussPath;
public Type EditorType => editorType;
public string DocumentationationURL => docuementationURL;
public NodeInfoAttribute(string name, string menuItem = "", bool requiresImage = false, string ussPath = null, Type editorType = null)
public NodeInfoAttribute(string name, string menuItem = "", bool requiresImage = false, string ussPath = null, Type editorType = null, string docuementationURL = null)
{
this.name = name;
this.menuItem = menuItem;
this.ussPath = ussPath;
this.editorType = editorType;
this.docuementationURL = docuementationURL;
}
}

View File

@ -1,18 +0,0 @@
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
namespace ImageProcessingGraph.Editor.Nodes.String_Nodes
{
[NodeInfo("String Append", "String/Append")]
public class StringAppend : BaseImageNode
{
[NodeAttributes.Input("String A")] public string baseString;
[NodeAttributes.Input("String B")] public string appendString;
[NodeAttributes.Output("Appended String")] public string output;
public override void Process()
{
this.output = baseString + appendString;
}
}
}

View File

@ -0,0 +1,69 @@
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
namespace ImageProcessingGraph.Editor.Nodes.String_Nodes
{
[NodeInfo("String Append", "String/Append", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Append")]
public class StringAppend : BaseImageNode
{
[NodeAttributes.Input("String A")] public string baseString;
[NodeAttributes.Input("String B")] public string appendString;
[NodeAttributes.Output("Appended String")] public string output;
public override void Process()
{
this.output = baseString + appendString;
}
}
[NodeInfo("String Replace", "String/Replace", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Replace")]
public class StringReplace : BaseImageNode
{
[NodeAttributes.Input("Original String")] public string original;
[NodeAttributes.Input("Old Value")] public string oldValue;
[NodeAttributes.Input("New Value")] public string newValue;
[NodeAttributes.Output("Replaced String")] public string output;
public override void Process()
{
if (!string.IsNullOrEmpty(original) && oldValue != null)
output = original.Replace(oldValue, newValue);
else
output = original;
}
}
[NodeInfo("String Split", "String/Split", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes/String/Split")]
public class StringSplit : BaseImageNode
{
[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;
public override void Process()
{
if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(delimiter))
{
before = source;
after = string.Empty;
return;
}
int index = source.IndexOf(delimiter);
if (index >= 0)
{
before = source.Substring(0, index);
after = source.Substring(index + delimiter.Length);
}
else
{
before = source;
after = string.Empty;
}
}
}
}

View File

@ -6,7 +6,7 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
{
[NodeInfoAttribute("Invert Channel", "Adjustments/InvertChannel", true)]
[NodeInfoAttribute("Invert Channel", "Adjustments/InvertChannel", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvertChannel")]
public class ChannelInvertNode : BaseImageNode
{
[NodeAttributes.Input("Input Channel")]

View File

@ -8,14 +8,14 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
{
[NodeInfoAttribute("Desaturate", "Adjustments/Desaturate", true)]
[NodeInfoAttribute("Desaturate", "Adjustments/Desaturate", true, docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FDesaturate")]
public class Texture2DDesaturate : BaseImageNode
{
[NodeAttributes.Input("")]
public ImageData inputTexture; // Changed to ImageData
[NodeAttributes.Output("")]
public ImageData outputTexture; // Changed to ImageData
public ImageData inputTexture;
[NodeAttributes.Output("")]
public ImageData outputTexture;
public override void Process()
{

View File

@ -6,21 +6,19 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
{
[NodeInfoAttribute("Invert", "Adjustments/Invert", true)]
[NodeInfoAttribute("Invert", "Adjustments/Invert", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FInvert")]
public class Texture2DInvert : BaseImageNode
{
[NodeAttributes.Input("")]
public ImageData inputTexture; // Changed to ImageData
public ImageData inputTexture;
[NodeAttributes.Output("")]
public ImageData outputTexture; // Changed to ImageData
public ImageData outputTexture;
public override void Process()
{
// Create an empty NativeArray for the output
NativeArray<Color32> output = new NativeArray<Color32>(inputTexture.PixelData.Length, Allocator.Persistent);
// Create and run the InvertJob
InvertJob job = new InvertJob
{
pixels = inputTexture.PixelData,
@ -29,7 +27,6 @@ namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
job.Run();
// Store the result in the outputImage as an ImageData instance
outputTexture = new ImageData(output, (inputTexture.Width, inputTexture.Height), inputTexture.isRGBA);
}
}
@ -37,14 +34,13 @@ namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
[BurstCompile]
public struct InvertJob : IJob
{
[ReadOnly] public NativeArray<Color32> pixels; // Input pixels
[WriteOnly] public NativeArray<Color32> outputPixels; // Output pixels
[ReadOnly] public NativeArray<Color32> pixels;
[WriteOnly] public NativeArray<Color32> outputPixels;
public void Execute()
{
int length = pixels.Length;
// Invert each pixel color
for (int i = 0; i < length; i++)
{
Color32 pixel = pixels[i];

View File

@ -6,7 +6,7 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
{
[NodeInfo("RGBA Combine", "Channels/RGBA Combine", true)]
[NodeInfo("RGBA Combine", "Channels/RGBA Combine", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBACombine")]
public class RGBASCombine : BaseImageNode
{
[NodeAttributes.Input("R")]

View File

@ -6,7 +6,7 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
{
[NodeInfoAttribute("RGBA Split", "Channels/RGBA Split", true)]
[NodeInfoAttribute("RGBA Split", "Channels/RGBA Split", true, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FRGBASplit")]
public class RGBASplit : BaseImageNode
{
[NodeAttributes.Input("")]

View File

@ -6,7 +6,7 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Fun_Nodes.Texture
{
[NodeInfoAttribute("Get Dimensions", "Dimensions/Get Dimensions", false)]
[NodeInfoAttribute("Get Dimensions", "Dimensions/Get Dimensions", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FGetDimensions")]
public class TextureGetDimensions : BaseImageNode
{
[NodeAttributes.Input("")]

View File

@ -6,7 +6,7 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Output
{
[NodeInfo("Texture Export", "Export/Texture Export", true)]
[NodeInfo("Texture Export", "Export/Texture Export", true,docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FTexture2DOutput")]
public class Texture2DOutput : BaseImageNode
{
[NodeAttributes.Input("")] public ImageData inputPixels;

View File

@ -1,4 +1,5 @@
using System.IO;
using System.Security.Policy;
using ImageProcessingGraph.Editor.Nodes.NodeAttributes;
using UnityEditor;
using UnityEngine;
@ -31,12 +32,12 @@ namespace ImageProcessingGraph.Editor.Nodes.Types.Image.From_Path_Nodes
}
}
[NodeInfo("Load Texture2D From path", "Load From Path/Texture2D")]
[NodeInfo("Load Texture2D From path", "Load From Path/Texture2D", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FFromPathNode")]
public class Texture2DFromPath : FromPathNode<Texture2D> { }
[NodeInfo("Load Mesh From path", "Load From Path/Mesh")]
[NodeInfo("Load Mesh From path", "Load From Path/Mesh", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FFromPathNode")]
public class MeshFromPath : FromPathNode<Mesh> { }
[NodeInfo("Load Prefab From path", "Load From Path/Prefab")]
[NodeInfo("Load Prefab From path", "Load From Path/Prefab", docuementationURL: "https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FFromPathNode")]
public class PrefabFromPath : FromPathNode<GameObject> { }
}

View File

@ -6,7 +6,7 @@ using UnityEngine;
namespace ImageProcessingGraph.Editor.Nodes.Import_Nodes
{
[NodeInfo("Texture Import", "Imports/Import Texture")]
[NodeInfo("Texture Import", "Imports/Import Texture", docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FTexture2DImport")]
public class Texture2DImport : BaseImageNode
{
[NodeAttributes.Input("")]

View File

@ -8,7 +8,7 @@ namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Utilities
{
public class SingleChannelColor
{
[NodeInfoAttribute("Channel Color", "Utility/Channel Color", false)]
[NodeInfoAttribute("Channel Color", "Utility/Channel Color", false, docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImages%2FSingleChannelColor")]
public class SingleColorChannel : BaseImageNode
{
[NodeAttributes.Input("Color")] public GreyscaleValue range;

View File

@ -6,7 +6,7 @@ using Unity.Burst;
namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Utilities.ViewNode
{
[NodeInfo("View Texture", "Utility/View Texture", false, null , editorType: typeof(ViewTextureNodeEditor))]
[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
{
[NodeAttributes.Input("Texture")] public Texture2D texture;

View File

@ -28,12 +28,12 @@ namespace ImageProcessingGraph.Editor.Nodes.Types.Image.Variable_Node
}
}
[NodeInfo("Texture2D Variable", "Variable/Texture2D")]
[NodeInfo("Texture2D Variable", "Variable/Texture2D", docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FVariableNode")]
public class Texture2DVariableNode : VariableNode<Texture2D> { }
[NodeInfo("Mesh Variable", "Variable/Mesh")]
[NodeInfo("Mesh Variable", "Variable/Mesh", docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FVariableNode")]
public class MeshVariableNode : VariableNode<Mesh> { }
[NodeInfo("Prefab Variable", "Variable/Prefab")]
[NodeInfo("Prefab Variable", "Variable/Prefab", docuementationURL:"https://git.sam-green.dev/Chromum/UnityImageProcessing_Package/wiki/Nodes%2FImage%2FVariableNode")]
public class PrefabVariableNode : VariableNode<GameObject> { }
}

View File

@ -6,7 +6,7 @@ using UnityEngine.UIElements;
namespace ImageProcessingGraph.Editor.Nodes.Types.Utils.Connector
{
[NodeInfo("", "Utility/Connection", false, null , editorType: typeof(GenericConnectionEditor))]
[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
{
private System.Type internalType;

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 701fddc3e03215a47a5e29169f936f05
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,150 @@
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");
}
}

View File

@ -0,0 +1,12 @@
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:

View File

@ -0,0 +1,5 @@
.custom-label {
font-size: 20px;
-unity-font-style: bold;
color: rgb(68, 138, 255);
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 966fc07be508c4244ba4c927e36a753a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0

View File

@ -0,0 +1,5 @@
<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&amp;guid=966fc07be508c4244ba4c927e36a753a&amp;type=3#GettingStartedWindow" />
<engine:Label text="Oogooooga :(&#10;&#10;" />
<engine:RadioButton label="Radio Button" />
</engine:UXML>

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9566e7fc6d4ac8848bdc7762e84f3d3d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@ -25,7 +25,8 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
private StyleSheet defaaStyleSheet;
private StyleSheet errorStyleSheet;
private NodeInfoAttribute info;
public ImageProcessingGraphNodeVisual(BaseImageNode node, ImageProcessingGraphViewWindow window)
{
this.AddToClassList("image-node-visual");
@ -34,9 +35,10 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
Type typeInfo = node.GetType();
NodeInfoAttribute info = typeInfo.GetCustomAttribute<NodeInfoAttribute>();
info = typeInfo.GetCustomAttribute<NodeInfoAttribute>();
title = info.Title;
this.name = typeInfo.Name;
string[] depths = info.MenuItem.Split('/');
foreach (var depth in depths)
@ -311,8 +313,6 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
var objectField = new ObjectField { value = (UnityEngine.Object)value, objectType = typeof(UnityEngine.Object) };
return objectField;
}
// Add more types as needed
return null;
}
@ -325,7 +325,14 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
private void OpenDocumentation(DropdownMenuAction obj)
{
if (info.DocumentationationURL != null || !string.IsNullOrEmpty(info.DocumentationationURL))
{
Application.OpenURL(info.DocumentationationURL);
}
else
{
Debug.LogWarning($"No documentation URL provided for node {this.graphNode.asset.name}!");
}
}
public void SavePosition() => graphNode.SetPosition(GetPosition());