Skip to content

Commit

Permalink
Merge pull request #83 from SideQuestVR/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mikeskydev authored Dec 19, 2024
2 parents c91817b + 0a08ad0 commit 40527f0
Show file tree
Hide file tree
Showing 157 changed files with 11,890 additions and 43 deletions.
38 changes: 22 additions & 16 deletions Editor/Scripts/VisualScripting/ValidateVisualScripting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ static void Init()

private static List<string> GetElementsFromIGraph(GraphReference reference, IGraph graph)
{
var output = new List<string>();
var output = new List<string>();
if (graph == null || graph.elements.Count == 0)
{
return output;
}

foreach (var e in graph.elements)
{
// no analytics identifier implemented, but they're harmless
if (e is StickyNote || e is GraphGroup)
{
continue;
}

output.Add(e.GetAnalyticsIdentifier()?.Identifier?.Split('(')[0].Trim());
}
return output;
Expand Down Expand Up @@ -98,6 +104,13 @@ private static List<string> GetElementsFromStateGraph(GraphReference reference,
private static List<string> GrabElements(IGraphElement e,GraphReference reference)
{
var output = new List<string>();

// no analytics identifier implemented, but they're harmless
if (e is StickyNote || e is GraphGroup)
{
return output;
}

if (e is StateUnit)
{
if ((((StateUnit)e).nest?.source == GraphSource.Embed && ((StateUnit)e).nest?.graph?.elements.Count() > 0) || ((StateUnit)e).nest?.source == GraphSource.Macro)
Expand All @@ -117,28 +130,15 @@ private static List<string> GrabElements(IGraphElement e,GraphReference referenc
try
{
output.Add(e.GetAnalyticsIdentifier()?.Identifier?.Split('(')[0].Trim());
} catch (Exception ex)
}
catch (Exception ex)
{
Debug.Log($"Could not add element {e?.guid} {reference?.graph?.title} because of {ex}");
}
}
return output;
}

private static bool IsIgnoredElement(IGraphElement graphElement)
{
switch (graphElement.GetType().ToString())
{
case "Bolt.ControlConnection":
case "Bolt.ValueConnection":
case "Unity.VisualScripting.ControlConnection":
case "Unity.VisualScripting.ValueConnection":
return true;
}

return false;
}

private static string CleanString(string keyword)
{
return keyword.ToLowerInvariant().Replace(" ", "").Replace(".", "");
Expand All @@ -153,6 +153,12 @@ private static List<string> FindNodesFromScriptGraphAssetGuid(string guid)
{
foreach (var e in sga.graph.elements)
{
// no analytics identifier implemented, but they're harmless
if (e is StickyNote || e is GraphGroup)
{
continue;
}

output.Add(e.GetAnalyticsIdentifier()?.Identifier?.Split('(')[0].Trim());
}
}
Expand Down
7 changes: 4 additions & 3 deletions Editor/Scripts/VisualScripting/VsNodeGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ private static string SetJSONArrayValueHelper(this string target, string arrayCo
typeof(byte),
typeof(string),
typeof(char),
typeof(TimeSpan),
typeof(Vector2),
typeof(Vector3),
typeof(Vector4),
Expand All @@ -181,9 +180,8 @@ private static string SetJSONArrayValueHelper(this string target, string arrayCo
typeof(Exception),
typeof(Time),
typeof(DateTime),
typeof(TimeSpan),
typeof(UnityEngine.Random),
typeof(Physics),
typeof(Physics2D),

// UI
typeof(UnityEngine.UI.CanvasScaler),
Expand Down Expand Up @@ -238,6 +236,9 @@ private static string SetJSONArrayValueHelper(this string target, string arrayCo
typeof(UnityEngine.UIElements.ListView),

// Physics

typeof(Physics),
typeof(Physics2D),
typeof(Joint),
typeof(JointLimits),
typeof(JointMotor),
Expand Down
2 changes: 2 additions & 0 deletions Editor/Scripts/VisualScripting/VsStubsAllowed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public struct VsStubsAllowed
"System.DateTime.GetDateTimeFormats",
"System.DateTime.GetTypeCode",
"System.DateTime.ReferenceEquals",
"System.DateTime..ctor",
"System.DateTime.Date",
"System.DateTime.Day",
"System.DateTime.DayOfWeek",
Expand Down Expand Up @@ -237,6 +238,7 @@ public struct VsStubsAllowed
"System.TimeSpan.ParseExact",
"System.TimeSpan.ToString",
"System.TimeSpan.ReferenceEquals",
"System.TimeSpan..ctor",
"System.TimeSpan.Ticks",
"System.TimeSpan.Days",
"System.TimeSpan.Hours",
Expand Down
Loading

0 comments on commit 40527f0

Please sign in to comment.