test
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(ControlInput))]
|
||||
public class
|
||||
ControlInputWidget : UnitInputPortWidget<ControlInput>
|
||||
{
|
||||
public ControlInputWidget(FlowCanvas canvas, ControlInput port) : base(canvas, port) { }
|
||||
|
||||
protected override Texture handleTextureConnected => BoltFlow.Icons.controlPortConnected?[12];
|
||||
|
||||
protected override Texture handleTextureUnconnected => BoltFlow.Icons.controlPortUnconnected?[12];
|
||||
|
||||
protected override bool colorIfActive => !BoltFlow.Configuration.animateControlConnections || !BoltFlow.Configuration.animateValueConnections;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a608417e8e4b45678ccec3fec1ff1e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(ControlOutput))]
|
||||
public class ControlOutputWidget : UnitOutputPortWidget<ControlOutput>
|
||||
{
|
||||
public ControlOutputWidget(FlowCanvas canvas, ControlOutput port) : base(canvas, port) { }
|
||||
|
||||
protected override Texture handleTextureConnected => BoltFlow.Icons.controlPortConnected?[12];
|
||||
|
||||
protected override Texture handleTextureUnconnected => BoltFlow.Icons.controlPortUnconnected?[12];
|
||||
|
||||
protected override bool colorIfActive => !BoltFlow.Configuration.animateControlConnections || !BoltFlow.Configuration.animateValueConnections;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca12711a98bb548dc9eaa87d8d4d7263
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public interface IUnitPortWidget : IWidget
|
||||
{
|
||||
IUnitPort port { get; }
|
||||
float y { set; }
|
||||
Rect handlePosition { get; }
|
||||
float GetInnerWidth();
|
||||
float GetHeight();
|
||||
bool willDisconnect { get; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fd9d037384804ceb8ec4553867935cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(InvalidInput))]
|
||||
public class InvalidInputWidget : UnitInputPortWidget<InvalidInput>
|
||||
{
|
||||
public InvalidInputWidget(FlowCanvas canvas, InvalidInput port) : base(canvas, port) { }
|
||||
|
||||
protected override Texture handleTextureConnected => BoltFlow.Icons.invalidPortConnected?[12];
|
||||
|
||||
protected override Texture handleTextureUnconnected => BoltFlow.Icons.invalidPortUnconnected?[12];
|
||||
|
||||
protected override bool colorIfActive => false;
|
||||
|
||||
protected override bool canStartConnection => false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bfbd8ae9f1465463e947470757c476e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(InvalidOutput))]
|
||||
public class InvalidOutputWidget : UnitOutputPortWidget<InvalidOutput>
|
||||
{
|
||||
public InvalidOutputWidget(FlowCanvas canvas, InvalidOutput port) : base(canvas, port) { }
|
||||
|
||||
protected override Texture handleTextureConnected => BoltFlow.Icons.invalidPortConnected?[12];
|
||||
|
||||
protected override Texture handleTextureUnconnected => BoltFlow.Icons.invalidPortUnconnected?[12];
|
||||
|
||||
protected override bool colorIfActive => false;
|
||||
|
||||
protected override bool canStartConnection => false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7306e68be1a5b48909d2c871e5eb5a00
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public abstract class UnitInputPortWidget<TPort> : UnitPortWidget<TPort> where TPort : class, IUnitInputPort
|
||||
{
|
||||
protected UnitInputPortWidget(FlowCanvas canvas, TPort port) : base(canvas, port) { }
|
||||
|
||||
protected override Edge edge => Edge.Left;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c54ce026372e84ba19e0a32de76dd6c6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,9 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
public abstract class UnitOutputPortWidget<TPort> : UnitPortWidget<TPort> where TPort : class, IUnitOutputPort
|
||||
{
|
||||
protected UnitOutputPortWidget(FlowCanvas canvas, TPort port) : base(canvas, port) { }
|
||||
|
||||
protected override Edge edge => Edge.Right;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8e71549dfa4c490293edb249f48fccb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,110 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Inspector(typeof(IUnitPortDefinition))]
|
||||
public class UnitPortDefinitionInspector : Inspector
|
||||
{
|
||||
public UnitPortDefinitionInspector(Metadata metadata) : base(metadata) { }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
metadata.instantiate = true;
|
||||
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
private Metadata keyMetadata => metadata[nameof(IUnitPortDefinition.key)];
|
||||
private Metadata labelMetadata => metadata[nameof(IUnitPortDefinition.label)];
|
||||
private Metadata descriptionMetadata => metadata[nameof(IUnitPortDefinition.summary)];
|
||||
private Metadata hideLabelMetadata => metadata[nameof(IUnitPortDefinition.hideLabel)];
|
||||
|
||||
protected float GetKeyHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, keyMetadata, width);
|
||||
}
|
||||
|
||||
protected float GetLabelHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, labelMetadata, width);
|
||||
}
|
||||
|
||||
protected float GetDescriptionHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, descriptionMetadata, width);
|
||||
}
|
||||
|
||||
protected float GetHideLabelHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, hideLabelMetadata, width);
|
||||
}
|
||||
|
||||
protected void OnKeyGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(keyMetadata, position);
|
||||
}
|
||||
|
||||
protected void OnLabelGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(labelMetadata, position);
|
||||
}
|
||||
|
||||
protected void OnDescriptionGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(descriptionMetadata, position);
|
||||
}
|
||||
|
||||
protected void OnHideLabelGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(hideLabelMetadata, position);
|
||||
}
|
||||
|
||||
protected override float GetHeight(float width, GUIContent label)
|
||||
{
|
||||
var height = 0f;
|
||||
|
||||
height += GetKeyHeight(width);
|
||||
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
height += GetLabelHeight(width);
|
||||
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
height += GetDescriptionHeight(width);
|
||||
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
height += GetHideLabelHeight(width);
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
protected virtual void OnFieldsGUI(Rect position)
|
||||
{
|
||||
OnKeyGUI(position.VerticalSection(ref y, GetKeyHeight(position.width)));
|
||||
|
||||
y += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
OnLabelGUI(position.VerticalSection(ref y, GetLabelHeight(position.width)));
|
||||
|
||||
y += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
OnDescriptionGUI(position.VerticalSection(ref y, GetDescriptionHeight(position.width)));
|
||||
|
||||
y += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
OnHideLabelGUI(position.VerticalSection(ref y, GetHideLabelHeight(position.width)));
|
||||
}
|
||||
|
||||
protected sealed override void OnGUI(Rect position, GUIContent label)
|
||||
{
|
||||
BeginLabeledBlock(metadata, position, label);
|
||||
|
||||
OnFieldsGUI(position);
|
||||
|
||||
EndBlock(metadata);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa26083bb17a34b52b1fee6afd411506
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23c864f32645c4df8a6fedf99addeb77
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Inspector(typeof(ValueInputDefinition))]
|
||||
public sealed class ValueInputDefinitionInspector : ValuePortDefinitionInspector
|
||||
{
|
||||
public ValueInputDefinitionInspector(Metadata metadata) : base(metadata) { }
|
||||
|
||||
private Metadata hasDefaultValueMetadata => metadata[nameof(ValueInputDefinition.hasDefaultValue)];
|
||||
private Metadata defaultValueMetadata => metadata[nameof(ValueInputDefinition.defaultValue)];
|
||||
private Metadata typedDefaultValueMetadata => defaultValueMetadata.Cast((Type)typeMetadata.value);
|
||||
|
||||
private float GetHasDefaultValueHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, hasDefaultValueMetadata, width);
|
||||
}
|
||||
|
||||
private float GetDefaultValueHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, typedDefaultValueMetadata, width);
|
||||
}
|
||||
|
||||
private void OnHasDefaultValueGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(hasDefaultValueMetadata, position);
|
||||
}
|
||||
|
||||
private void OnDefaultValueGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(typedDefaultValueMetadata, position);
|
||||
}
|
||||
|
||||
protected override float GetHeight(float width, GUIContent label)
|
||||
{
|
||||
var height = base.GetHeight(width, label);
|
||||
|
||||
if (typeMetadata.value != null && ValueInput.SupportsDefaultValue((Type)typeMetadata.value))
|
||||
{
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
height += GetHasDefaultValueHeight(width);
|
||||
|
||||
if ((bool)hasDefaultValueMetadata.value)
|
||||
{
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
height += GetDefaultValueHeight(width);
|
||||
}
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
protected override void OnFieldsGUI(Rect position)
|
||||
{
|
||||
base.OnFieldsGUI(position);
|
||||
|
||||
if (typeMetadata.value != null && ValueInput.SupportsDefaultValue((Type)typeMetadata.value))
|
||||
{
|
||||
y += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
OnHasDefaultValueGUI(position.VerticalSection(ref y, GetHasDefaultValueHeight(position.width)));
|
||||
|
||||
if ((bool)hasDefaultValueMetadata.value)
|
||||
{
|
||||
y += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
OnDefaultValueGUI(position.VerticalSection(ref y, GetDefaultValueHeight(position.width)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e60e3ab5ec4384a26a35ad03f991ab55
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(ValueInput))]
|
||||
public class ValueInputWidget : UnitInputPortWidget<ValueInput>
|
||||
{
|
||||
public ValueInputWidget(FlowCanvas canvas, ValueInput port) : base(canvas, port)
|
||||
{
|
||||
color = ValueConnectionWidget.DetermineColor(port.type);
|
||||
}
|
||||
|
||||
protected override bool showInspector => port.hasDefaultValue && !port.hasValidConnection;
|
||||
|
||||
protected override bool colorIfActive => !BoltFlow.Configuration.animateControlConnections || !BoltFlow.Configuration.animateValueConnections;
|
||||
|
||||
public override Color color { get; }
|
||||
|
||||
protected override Texture handleTextureConnected => BoltFlow.Icons.valuePortConnected?[12];
|
||||
|
||||
protected override Texture handleTextureUnconnected => BoltFlow.Icons.valuePortUnconnected?[12];
|
||||
|
||||
public override Metadata FetchInspectorMetadata()
|
||||
{
|
||||
if (port.hasDefaultValue)
|
||||
{
|
||||
return metadata["_defaultValue"].Cast(port.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6de90288101284c5891d285c63d67c40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(ValueOutput))]
|
||||
public class ValueOutputWidget : UnitOutputPortWidget<ValueOutput>
|
||||
{
|
||||
public ValueOutputWidget(FlowCanvas canvas, ValueOutput port) : base(canvas, port)
|
||||
{
|
||||
color = ValueConnectionWidget.DetermineColor(port.type);
|
||||
}
|
||||
|
||||
protected override bool colorIfActive => !BoltFlow.Configuration.animateControlConnections || !BoltFlow.Configuration.animateValueConnections;
|
||||
|
||||
public override Color color { get; }
|
||||
|
||||
protected override Texture handleTextureConnected => BoltFlow.Icons.valuePortConnected?[12];
|
||||
|
||||
protected override Texture handleTextureUnconnected => BoltFlow.Icons.valuePortUnconnected?[12];
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6392d6c3118b84772bac990889aaa190
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,43 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Inspector(typeof(ValuePortDefinition))]
|
||||
public class ValuePortDefinitionInspector : UnitPortDefinitionInspector
|
||||
{
|
||||
public ValuePortDefinitionInspector(Metadata metadata) : base(metadata) { }
|
||||
|
||||
protected Metadata typeMetadata => metadata[nameof(ValueInputDefinition.type)];
|
||||
|
||||
protected float GetTypeHeight(float width)
|
||||
{
|
||||
return LudiqGUI.GetInspectorHeight(this, typeMetadata, width);
|
||||
}
|
||||
|
||||
private void OnTypeGUI(Rect position)
|
||||
{
|
||||
LudiqGUI.Inspector(typeMetadata, position);
|
||||
}
|
||||
|
||||
protected override float GetHeight(float width, GUIContent label)
|
||||
{
|
||||
var height = base.GetHeight(width, label);
|
||||
|
||||
height += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
height += GetTypeHeight(width);
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
protected override void OnFieldsGUI(Rect position)
|
||||
{
|
||||
base.OnFieldsGUI(position);
|
||||
|
||||
y += EditorGUIUtility.standardVerticalSpacing;
|
||||
|
||||
OnTypeGUI(position.VerticalSection(ref y, GetTypeHeight(position.width)));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8547e7db1fc234a80b57c9d30108abac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user