This commit is contained in:
Chromium 2025-04-28 04:16:02 +01:00
parent b4a66d7e26
commit 0614e27cd5
5 changed files with 25 additions and 11 deletions

View File

@ -10,12 +10,10 @@ namespace ImageProcessingGraph.Editor
{ {
public FieldInfo fieldInfo; public FieldInfo fieldInfo;
private VisualElement _exposedPropertyContainer; private VisualElement _exposedPropertyContainer;
public VisualElement ExposedPropertyContainer public VisualElement ExposedPropertyContainer
{ {
set set
{ {
Debug.Log($"🔥 Someone is SETTING ExposedPropertyContainer to {value} 🔥");
_exposedPropertyContainer = value; _exposedPropertyContainer = value;
} }
get get

View File

@ -22,6 +22,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
private ImageProcessingGraphViewWindow window; private ImageProcessingGraphViewWindow window;
private StyleSheet defaaStyleSheet;
private StyleSheet errorStyleSheet; private StyleSheet errorStyleSheet;
public ImageProcessingGraphNodeVisual(BaseImageNode node, ImageProcessingGraphViewWindow window) public ImageProcessingGraphNodeVisual(BaseImageNode node, ImageProcessingGraphViewWindow window)
@ -79,10 +80,17 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
} }
errorStyleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Unity Image Processing/Node.uss"); defaaStyleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Unity Image Processing/Node.uss");
if (defaaStyleSheet == null)
{
defaaStyleSheet = EditorGUIUtility.Load("Packages/com.chromium.imageprocessingrah/Node.uss") as StyleSheet;
}
styleSheets.Add(defaaStyleSheet);
errorStyleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>("Assets/Unity Image Processing/NodeError.uss");
if (errorStyleSheet == null) if (errorStyleSheet == null)
{ {
errorStyleSheet = EditorGUIUtility.Load("Packages/com.chromium.imageprocessingrah/Node.uss") as StyleSheet; errorStyleSheet = EditorGUIUtility.Load("Packages/com.chromium.imageprocessingrah/NodeError.uss") as StyleSheet;
} }
graphNode.onFailed += () => graphNode.onFailed += () =>
@ -139,12 +147,13 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
// Exposes a variable on the port for editing when it's not connected // Exposes a variable on the port for editing when it's not connected
public void ExposeVariableToPort(Port port, FieldInfo field) public void ExposeVariableToPort(Port port, FieldInfo field)
{ {
VisualElement NewElement;
var ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer; var ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer;
Type containerType = null; Type containerType = null;
if (ExposedPropertyContainer == null) if (ExposedPropertyContainer == null)
{ {
var NewElement = new VisualElement(); NewElement = new VisualElement();
NewElement.name = "property-field-container"; NewElement.name = "property-field-container";
VisualElement the = CreatePropertyFieldForType(field.FieldType, field.GetValue(graphNode)); VisualElement the = CreatePropertyFieldForType(field.FieldType, field.GetValue(graphNode));
@ -242,7 +251,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
}); });
} }
port.Add(ExposedPropertyContainer); port.Add(NewElement);
} }
public void ToggleExposedVariable(Port port, bool value) public void ToggleExposedVariable(Port port, bool value)

View File

@ -1,7 +1,4 @@
#node-border #input
{ {
border-bottom-color: red; flex-shrink: 1
border-left-color: red;
border-right-color: red;
border-top-color: red;
} }

7
NodeError.uss Normal file
View File

@ -0,0 +1,7 @@
#node-border
{
border-bottom-color: red;
border-left-color: red;
border-right-color: red;
border-top-color: red;
}

3
NodeError.uss.meta Normal file
View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7ecdb9925f9c4d018e1e54b8ae734ccb
timeCreated: 1745808720