Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy to clipboard member action in inspectors #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 3 additions & 4 deletions CommunityBugFixCollection/CommunityBugFixCollection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MonkeyLoader" Version="0.24.1-beta" />
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.21.2-beta" />
<PackageReference Include="MonkeyLoader.GamePacks.Resonite" Version="0.22.0-beta" />
<PackageReference Include="PolySharp" Version="1.15.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Resonite.Elements.Assets" Version="1.2.3" />
<PackageReference Include="Resonite.Elements.Core" Version="1.4.3" />
<PackageReference Include="Resonite.Elements.Quantity" Version="1.2.3" />
<PackageReference Include="Resonite.FrooxEngine" Version="2025.1.12.1412" />
<PackageReference Include="Resonite.FrooxEngine" Version="2025.1.17.6" />
<PackageReference Include="Resonite.FrooxEngine.Store" Version="1.0.3" />
<PackageReference Include="Resonite.ProtoFluxBindings" Version="2025.3.9.1412" />
<PackageReference Include="Resonite.ProtoFluxBindings" Version="2025.3.14.7" />
<PackageReference Include="Resonite.SkyFrost.Base" Version="2.1.0" />
<PackageReference Include="Resonite.SkyFrost.Base.Models" Version="2.1.0" />
</ItemGroup>
Expand Down
35 changes: 35 additions & 0 deletions CommunityBugFixCollection/CopySyncMemberToClipboardAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using FrooxEngine;
using MonkeyLoader.Resonite;
using MonkeyLoader.Resonite.UI.Inspectors;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace CommunityBugFixCollection
{
internal sealed class CopySyncMemberToClipboardAction
: ResoniteAsyncEventHandlerMonkey<CopySyncMemberToClipboardAction, InspectorMemberActionsMenuItemsGenerationEvent>
{
public override int Priority => HarmonyLib.Priority.Normal;

protected override bool AppliesTo(InspectorMemberActionsMenuItemsGenerationEvent eventData)
=> base.AppliesTo(eventData) && eventData.Target is IField && eventData.Target is not ISyncRef;

protected override Task Handle(InspectorMemberActionsMenuItemsGenerationEvent eventData)
{
var field = (IField)eventData.Target;
var menuItem = eventData.ContextMenu.AddItem(Mod.GetLocaleString("CopyToClipboard"),
OfficialAssets.Graphics.Icons.General.Duplicate, RadiantUI_Constants.Sub.GREEN);

// Context Menu is local user only anyways, no need to use local action button
menuItem.Button.LocalPressed += (button, _) =>
{
button.World.InputInterface.Clipboard.SetText(field.BoxedValue.ToString());
button.World.LocalUser.CloseContextMenu(eventData.MemberActions);
};

return Task.CompletedTask;
}
}
}
4 changes: 3 additions & 1 deletion CommunityBugFixCollection/Locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"authors": [ "Banane9" ],
"messages": {
"CommunityBugFixCollection.Name": "Community Bug-Fix Sammlung",
"CommunityBugFixCollection.Description": "Diese Mod enthällt Fixes für verschiedene kleine Resonite Issues die noch offen sind."
"CommunityBugFixCollection.Description": "Diese Mod enthällt Fixes für verschiedene kleine Resonite Issues die noch offen sind.",

"CommunityBugFixCollection.CopyToClipboard": "In Zwischenablage kopieren"
}
}
2 changes: 2 additions & 0 deletions CommunityBugFixCollection/Locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"CommunityBugFixCollection.Name": "Community Bug-Fix Collection",
"CommunityBugFixCollection.Description": "This mod contains fixes for various small Resonite Issues that are still open.",

"CommunityBugFixCollection.CopyToClipboard": "Copy to Clipboard",

"CommunityBugFixCollection.NoZeroScaleToolRaycast": "Fixes Resonite Issue #98: World crashes when a (multi)tool is scaled to zero."
}
}
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ The issues that have workarounds in this mod will be linked in the following lis
If any of them have been closed and not removed from the mod,
just disable them in the settings in the meantime.

* Sliders and Joints snapping in sessions hosted by a headless (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/399)
* Sliders and Joints snapping in sessions hosted by a headless (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/399)


## Features

The feature request issues that have been implemented in this mod will be linked in the following list.
If any of them have been implemented and not removed from the mod,
just disable them in the settings in the meantime.

* _Copy to Clipboard_ action on any non-reference member fields in Inspectors (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/810)
Loading