test
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 090e4bacbeacf4be78a0641c489864bf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,11 @@
|
||||
namespace Unity.VisualScripting.Analytics
|
||||
{
|
||||
class StateMacroSavedEvent : UnityEditor.AssetModificationProcessor
|
||||
{
|
||||
static string[] OnWillSaveAssets(string[] paths)
|
||||
{
|
||||
UsageAnalytics.CollectAndSendForType<StateGraphAsset>(paths);
|
||||
return paths;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8946f8274f03d4448a452d58da80d1cd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 704dcfe5d449b4fc1872497f985b71f9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Descriptor(typeof(StateGraph))]
|
||||
public sealed class StateGraphDescriptor : GraphDescriptor<StateGraph, GraphDescription>
|
||||
{
|
||||
public StateGraphDescriptor(StateGraph target) : base(target) { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f05c1fcce075f4c758b4b36f491dd0b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Descriptor(typeof(StateMachine))]
|
||||
public sealed class StateMachineDescriptor : MachineDescriptor<StateMachine, MachineDescription>
|
||||
{
|
||||
public StateMachineDescriptor(StateMachine target) : base(target) { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b04c1e280ff6e45de9c1ee0c405a5711
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Descriptor(typeof(StateGraphAsset))]
|
||||
public sealed class StateMacroDescriptor : MacroDescriptor<StateGraphAsset, MacroDescription>
|
||||
{
|
||||
public StateMacroDescriptor(StateGraphAsset target) : base(target) { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 388714a324a29401594aee5d32810261
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c49d3c6b3c0954e528e5020c1c49acfa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,25 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[GraphContextExtension(typeof(FlowGraphContext))]
|
||||
public sealed class FlowGraphContextStateExtension : GraphContextExtension<FlowGraphContext>
|
||||
{
|
||||
public FlowGraphContextStateExtension(FlowGraphContext context) : base(context) { }
|
||||
|
||||
public override bool AcceptsDragAndDrop()
|
||||
{
|
||||
return DragAndDropUtility.Is<StateGraphAsset>();
|
||||
}
|
||||
|
||||
public override void PerformDragAndDrop()
|
||||
{
|
||||
var statemacro = DragAndDropUtility.Get<StateGraphAsset>();
|
||||
var stateUnit = new StateUnit(statemacro);
|
||||
context.canvas.AddUnit(stateUnit, DragAndDropUtility.position);
|
||||
}
|
||||
|
||||
public override void DrawDragAndDropPreview()
|
||||
{
|
||||
GraphGUI.DrawDragAndDropPreviewLabel(DragAndDropUtility.offsetedPosition, DragAndDropUtility.Get<StateGraphAsset>().name, typeof(StateGraphAsset).Icon());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7befbeb005f98497e828793e65d518c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Descriptor(typeof(StateUnit))]
|
||||
public class StateUnitDescriptor : NesterUnitDescriptor<StateUnit>
|
||||
{
|
||||
public StateUnitDescriptor(StateUnit unit) : base(unit) { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19529b57382684562940e410a8b7e385
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Editor(typeof(StateUnit))]
|
||||
public sealed class StateUnitEditor : NesterUnitEditor
|
||||
{
|
||||
public StateUnitEditor(Metadata metadata) : base(metadata) { }
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fa37d86e69c94da48f72c38e85a25f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,41 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Widget(typeof(StateUnit))]
|
||||
public class StateUnitWidget : NestrerUnitWidget<StateUnit>, IDragAndDropHandler
|
||||
{
|
||||
public StateUnitWidget(FlowCanvas canvas, StateUnit unit) : base(canvas, unit) { }
|
||||
|
||||
public DragAndDropVisualMode dragAndDropVisualMode => DragAndDropVisualMode.Generic;
|
||||
|
||||
public bool AcceptsDragAndDrop()
|
||||
{
|
||||
return DragAndDropUtility.Is<StateGraphAsset>();
|
||||
}
|
||||
|
||||
public void PerformDragAndDrop()
|
||||
{
|
||||
UndoUtility.RecordEditedObject("Drag & Drop Macro");
|
||||
unit.nest.source = GraphSource.Macro;
|
||||
unit.nest.macro = DragAndDropUtility.Get<StateGraphAsset>();
|
||||
unit.nest.embed = null;
|
||||
unit.Define();
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
public void UpdateDragAndDrop()
|
||||
{
|
||||
}
|
||||
|
||||
public void DrawDragAndDropPreview()
|
||||
{
|
||||
GraphGUI.DrawDragAndDropPreviewLabel(new Vector2(edgePosition.x, outerPosition.yMax), "Replace with: " + DragAndDropUtility.Get<StateGraphAsset>().name, typeof(StateGraphAsset).Icon());
|
||||
}
|
||||
|
||||
public void ExitDragAndDrop()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07e0926bb74a646ad92846ce48b5074e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[InitializeAfterPlugins]
|
||||
public static class UnitBaseStateExtensions
|
||||
{
|
||||
static UnitBaseStateExtensions()
|
||||
{
|
||||
UnitBase.staticUnitsExtensions.Add(GetStaticOptions);
|
||||
UnitBase.dynamicUnitsExtensions.Add(GetDynamicOptions);
|
||||
UnitBase.contextualUnitsExtensions.Add(GetContextualOptions);
|
||||
}
|
||||
|
||||
private static IEnumerable<IUnitOption> GetStaticOptions()
|
||||
{
|
||||
yield return StateUnit.WithStart().Option();
|
||||
}
|
||||
|
||||
private static IEnumerable<IUnitOption> GetDynamicOptions()
|
||||
{
|
||||
var stateMacros = UnityAPI.Await(() => AssetUtility.GetAllAssetsOfType<StateGraphAsset>().ToArray());
|
||||
|
||||
foreach (var stateUnit in stateMacros.Select(statemacro => new StateUnit(statemacro)))
|
||||
{
|
||||
yield return stateUnit.Option();
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<IUnitOption> GetContextualOptions(GraphReference reference)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32950f866b53a45b7b44696721d28303
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 746d03c4ee4a14b2fa93ddb9d4718f6c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,341 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Canvas(typeof(StateGraph))]
|
||||
public sealed class StateCanvas : VisualScriptingCanvas<StateGraph>
|
||||
{
|
||||
public StateCanvas(StateGraph graph) : base(graph) { }
|
||||
|
||||
|
||||
#region View
|
||||
|
||||
protected override bool shouldEdgePan => base.shouldEdgePan || isCreatingTransition;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Drawing
|
||||
|
||||
protected override void DrawBackground()
|
||||
{
|
||||
base.DrawBackground();
|
||||
|
||||
if (isCreatingTransition)
|
||||
{
|
||||
var startRect = this.Widget(transitionSource).position;
|
||||
var end = mousePosition;
|
||||
|
||||
Edge startEdge, endEdge;
|
||||
|
||||
GraphGUI.GetConnectionEdge
|
||||
(
|
||||
startRect.center,
|
||||
end,
|
||||
out startEdge,
|
||||
out endEdge
|
||||
);
|
||||
|
||||
var start = startRect.GetEdgeCenter(startEdge);
|
||||
|
||||
GraphGUI.DrawConnectionArrow(Color.white, start, end, startEdge, endEdge);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Clipboard
|
||||
|
||||
public override void ShrinkCopyGroup(HashSet<IGraphElement> copyGroup)
|
||||
{
|
||||
copyGroup.RemoveWhere(element =>
|
||||
{
|
||||
if (element is IStateTransition)
|
||||
{
|
||||
var transition = (IStateTransition)element;
|
||||
|
||||
if (!copyGroup.Contains(transition.source) ||
|
||||
!copyGroup.Contains(transition.destination))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Window
|
||||
|
||||
public override void OnToolbarGUI()
|
||||
{
|
||||
if (graph.states.Any(u => u.GetException(reference) != null) || graph.transitions.Any(t => t.GetException(reference) != null))
|
||||
{
|
||||
if (GUILayout.Button("Clear Errors", LudiqStyles.toolbarButton))
|
||||
{
|
||||
foreach (var state in graph.states)
|
||||
{
|
||||
state.SetException(reference, null);
|
||||
}
|
||||
|
||||
foreach (var transition in graph.transitions)
|
||||
{
|
||||
transition.SetException(reference, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
BoltCore.Configuration.dimInactiveNodes = GUILayout.Toggle(BoltCore.Configuration.dimInactiveNodes, "Dim", LudiqStyles.toolbarButton);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
BoltCore.Configuration.Save();
|
||||
}
|
||||
|
||||
base.OnToolbarGUI();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Context
|
||||
|
||||
protected override void OnContext()
|
||||
{
|
||||
if (isCreatingTransition)
|
||||
{
|
||||
CancelTransition();
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnContext();
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<DropdownOption> GetContextOptions()
|
||||
{
|
||||
yield return new DropdownOption((Action<Vector2>)CreateFlowState, "Create Script State");
|
||||
yield return new DropdownOption((Action<Vector2>)CreateSuperState, "Create Super State");
|
||||
yield return new DropdownOption((Action<Vector2>)CreateAnyState, "Create Any State");
|
||||
yield return new DropdownOption((Action<Vector2>)(NewSticky), "Create Sticky Note");
|
||||
foreach (var baseOption in base.GetContextOptions())
|
||||
{
|
||||
yield return baseOption;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateFlowState(Vector2 position)
|
||||
{
|
||||
var flowState = FlowState.WithEnterUpdateExit();
|
||||
|
||||
if (!graph.states.Any())
|
||||
{
|
||||
flowState.isStart = true;
|
||||
flowState.nest.embed.title = "Start";
|
||||
}
|
||||
|
||||
AddState(flowState, position);
|
||||
}
|
||||
|
||||
private void CreateSuperState(Vector2 position)
|
||||
{
|
||||
var superState = SuperState.WithStart();
|
||||
|
||||
if (!graph.states.Any())
|
||||
{
|
||||
superState.isStart = true;
|
||||
superState.nest.embed.title = "Start";
|
||||
}
|
||||
|
||||
AddState(superState, position);
|
||||
}
|
||||
|
||||
private void CreateAnyState(Vector2 position)
|
||||
{
|
||||
AddState(new AnyState(), position);
|
||||
}
|
||||
|
||||
private void NewSticky(Vector2 position)
|
||||
{
|
||||
var stickyNote = new StickyNote() { position = new Rect(position, new Vector2(100, 100)) };
|
||||
graph.elements.Add(stickyNote);
|
||||
selection.Select(stickyNote);
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
public void AddState(IState state, Vector2 position)
|
||||
{
|
||||
UndoUtility.RecordEditedObject("Create State");
|
||||
state.position = position;
|
||||
graph.states.Add(state);
|
||||
state.position -= this.Widget(state).position.size / 2;
|
||||
state.position = state.position.PixelPerfect();
|
||||
this.Widget(state).Reposition();
|
||||
selection.Select(state);
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Lifecycle
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
base.Close();
|
||||
|
||||
CancelTransition();
|
||||
}
|
||||
|
||||
protected override void HandleHighPriorityInput()
|
||||
{
|
||||
if (isCreatingTransition)
|
||||
{
|
||||
if (e.IsMouseDrag(MouseButton.Left))
|
||||
{
|
||||
// Priority over lasso
|
||||
e.Use();
|
||||
}
|
||||
else if (e.IsKeyDown(KeyCode.Escape))
|
||||
{
|
||||
CancelTransition();
|
||||
e.Use();
|
||||
}
|
||||
if (e.IsMouseDown(MouseButton.Left) || e.IsMouseUp(MouseButton.Left))
|
||||
{
|
||||
CompleteTransitionToNewState();
|
||||
e.Use();
|
||||
}
|
||||
}
|
||||
|
||||
base.HandleHighPriorityInput();
|
||||
}
|
||||
|
||||
public void CompleteTransitionToNewState()
|
||||
{
|
||||
var startRect = this.Widget(transitionSource).position;
|
||||
var end = mousePosition;
|
||||
|
||||
GraphGUI.GetConnectionEdge
|
||||
(
|
||||
startRect.center,
|
||||
end,
|
||||
out var startEdge,
|
||||
out var endEdge
|
||||
);
|
||||
|
||||
var destination = FlowState.WithEnterUpdateExit();
|
||||
graph.states.Add(destination);
|
||||
|
||||
Vector2 offset;
|
||||
|
||||
var size = this.Widget(destination).position.size;
|
||||
|
||||
switch (endEdge)
|
||||
{
|
||||
case Edge.Left:
|
||||
offset = new Vector2(0, -size.y / 2);
|
||||
break;
|
||||
case Edge.Right:
|
||||
offset = new Vector2(-size.x, -size.y / 2);
|
||||
break;
|
||||
case Edge.Top:
|
||||
offset = new Vector2(-size.x / 2, 0);
|
||||
break;
|
||||
case Edge.Bottom:
|
||||
offset = new Vector2(-size.x / 2, -size.y);
|
||||
break;
|
||||
default:
|
||||
throw new UnexpectedEnumValueException<Edge>(endEdge);
|
||||
}
|
||||
|
||||
destination.position = mousePosition + offset;
|
||||
|
||||
destination.position = destination.position.PixelPerfect();
|
||||
|
||||
EndTransition(destination);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Drag & Drop
|
||||
|
||||
public override bool AcceptsDragAndDrop()
|
||||
{
|
||||
return DragAndDropUtility.Is<ScriptGraphAsset>() || DragAndDropUtility.Is<StateGraphAsset>();
|
||||
}
|
||||
|
||||
public override void PerformDragAndDrop()
|
||||
{
|
||||
if (DragAndDropUtility.Is<ScriptGraphAsset>())
|
||||
{
|
||||
var flowMacro = DragAndDropUtility.Get<ScriptGraphAsset>();
|
||||
var flowState = new FlowState(flowMacro);
|
||||
AddState(flowState, DragAndDropUtility.position);
|
||||
}
|
||||
else if (DragAndDropUtility.Is<StateGraphAsset>())
|
||||
{
|
||||
var asset = DragAndDropUtility.Get<StateGraphAsset>();
|
||||
var superState = new SuperState(asset);
|
||||
AddState(superState, DragAndDropUtility.position);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawDragAndDropPreview()
|
||||
{
|
||||
if (DragAndDropUtility.Is<ScriptGraphAsset>())
|
||||
{
|
||||
GraphGUI.DrawDragAndDropPreviewLabel(DragAndDropUtility.offsetedPosition, DragAndDropUtility.Get<ScriptGraphAsset>().name, typeof(ScriptGraphAsset).Icon());
|
||||
}
|
||||
else if (DragAndDropUtility.Is<StateGraphAsset>())
|
||||
{
|
||||
GraphGUI.DrawDragAndDropPreviewLabel(DragAndDropUtility.offsetedPosition, DragAndDropUtility.Get<StateGraphAsset>().name, typeof(StateGraphAsset).Icon());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Transition Creation
|
||||
|
||||
public IState transitionSource { get; set; }
|
||||
|
||||
public bool isCreatingTransition => transitionSource != null;
|
||||
|
||||
public void StartTransition(IState source)
|
||||
{
|
||||
transitionSource = source;
|
||||
window.Focus();
|
||||
}
|
||||
|
||||
public void EndTransition(IState destination)
|
||||
{
|
||||
UndoUtility.RecordEditedObject("Create State Transition");
|
||||
|
||||
var transition = FlowStateTransition.WithDefaultTrigger(transitionSource, destination);
|
||||
graph.transitions.Add(transition);
|
||||
transitionSource = null;
|
||||
this.Widget(transition).BringToFront();
|
||||
selection.Select(transition);
|
||||
GUI.changed = true;
|
||||
}
|
||||
|
||||
public void CancelTransition()
|
||||
{
|
||||
transitionSource = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0423634313e0049ed831dc5e3c8c0589
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[GraphContext(typeof(StateGraph))]
|
||||
public class StateGraphContext : GraphContext<StateGraph, StateCanvas>
|
||||
{
|
||||
public StateGraphContext(GraphReference reference) : base(reference) { }
|
||||
|
||||
public override string windowTitle => "State Graph";
|
||||
|
||||
protected override IEnumerable<ISidebarPanelContent> SidebarPanels()
|
||||
{
|
||||
yield return new GraphInspectorPanel(this);
|
||||
yield return new VariablesPanel(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85de3188858c04b94957f45995108f1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf692785fed1a4d2c826ba2f5509edff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,39 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(ID)]
|
||||
[PluginDependency(BoltCore.ID)]
|
||||
[Product(BoltProduct.ID)]
|
||||
[PluginRuntimeAssembly("Unity." + ID)]
|
||||
public sealed class BoltState : Plugin
|
||||
{
|
||||
[RenamedFrom("Bolt.State")]
|
||||
public const string ID = "VisualScripting.State";
|
||||
|
||||
public BoltState() : base()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static BoltState instance { get; private set; }
|
||||
|
||||
public static BoltStateManifest Manifest => (BoltStateManifest)instance?.manifest;
|
||||
public static BoltStateConfiguration Configuration => (BoltStateConfiguration)instance?.configuration;
|
||||
public static BoltStateResources Resources => (BoltStateResources)instance?.resources;
|
||||
public static BoltStateResources.Icons Icons => Resources?.icons;
|
||||
public const string LegacyRuntimeDllGuid = "dcd2196c4e9166f499793f2007fcda35";
|
||||
public const string LegacyEditorDllGuid = "25cf173c22a896d44ae550407b10ed98";
|
||||
|
||||
public override IEnumerable<ScriptReferenceReplacement> scriptReferenceReplacements
|
||||
{
|
||||
get
|
||||
{
|
||||
#pragma warning disable 618
|
||||
yield return ScriptReferenceReplacement.From<StateMachine>(ScriptReference.Dll(LegacyRuntimeDllGuid, "Bolt", "StateMachine"));
|
||||
yield return ScriptReferenceReplacement.From<StateGraphAsset>(ScriptReference.Dll(LegacyRuntimeDllGuid, "Bolt", "StateMacro"));
|
||||
#pragma warning restore 618
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f920ee4f22d664b36925352e3b321895
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,35 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
public sealed class BoltStateConfiguration : PluginConfiguration
|
||||
{
|
||||
private BoltStateConfiguration(BoltState plugin) : base(plugin) { }
|
||||
|
||||
public override string header => "State Graphs";
|
||||
|
||||
/// <summary>
|
||||
/// Determines under which condition events should be shown in state nodes.
|
||||
/// </summary>
|
||||
[EditorPref]
|
||||
public StateRevealCondition statesReveal { get; set; } = StateRevealCondition.Always;
|
||||
|
||||
/// <summary>
|
||||
/// Determines under which condition event names should be shown in state transition.
|
||||
/// </summary>
|
||||
[EditorPref]
|
||||
public StateRevealCondition transitionsReveal { get; set; } = StateRevealCondition.OnHoverWithAlt;
|
||||
|
||||
/// <summary>
|
||||
/// Whether state transitions should show an arrow at their destination state. This can appear confusing when there are
|
||||
/// multiple transitions.
|
||||
/// </summary>
|
||||
[EditorPref]
|
||||
public bool transitionsEndArrow { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether traversed transitions should show a droplet animation.
|
||||
/// </summary>
|
||||
[EditorPref]
|
||||
public bool animateTransitions { get; set; } = true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dad6936c226ce49b9a651479afeb690b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,13 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
public sealed class BoltStateManifest : PluginManifest
|
||||
{
|
||||
private BoltStateManifest(BoltState plugin) : base(plugin) { }
|
||||
|
||||
public override string name => "Visual Scripting State";
|
||||
public override string author => "";
|
||||
public override string description => "State-machine based visual scripting.";
|
||||
public override SemanticVersion version => PackageVersionUtility.version;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68a1715d9bf874bd7ae73ff9648bea1b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,36 @@
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
public sealed class BoltStateResources : PluginResources
|
||||
{
|
||||
private BoltStateResources(BoltState plugin) : base(plugin)
|
||||
{
|
||||
icons = new Icons(this);
|
||||
}
|
||||
|
||||
public Icons icons { get; private set; }
|
||||
|
||||
public override void LateInitialize()
|
||||
{
|
||||
icons.Load();
|
||||
}
|
||||
|
||||
public class Icons
|
||||
{
|
||||
public Icons(BoltStateResources resources)
|
||||
{
|
||||
this.resources = resources;
|
||||
}
|
||||
|
||||
private readonly BoltStateResources resources;
|
||||
public EditorTexture graph { get; private set; }
|
||||
public EditorTexture state { get; private set; }
|
||||
|
||||
public void Load()
|
||||
{
|
||||
graph = typeof(StateGraph).Icon();
|
||||
state = typeof(State).Icon();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84e6afc294cf242f7b5b66254c763183
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac1f64ab829894a92a9a4727bbee1721
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_0_0 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_0_0(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override string description => "Initial Release";
|
||||
public override SemanticVersion version => "1.0.0";
|
||||
public override DateTime date => new DateTime(2017, 07, 26);
|
||||
public override IEnumerable<string> changes => Enumerable.Empty<string>();
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ce3ec6fc91e046a4a8911343aa505c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_0_1 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_0_1(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override SemanticVersion version => "1.0.1";
|
||||
public override DateTime date => new DateTime(2017, 08, 01);
|
||||
|
||||
public override IEnumerable<string> changes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "[Fixed] State header icon size on retina displays";
|
||||
yield return "[Fixed] Pasting into state transition";
|
||||
yield return "[Fixed] Transition events not being triggered from state entry";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcc6f0c1385114ccf94f9a7112c95d79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_0_2 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_0_2(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override SemanticVersion version => "1.0.2";
|
||||
public override DateTime date => new DateTime(2017, 09, 08);
|
||||
|
||||
public override IEnumerable<string> changes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "[Fixed] Order-of-operations issues with transitions and updates";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32396d7cafec147a8b62dce93b2c8f33
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_1_1 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_1_1(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override SemanticVersion version => "1.1.1";
|
||||
public override DateTime date => new DateTime(2017, 10, 10);
|
||||
|
||||
public override IEnumerable<string> changes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "[Changed] Default transitions to not include Update event anymore";
|
||||
yield return "[Fixed] Inactive states sometimes updating";
|
||||
yield return "[Optimized] Editor recursion performance";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bae4d3962b184e788831cefda9e20bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_1_2 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_1_2(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override SemanticVersion version => "1.1.2";
|
||||
public override DateTime date => new DateTime(2017, 10, 16);
|
||||
|
||||
public override IEnumerable<string> changes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "[Fixed] Issue with dragging";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b59c9165726434ecc96fc359de597099
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_1_3 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_1_3(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override SemanticVersion version => "1.1.3";
|
||||
public override DateTime date => new DateTime(2017, 10, 30);
|
||||
|
||||
public override IEnumerable<string> changes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "[Fixed] Deserialization error due to nester owner being serialized";
|
||||
yield return "[Fixed] Descriptor error with nested events";
|
||||
yield return "[Fixed] Event listening state being serialized";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 216a0cbaede884a7785cb137b90301b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
[Plugin(BoltState.ID)]
|
||||
internal class Changelog_1_2_2 : PluginChangelog
|
||||
{
|
||||
public Changelog_1_2_2(Plugin plugin) : base(plugin) { }
|
||||
|
||||
public override SemanticVersion version => "1.2.2";
|
||||
public override DateTime date => new DateTime(2017, 12, 04);
|
||||
|
||||
public override IEnumerable<string> changes
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "[Added] Any State";
|
||||
yield return "[Added] Droplet animations for transitions";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9da5e47993cc143868fbaceb76639261
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user