From a8c34e3113391332f1cc0a2b092c2246fab46aab Mon Sep 17 00:00:00 2001 From: Sarafini Date: Sun, 4 Feb 2024 19:45:19 -0700 Subject: [PATCH] Fix skeleton crash on shutdown, add Touch action to Inventory Console for worn items --- .../Core/Contexts/ContextActionsManager.cs | 2 +- .../Consoles/Inventory/InventoryConsole.cs | 20 +++++++++++++++++++ Radegast/GUI/Rendering/Rendering.cs | 9 ++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/Radegast/Core/Contexts/ContextActionsManager.cs b/Radegast/Core/Contexts/ContextActionsManager.cs index 193b9002..bd5b6e7b 100644 --- a/Radegast/Core/Contexts/ContextActionsManager.cs +++ b/Radegast/Core/Contexts/ContextActionsManager.cs @@ -211,7 +211,7 @@ private string ToString(object sender) /// /// The form's menu /// The type it will target - /// the Target ofbject + /// the Target object /// Control to search for extra contributions (like buttons) public void GleanContributions(ToolStripDropDown strip, Type type, Object obj, params Control[] controls) { diff --git a/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs b/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs index f57df73d..0ed7f36d 100644 --- a/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs +++ b/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs @@ -1529,6 +1529,14 @@ private void ctxInv_Opening(object sender, CancelEventArgs e) } ctxInv.Items.Add(ctxItem); + if (item.InventoryType == InventoryType.Object && IsAttached(item)) + { + ctxItem = new ToolStripMenuItem("Touch", null, OnInvContextClick) { Name = "touch" }; + //TODO: add RLV support + if ((attachments[item.UUID].Prim.Flags & PrimFlags.Touch) == 0) ctxItem.Enabled = false; + ctxInv.Items.Add(ctxItem); + } + if (IsAttached(item) && instance.RLV.AllowDetach(attachments[item.UUID])) { ctxItem = @@ -1839,6 +1847,18 @@ private void OnInvContextClick(object sender, EventArgs e) invTree.SelectedNode.BeginEdit(); break; + case "touch": + lock (attachments[item.UUID]) + { + AttachmentInfo aInfo = attachments[item.UUID]; + Client.Self.Grab(aInfo.Prim.LocalID, Vector3.Zero, Vector3.Zero, Vector3.Zero, 0, + Vector3.Zero, Vector3.Zero, Vector3.Zero); + Thread.Sleep(100); + Client.Self.DeGrab(aInfo.Prim.LocalID, Vector3.Zero, Vector3.Zero, 0, Vector3.Zero, + Vector3.Zero, Vector3.Zero); + } + break; + case "detach": instance.COF.Detach(item); lock (attachments) attachments.Remove(item.UUID); diff --git a/Radegast/GUI/Rendering/Rendering.cs b/Radegast/GUI/Rendering/Rendering.cs index d4cdee22..25c978a2 100644 --- a/Radegast/GUI/Rendering/Rendering.cs +++ b/Radegast/GUI/Rendering/Rendering.cs @@ -1668,7 +1668,14 @@ private void UpdateAvatarAnimations(RenderAvatar av) BinBVHAnimationReader bvh; if (skeleton.mAnimationCache.TryGetValue(anim.AnimationID, out bvh)) { - skeleton.addanimation(null, tid, bvh, anim.AnimationID); + try + { + skeleton.addanimation(null, tid, bvh, anim.AnimationID); + } + catch (Exception ex) + { + Logger.Log($"Failure in skel.addanimation: {ex.Message}", Helpers.LogLevel.Error); + } continue; }