Skip to content

Commit

Permalink
Release 11.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Release Automat committed Dec 22, 2024
1 parent c951fc9 commit a2843b4
Show file tree
Hide file tree
Showing 28 changed files with 12,466 additions and 962 deletions.
6 changes: 5 additions & 1 deletion Packages/tlp.udonutils/Editor/Tests/TestWithLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
using System.Text.RegularExpressions;
using JetBrains.Annotations;
using NUnit.Framework;
using TLP.UdonUtils.Runtime;
using TLP.UdonUtils.Runtime.Logger;
using TLP.UdonUtils.Runtime.Sources.FrameCount;
using TLP.UdonUtils.Runtime.Sources.Time;
using TLP.UdonUtils.Runtime.Tests.Utils;
using UnityEditor;
using UnityEngine;
Expand Down Expand Up @@ -48,6 +49,9 @@ public virtual void Setup() {
TlpLogger = new GameObject(TlpLogger.ExpectedGameObjectName()).AddComponent<TlpLogger>();
Debug.Log($"Created {TlpLogger.ExpectedGameObjectName()}: {TlpLogger == true}");
TlpLogger.Severity = ELogLevel.Warning;
TlpLogger.TimeSource = new GameObject(nameof(ConstantTime)).AddComponent<ConstantTime>();
TlpLogger.FrameCount = new GameObject(nameof(ConstantFrameCount)).AddComponent<ConstantFrameCount>();
TlpLogger.OnEnable();

UdonTestEnvironment = new UdonTestUtils.UdonTestEnvironment();
LocalPlayer = UdonTestEnvironment.CreatePlayer();
Expand Down
20 changes: 20 additions & 0 deletions Packages/tlp.udonutils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ The used pattern MAJOR.MINOR.PATCH indicates:

All notable changes to this project will be documented in this file.

### [11.1.0] - 2024-12-22

#### 🚀 Features

- *(EditorUtils)* Move ClearLog, add RecompileAll function with hotkey Ctrl+Shift+R
- *(UdonCommon)* Add PlayerDataInfosToReadableString function
- *(Task)* Add TryScheduleTask method to easily schedule a task for execution with the default TaskScheduler

#### 🐛 Bug Fixes

- *(TlpLogger)* Fix whitelisting not working as intended

#### ⚡ Performance

- *(UdonEvent)* Add support to optionally notify listeners in the background for reduced hitching

#### 🧪 Testing

- *(TestWithLogger)* Fix missing time sources

### [11.0.2] - 2024-12-19

#### 🐛 Bug Fixes
Expand Down
40 changes: 37 additions & 3 deletions Packages/tlp.udonutils/Runtime/Common/UdonCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDK3.Persistence;
using VRC.SDKBase;

namespace TLP.UdonUtils.Runtime.Common
Expand Down Expand Up @@ -144,6 +145,7 @@ VRCPlayerApi[] outPlayers
}

public static string UdonTypeNameShort(string udonTypeName) {
if (string.IsNullOrEmpty(udonTypeName)) return "";
string[] productTypeName = udonTypeName.Split('.');
return productTypeName.Length > 0 ? productTypeName[productTypeName.Length - 1] : udonTypeName;
}
Expand Down Expand Up @@ -213,10 +215,11 @@ public static string GetComponentPathInScene(this Component component) {
/// <returns>The path from the scene root to the script provided,
/// returns an empty string if the provided component is invalid</returns>
public static string GetScriptPathInScene(this UdonSharpBehaviour component) {
if (!Utilities.IsValid(component)) return "";
if (!Utilities.IsValid(component)) {
return "";
}

return component.transform.GetPathInScene() + "/" +
UdonTypeNameShort(component.GetUdonTypeName());
return $"{component.transform.GetPathInScene()}/{UdonTypeNameShort(component.GetUdonTypeName())}";
}

/// <param name="t"></param>
Expand All @@ -225,6 +228,7 @@ public static string GetScriptPathInScene(this UdonSharpBehaviour component) {
/// <returns>string in format '[a, b,...,\nc, d]'</returns>
public static string ToReadableString<T>(this T[] t, int elementsPerLine = 0) {
var sb = new StringBuilder("[");

int length = t.LengthSafe();
for (int i = 0; i < length; i++) {
sb.Append(t[i]);
Expand All @@ -243,6 +247,36 @@ public static string ToReadableString<T>(this T[] t, int elementsPerLine = 0) {
return sb.ToString();
}

/// <summary>
/// <see cref="ToReadableString{T}"/>
/// </summary>
/// <param name="t"></param>
/// <param name="elementsPerLine"></param>
/// <returns>[keyA: stateA, keyB: stateB,...,\nkeyC: stateC, ...]</returns>
public static string PlayerDataInfosToReadableString(this PlayerData.Info[] t, int elementsPerLine = 0) {
var sb = new StringBuilder("[");

int length = t.LengthSafe();
for (int i = 0; i < length; i++) {
var info = t[i];
sb.Append(info.Key).Append(": ").Append(info.State);
if (i >= length - 1) {
continue;
}

if (elementsPerLine > 0 && i % elementsPerLine == elementsPerLine - 1) {
sb.Append(",\n");
} else {
sb.Append(", ");
}
}

sb.Append("]");
return sb.ToString();
}



[PublicAPI]
public static DateTimeOffset SecondsToLocalTime(double lastSeenUnixTimeStampInSeconds) {
var dateTimeOffset = DateTimeOffset.FromUnixTimeSeconds((long)lastSeenUnixTimeStampInSeconds);
Expand Down
Loading

0 comments on commit a2843b4

Please sign in to comment.