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
10 changes: 5 additions & 5 deletions ArrayEditing/ArrayEditing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageId>ArrayEditing</PackageId>
<Title>Array Editing</Title>
<Authors>Banane9, Nytra</Authors>
<Version>1.0.1</Version>
<Version>1.1.0</Version>
<Description>Adds proxy list UI for editing arrays in inspectors. Also improves the look of list UI a bit.</Description>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ResoniteModdingGroup/ArrayEditing</PackageProjectUrl>
Expand All @@ -36,16 +36,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MicroUtils.HarmonyAnalyzers" Version="1.3.1">
<PackageReference Include="MicroUtils.HarmonyAnalyzers" Version="1.6.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.21.2-beta" GeneratePathProperty="true" />
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.24.1-beta" GeneratePathProperty="true" />
<PackageReference Include="PolySharp" Version="1.15.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Resonite.Elements.Core" Version="1.4.3" />
<PackageReference Include="Resonite.FrooxEngine" Version="2025.1.17.6" />
<PackageReference Include="Resonite.Elements.Core" Version="1.4.9.4" />
<PackageReference Include="Resonite.FrooxEngine" Version="2025.8.28.607" />
</ItemGroup>
</Project>
27 changes: 22 additions & 5 deletions ArrayEditing/ArrayEditor.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using Elements.Core;
using FrooxEngine.UIX;
using EnumerableToolkit;
using FrooxEngine;
using FrooxEngine.UIX;
using HarmonyLib;
using MonkeyLoader.Patching;
using MonkeyLoader.Resonite;
using MonkeyLoader.Resonite.UI.Inspectors;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using EnumerableToolkit;
using MonkeyLoader.Resonite;
using MonkeyLoader.Resonite.UI.Inspectors;

namespace ArrayEditing
{
Expand Down Expand Up @@ -329,7 +329,7 @@

if (isSyncLinear && SupportsLerp(syncLinearType!))
{
var gradientType = typeof(ValueGradientDriver<>).MakeGenericType(syncLinearType);

Check warning on line 332 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Possible null reference argument for parameter 'typeArguments' in 'Type Type.MakeGenericType(params Type[] typeArguments)'.
var gradient = GetOrAttachComponent(proxySlot, gradientType, out var attachedNew);

list = (ISyncList)gradient.GetSyncMember(nameof(ValueGradientDriver<float>.Points));
Expand All @@ -342,7 +342,7 @@
}
else if (isSyncCurve && SupportsLerp(syncCurveType!))
{
var gradientType = typeof(ValueGradientDriver<>).MakeGenericType(syncCurveType);

Check warning on line 345 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Possible null reference argument for parameter 'typeArguments' in 'Type Type.MakeGenericType(params Type[] typeArguments)'.
var gradient = GetOrAttachComponent(proxySlot, gradientType, out var attachedNew);

list = (ISyncList)gradient.GetSyncMember(nameof(ValueGradientDriver<float>.Points));
Expand Down Expand Up @@ -403,6 +403,23 @@
SyncMemberEditorBuilder.BuildList(list, name, listField, ui);
var listSlot = ui.Current;
listSlot.DestroyWhenLocalUserLeaves();

ClearRefs(listSlot);
list.Changed += (IChangeable change) =>
{
ClearRefs(listSlot);
};
void ClearRefs(Slot listSlot)
{
listSlot.FilterWorldElement()?.World.RunInUpdates(3, () =>
{
if (listSlot.FilterWorldElement() is null) return;
foreach (var refProxySource in listSlot.GetComponentsInChildren<ReferenceProxySource>())
{
refProxySource.Reference.Target = null;

Check warning on line 419 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Cannot convert null literal to non-nullable reference type.
}
});
}
void ArrayDriveCheck(IChangeable changeable)
{
if (((ISyncArray)changeable).IsDriven)
Expand Down Expand Up @@ -472,7 +489,7 @@
{
list = comp.GetSyncMember("Values") as ISyncList;
_skipListChanges = true;
list.World.RunSynchronously(() => _skipListChanges = false);

Check warning on line 492 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Dereference of a possibly null reference.
list.EnsureExactElementCount(array.Count);
for (int i = 0; i < array.Count; i++)
{
Expand All @@ -483,7 +500,7 @@
{
list = comp.GetSyncMember("References") as ISyncList;
_skipListChanges = true;
list.World.RunSynchronously(() => _skipListChanges = false);

Check warning on line 503 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Dereference of a possibly null reference.
list.EnsureExactElementCount(array.Count);
for (int i = 0; i < array.Count; i++)
{
Expand All @@ -494,7 +511,7 @@
{
list = comp.GetSyncMember("Points") as ISyncList;
_skipListChanges = true;
list.World.RunSynchronously(() => _skipListChanges = false);

Check warning on line 514 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Dereference of a possibly null reference.
list.EnsureExactElementCount(array.Count);

var isSyncLinear = TryGetGenericParameters(typeof(SyncLinear<>), array.GetType(), out var syncLinearGenericParameters);
Expand All @@ -513,11 +530,11 @@

if (isSyncLinear && SupportsLerp(syncLinearType!))
{
_setLinearPoint.MakeGenericMethod(syncLinearType).Invoke(null, [elem, array.GetElement(i)]);

Check warning on line 533 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Possible null reference argument for parameter 'typeArguments' in 'MethodInfo MethodInfo.MakeGenericMethod(params Type[] typeArguments)'.
}
else if (isSyncCurve && SupportsLerp(syncCurveType!))
{
_setCurvePoint.MakeGenericMethod(syncCurveType).Invoke(null, [elem, array.GetElement(i)]);

Check warning on line 537 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Possible null reference argument for parameter 'typeArguments' in 'MethodInfo MethodInfo.MakeGenericMethod(params Type[] typeArguments)'.
}
else
{
Expand Down Expand Up @@ -564,6 +581,6 @@
return true;
}

return TryGetGenericParameters(baseType, concreteType.BaseType, out genericParameters);

Check warning on line 584 in ArrayEditing/ArrayEditor.cs

View workflow job for this annotation

GitHub Actions / Build

Possible null reference argument for parameter 'concreteType' in 'bool ArrayEditor.TryGetGenericParameters(Type baseType, Type concreteType, out Sequence<Type>? genericParameters)'.
}
}
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyFileName>$(AssemblyTitle).dll</AssemblyFileName>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -38,6 +38,6 @@
<ResonitePath Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\Resonite\')">C:\Program Files (x86)\Steam\steamapps\common\Resonite</ResonitePath>
<ResonitePath Condition="Exists('$(HOME)/.steam/steam/steamapps/common/Resonite/')">$(HOME)/.steam/steam/steamapps/common/Resonite</ResonitePath>
<ResonitePath Condition="Exists('D:/Files/Games/Resonite/app/')">D:/Files/Games/Resonite/app</ResonitePath>
<ResonitePath Condition="Exists('G:\SteamLibrary\steamapps\common\Resonite\')">G:\SteamLibrary\steamapps\common\Resonite</ResonitePath>
<ResonitePath Condition="Exists('G:\SteamLibrary\steamapps\common\Resonite\')">G:\SteamLibrary\steamapps\common\Resonite</ResonitePath>
</PropertyGroup>
</Project>
Loading