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;
private VisualElement _exposedPropertyContainer;
public VisualElement ExposedPropertyContainer
{
set
{
Debug.Log($"🔥 Someone is SETTING ExposedPropertyContainer to {value} 🔥");
_exposedPropertyContainer = value;
}
get

View File

@ -22,6 +22,7 @@ namespace ImageProcessingGraph.Editor.Unity_Image_Processing.Scripts.Editor.Wind
private ImageProcessingGraphViewWindow window;
private StyleSheet defaaStyleSheet;
private StyleSheet errorStyleSheet;
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)
{
errorStyleSheet = EditorGUIUtility.Load("Packages/com.chromium.imageprocessingrah/Node.uss") as StyleSheet;
errorStyleSheet = EditorGUIUtility.Load("Packages/com.chromium.imageprocessingrah/NodeError.uss") as StyleSheet;
}
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
public void ExposeVariableToPort(Port port, FieldInfo field)
{
VisualElement NewElement;
var ExposedPropertyContainer = ((IPTPort)port).ExposedPropertyContainer;
Type containerType = null;
if (ExposedPropertyContainer == null)
{
var NewElement = new VisualElement();
NewElement = new VisualElement();
NewElement.name = "property-field-container";
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)

View File

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

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