Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## [0.6.4-beta] - Aug 12, 2024
- Fix for rogue tilda
- Added relay states

## [0.6.3-beta] - Aug 10, 2024
- Added Counter State
- Fix: When scenes with multiple StateMachineControllers load the selected controller and the first controller in the scene were both loaded into the same StateMachineEditor
Expand Down
70 changes: 70 additions & 0 deletions Editor/Resources/RelayNodeView.uss
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.node #title {
flex-direction: row;
height: 19px;
}

.node Port {
height: 19px;
padding-top:0px;
}

.port.input {
background-color: #555555;
}

.port.output {
background-color: #777777;
}

.port.input #connector {
border-left-color: white;
}

.node #title-label {
font-size: 14px;
margin-left: 0px;
margin-right: 0px;
flex-grow: 1;
-unity-text-align: middle-center;
-unity-font-style: Bold;
}

.node #title-container {
margin-top: 0px;
margin-bottom: 0px;
flex-direction: row;
}

.node #title-button-container {
visibility: hidden;
width:0;
height:0;
}

.node #state-border {
position: absolute;
right: 0;
left: 0;
top: 0;
bottom: 0;
border-color: green;
border-width: 2px;
border-radius: 8px;
opacity:0;
margin:1px;
}

Port {
height: 100%;
width: 25px;
min-width: 25px;
padding-top:8px;
}

Port Label {
display: none;
}

.node #contents {
display: none;
}
3 changes: 3 additions & 0 deletions Editor/Resources/RelayNodeView.uss.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Editor/StateGraph/Factories/StateGraphNodeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class StateGraphNodeFactory
{typeof(JumpInState), typeof(JumpNodeView)},
{typeof(JumpOutState), typeof(JumpNodeView)},
{typeof(DelayState), typeof(DelayNodeView)},
{typeof(RelayState), typeof(RelayNodeView)},
{typeof(CounterState), typeof(CounterNodeView)},
{typeof(DelayUnscaledState), typeof(DelayNodeView)},
{typeof(SubStateMachineState), typeof(SubStateNodeView)},
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/BaseStateNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ protected virtual void AddEditButton()
if(!NodeModel?.State) return;

var stateNamespace = NodeModel.State.GetType().Namespace;
if (stateNamespace == "Nonatomic.VSM2.StateGraph.States") return;
if (stateNamespace == "Nonatomic.VSM2.StateGraph.States~") return;

