diff --git a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs
index bb4bc724d..f96ac8e4b 100644
--- a/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs
+++ b/Source/Editor/Surface/Archetypes/Animation.StateMachine.cs
@@ -482,7 +482,7 @@ namespace FlaxEditor.Surface.Archetypes
var startPos = PointToParent(ref center);
targetState.GetConnectionEndPoint(ref startPos, out var endPos);
var color = style.Foreground;
- StateMachineState.DrawConnection(ref startPos, ref endPos, ref color);
+ SurfaceStyle.DrawStraightConnection(startPos, endPos, color);
}
}
@@ -512,7 +512,7 @@ namespace FlaxEditor.Surface.Archetypes
///
public void DrawConnectingLine(ref Float2 startPos, ref Float2 endPos, ref Color color)
{
- StateMachineState.DrawConnection(ref startPos, ref endPos, ref color);
+ SurfaceStyle.DrawStraightConnection(startPos, endPos, color);
}
///
@@ -676,38 +676,6 @@ namespace FlaxEditor.Surface.Archetypes
{
}
- ///
- /// Draws the connection between two state machine nodes.
- ///
- /// The start position.
- /// The end position.
- /// The line color.
- public static void DrawConnection(ref Float2 startPos, ref Float2 endPos, ref Color color)
- {
- var sub = endPos - startPos;
- var length = sub.Length;
- if (length > Mathf.Epsilon)
- {
- var dir = sub / length;
- var arrowRect = new Rectangle(0, 0, 16.0f, 16.0f);
- float rotation = Float2.Dot(dir, Float2.UnitY);
- if (endPos.X < startPos.X)
- rotation = 2 - rotation;
- var sprite = Editor.Instance.Icons.VisjectArrowClosed32;
- var arrowTransform =
- Matrix3x3.Translation2D(-6.5f, -8) *
- Matrix3x3.RotationZ(rotation * Mathf.PiOverTwo) *
- Matrix3x3.Translation2D(endPos - dir * 8);
-
- Render2D.PushTransform(ref arrowTransform);
- Render2D.DrawSprite(sprite, arrowRect, color);
- Render2D.PopTransform();
-
- endPos -= dir * 4.0f;
- }
- Render2D.DrawLine(startPos, endPos, color);
- }
-
///
/// Gets the connection end point for the given input position. Puts the end point near the edge of the node bounds.
///
@@ -1308,7 +1276,7 @@ namespace FlaxEditor.Surface.Archetypes
isMouseOver = Float2.DistanceSquared(ref mousePosition, ref point) < 25.0f;
}
var color = isMouseOver ? Color.Wheat : t.LineColor;
- DrawConnection(ref t.StartPos, ref t.EndPos, ref color);
+ SurfaceStyle.DrawStraightConnection(t.StartPos, t.EndPos, color);
}
}
@@ -1337,7 +1305,7 @@ namespace FlaxEditor.Surface.Archetypes
///
public void DrawConnectingLine(ref Float2 startPos, ref Float2 endPos, ref Color color)
{
- DrawConnection(ref startPos, ref endPos, ref color);
+ SurfaceStyle.DrawStraightConnection(startPos, endPos, color);
}
///
diff --git a/Source/Editor/Surface/BehaviorTreeSurface.cs b/Source/Editor/Surface/BehaviorTreeSurface.cs
index 9b201d3f8..760110769 100644
--- a/Source/Editor/Surface/BehaviorTreeSurface.cs
+++ b/Source/Editor/Surface/BehaviorTreeSurface.cs
@@ -31,7 +31,7 @@ namespace FlaxEditor.Surface
var editor = Editor.Instance;
var style = SurfaceStyle.CreateStyleHandler(editor);
style.DrawBox = DrawBox;
- style.DrawConnection = DrawConnection;
+ style.DrawConnection = SurfaceStyle.DrawStraightConnection;
return style;
}
@@ -49,11 +49,6 @@ namespace FlaxEditor.Surface
Render2D.FillRectangle(rect, color);
}
- private static void DrawConnection(Float2 start, Float2 end, Color color, float thickness)
- {
- Archetypes.Animation.StateMachineStateBase.DrawConnection(ref start, ref end, ref color);
- }
-
private void OnActiveContextMenuVisibleChanged(Control activeCM)
{
_nodesCache.Wait();
diff --git a/Source/Editor/Surface/SurfaceStyle.cs b/Source/Editor/Surface/SurfaceStyle.cs
index 2b8e97f62..5a67d6fb2 100644
--- a/Source/Editor/Surface/SurfaceStyle.cs
+++ b/Source/Editor/Surface/SurfaceStyle.cs
@@ -295,5 +295,38 @@ namespace FlaxEditor.Surface
Background = editor.UI.VisjectSurfaceBackground,
};
}
+
+ ///
+ /// Draws a simple straight connection between two locations.
+ ///
+ /// The start position.
+ /// The end position.
+ /// The line color.
+ /// The line thickness.
+ public static void DrawStraightConnection(Float2 startPos, Float2 endPos, Color color, float thickness = 1.0f)
+ {
+ var sub = endPos - startPos;
+ var length = sub.Length;
+ if (length > Mathf.Epsilon)
+ {
+ var dir = sub / length;
+ var arrowRect = new Rectangle(0, 0, 16.0f, 16.0f);
+ float rotation = Float2.Dot(dir, Float2.UnitY);
+ if (endPos.X < startPos.X)
+ rotation = 2 - rotation;
+ var sprite = Editor.Instance.Icons.VisjectArrowClosed32;
+ var arrowTransform =
+ Matrix3x3.Translation2D(-6.5f, -8) *
+ Matrix3x3.RotationZ(rotation * Mathf.PiOverTwo) *
+ Matrix3x3.Translation2D(endPos - dir * 8);
+
+ Render2D.PushTransform(ref arrowTransform);
+ Render2D.DrawSprite(sprite, arrowRect, color);
+ Render2D.PopTransform();
+
+ endPos -= dir * 4.0f;
+ }
+ Render2D.DrawLine(startPos, endPos, color);
+ }
}
}
diff --git a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs
index 3ca7ddfc7..51339d6bc 100644
--- a/Source/Editor/Surface/VisjectSurface.ContextMenu.cs
+++ b/Source/Editor/Surface/VisjectSurface.ContextMenu.cs
@@ -20,8 +20,15 @@ namespace FlaxEditor.Surface
///
/// Utility for easy nodes archetypes generation for Visject Surface based on scripting types.
///
- internal class NodesCache
+ [HideInEditor]
+ public class NodesCache
{
+ ///
+ /// Delegate for scripting types filtering into cache.
+ ///
+ /// The input type to process.
+ /// Node groups cache that can be used for reusing groups for different nodes.
+ /// The cache version number. Can be used to reject any cached data after rebuilt.
public delegate void IterateType(ScriptType scriptType, Dictionary, GroupArchetype> cache, int version);
internal static readonly List Caches = new List(8);
@@ -33,11 +40,18 @@ namespace FlaxEditor.Surface
private VisjectCM _taskContextMenu;
private Dictionary, GroupArchetype> _cache;
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The iterator callback to build node types from Scripting.
public NodesCache(IterateType iterator)
{
_iterator = iterator;
}
+ ///
+ /// Waits for the async caching job to finish.
+ ///
public void Wait()
{
if (_task != null)
@@ -48,6 +62,9 @@ namespace FlaxEditor.Surface
}
}
+ ///
+ /// Clears cache.
+ ///
public void Clear()
{
Wait();
@@ -62,6 +79,10 @@ namespace FlaxEditor.Surface
}
}
+ ///
+ /// Updates the Visject Context Menu to contain current nodes.
+ ///
+ /// The output context menu to setup.
public void Get(VisjectCM contextMenu)
{
Profiler.BeginEvent("Setup Context Menu");
diff --git a/Source/Editor/Surface/VisjectSurfaceWindow.cs b/Source/Editor/Surface/VisjectSurfaceWindow.cs
index cce86d5c0..6a9cba841 100644
--- a/Source/Editor/Surface/VisjectSurfaceWindow.cs
+++ b/Source/Editor/Surface/VisjectSurfaceWindow.cs
@@ -25,7 +25,7 @@ namespace FlaxEditor.Surface
/// The base interface for editor windows that use for content editing.
///
///
- interface IVisjectSurfaceWindow : IVisjectSurfaceOwner
+ public interface IVisjectSurfaceWindow : IVisjectSurfaceOwner
{
///
/// Gets the asset edited by the window.
diff --git a/Source/Editor/Windows/SceneTreeWindow.cs b/Source/Editor/Windows/SceneTreeWindow.cs
index 1eb80c9ea..c5d790a3d 100644
--- a/Source/Editor/Windows/SceneTreeWindow.cs
+++ b/Source/Editor/Windows/SceneTreeWindow.cs
@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
-using System.Linq;
using FlaxEditor.Gizmo;
using FlaxEditor.Content;
using FlaxEditor.GUI.Tree;
@@ -14,7 +13,6 @@ using FlaxEditor.Scripting;
using FlaxEditor.States;
using FlaxEngine;
using FlaxEngine.GUI;
-using static FlaxEditor.GUI.ItemsListContextMenu;
namespace FlaxEditor.Windows
{
@@ -24,8 +22,6 @@ namespace FlaxEditor.Windows
///
public partial class SceneTreeWindow : SceneEditorWindow
{
- public Panel SceneTreePanel => _sceneTreePanel;
-
private TextBox _searchBox;
private Tree _tree;
private Panel _sceneTreePanel;
@@ -37,6 +33,11 @@ namespace FlaxEditor.Windows
private DragScriptItems _dragScriptItems;
private DragHandlers _dragHandlers;
+ ///
+ /// Scene tree panel.
+ ///
+ public Panel SceneTreePanel => _sceneTreePanel;
+
///
/// Initializes a new instance of the class.
///
diff --git a/Source/Engine/Visject/VisjectGraph.h b/Source/Engine/Visject/VisjectGraph.h
index 085c05de0..5054bd54d 100644
--- a/Source/Engine/Visject/VisjectGraph.h
+++ b/Source/Engine/Visject/VisjectGraph.h
@@ -101,7 +101,7 @@ public:
/// Visject graph parameter.
///
///
-API_CLASS() class VisjectGraphParameter : public GraphParameter
+API_CLASS() class FLAXENGINE_API VisjectGraphParameter : public GraphParameter
{
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(VisjectGraphParameter, GraphParameter);
public:
diff --git a/Source/Engine/Visject/VisjectMeta.cpp b/Source/Engine/Visject/VisjectMeta.cpp
index 37631df55..624345813 100644
--- a/Source/Engine/Visject/VisjectMeta.cpp
+++ b/Source/Engine/Visject/VisjectMeta.cpp
@@ -5,10 +5,6 @@
#include "Engine/Serialization/ReadStream.h"
#include "Engine/Serialization/WriteStream.h"
-VisjectMeta::VisjectMeta()
-{
-}
-
bool VisjectMeta::Load(ReadStream* stream, bool loadData)
{
Release();
diff --git a/Source/Engine/Visject/VisjectMeta.h b/Source/Engine/Visject/VisjectMeta.h
index c417b7030..b35add815 100644
--- a/Source/Engine/Visject/VisjectMeta.h
+++ b/Source/Engine/Visject/VisjectMeta.h
@@ -8,7 +8,7 @@
///
/// Visject metadata container
///
-class VisjectMeta
+class FLAXENGINE_API VisjectMeta
{
public:
///
@@ -27,19 +27,6 @@ public:
///
Array> Entries;
-public:
- ///
- /// Initializes a new instance of the class.
- ///
- VisjectMeta();
-
- ///
- /// Finalizes an instance of the class.
- ///
- ~VisjectMeta()
- {
- }
-
public:
///
/// Load from the stream