var editButton = new Button(HandleEditButton)
{
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/CounterNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public CounterNodeView(GraphView graphView,

_counterState = (BaseCounterState) nodeModel.State;

AddStyle("CounterNodeView");
AddStyle(nameof(CounterNodeView));
AddTitleContainer();
ColorizeTitle();
RemoveTitleLabel();
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/DelayNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public DelayNodeView(GraphView graphView,
: base(graphView, stateMachineModel, nodeModel)
{

AddStyle("DelayNodeView");
AddStyle(nameof(DelayNodeView));
AddTitleContainer();
ColorizeTitle();
RemoveTitleLabel();
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/EntryNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public EntryNodeView(GraphView graphView,
: base(graphView, stateMachineModel, nodeModel)
{

AddStyle("EntryNodeView");
AddStyle(nameof(EntryNodeView));
AddTitleContainer();
ColorizeTitle();
AddTitleLabel();
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/ExitNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public ExitNodeView(GraphView graphView,
StateNodeModel nodeModel)
: base(graphView, stateMachineModel, nodeModel)
{
AddStyle("ExitNodeView");
AddStyle(nameof(ExitNodeView));
AddTitleContainer();
ColorizeTitle();
AddTitleLabel();
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/JumpNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public JumpNodeView(GraphView graphView,
{
_jumpState = NodeModel.State as JumpState;

AddStyle("JumpNodeView");
AddStyle(nameof(JumpNodeView));
AddToClassList(NodeModel.State is JumpOutState ? "jump-out" : "jump-in");
AddBeacon(_jumpState);
AddTitleContainer();
Expand Down
28 changes: 28 additions & 0 deletions Editor/StateGraph/Nodes/RelayNodeView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Nonatomic.VSM2.StateGraph;
using UnityEditor.Experimental.GraphView;

namespace Nonatomic.VSM2.Editor.StateGraph.Nodes
{
public class RelayNodeView : BaseStateNodeView
{
public RelayNodeView(GraphView graphView,
StateMachineModel stateMachineModel,
StateNodeModel nodeModel)
: base(graphView, stateMachineModel, nodeModel)
{
AddStyle(nameof(RelayNodeView));
AddTitleContainer();
ColorizeTitle();
RemoveTitleLabel();
AddGlowBorder();
AddInputPorts(TitleContainer);
AddOutputPorts(TitleContainer);
UpdatePosition();
}

public override void Update()
{
UpdateGlowBorder();
}
}
}
3 changes: 3 additions & 0 deletions Editor/StateGraph/Nodes/RelayNodeView.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/StateNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public StateNodeView(GraphView graphView,

var contents = this.Query<VisualElement>("contents").First();

AddStyle("StateNodeView");
AddStyle(nameof(StateNodeView));
AddTitleContainer();
ColorizeTitle();
AddTitleLabel();
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/StickyNoteNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public StickyNoteNodeView(GraphView graphView, StateMachineModel stateMachineMod
{
var contents = this.Query<VisualElement>("contents").First();

AddStyle("StickyNoteNodeView");
AddStyle(nameof(StickyNoteNodeView));
AddTitleContainer();
ColorizeTitle();
AddTitleLabel("Note");
Expand Down
2 changes: 1 addition & 1 deletion Editor/StateGraph/Nodes/SubStateNodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public SubStateNodeView(GraphView graphView,
StateNodeModel nodeModel)
: base(graphView, stateMachineModel, nodeModel)
{
AddStyle("SubStateNodeView");
AddStyle(nameof(SubStateNodeView));
AddTitleContainer();
ColorizeTitle();
AddTitleLabel();
Expand Down
9 changes: 7 additions & 2 deletions Runtime/StateGraph/States.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Runtime/StateGraph/States/CounterState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Nonatomic.VSM2.StateGraph.States
{
/**
* Remember that States are derived from ScriptableObject so
* Remember that States~ are derived from ScriptableObject so
* it's important to flag that the Count value should not be
* serialized, although we reset the value on awake any way.
*/
Expand Down
22 changes: 22 additions & 0 deletions Runtime/StateGraph/States/RelayState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using Nonatomic.VSM2.NodeGraph;
using Nonatomic.VSM2.StateGraph.Attributes;

namespace Nonatomic.VSM2.StateGraph.States
{
[NodeColor(NodeColor.Blue)]
public class RelayState : State
{
[Transition(frameDelay:0)] public event Action OnComplete;

public override void OnEnterState()
{
OnComplete?.Invoke();
}

public override void OnExitState()
{
//...
}
}
}
3 changes: 3 additions & 0 deletions Runtime/StateGraph/States/RelayState.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Samples~/Animation/Content/StateMachines/AnimationState.asset
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ MonoBehaviour:
OriginPort:
Id: OnEntry
Index: 0
FrameDelay: 1
FrameDelay: 0
PortLabel:
PortColor: '#116f1c'
DestinationPort:
Expand All @@ -377,7 +377,7 @@ MonoBehaviour:
OriginPort:
Id: OnExit
Index: 0
FrameDelay: 1
FrameDelay: 0
PortLabel:
PortColor: '#B06101'
DestinationPort:
Expand Down Expand Up @@ -405,7 +405,7 @@ MonoBehaviour:
OriginPort:
Id: OnExit
Index: 0
FrameDelay: 1
FrameDelay: 0
PortLabel:
PortColor: '#B06101'
DestinationPort:
Expand Down Expand Up @@ -475,7 +475,7 @@ MonoBehaviour:
OriginPort:
Id: OnExit
Index: 0
FrameDelay: 1
FrameDelay: 0
PortLabel:
PortColor: '#B06101'
DestinationPort:
Expand All @@ -489,7 +489,7 @@ MonoBehaviour:
OriginPort:
Id: OnExit
Index: 0
FrameDelay: 1
FrameDelay: 0
PortLabel:
PortColor: '#B06101'
DestinationPort:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.nonatomic.visualstatemachinev2",
"version": "0.6.3-beta",
"version": "0.6.4-beta",
"displayName": "Visual State Machine V2",
"description": "Visual State Machine V2",
"unity": "2022.3",
Expand Down