diff --git a/LibreMetaverse.RLV/InventoryMap.cs b/LibreMetaverse.RLV/InventoryMap.cs index d5c72a01..9fbeadf8 100644 --- a/LibreMetaverse.RLV/InventoryMap.cs +++ b/LibreMetaverse.RLV/InventoryMap.cs @@ -426,7 +426,7 @@ namespace LibreMetaverse.RLV { foreach (var item in kvp.Value) { - if (item.WornOn != null || item.AttachedTo != null) + if (item.WornOn != null || item.AttachedTo != null || item.GestureState == RlvGestureState.Active) { foundItems.Add(item); } @@ -435,7 +435,7 @@ namespace LibreMetaverse.RLV foreach (var kvp in ExternalItems) { - if (kvp.Value.WornOn != null || kvp.Value.AttachedTo != null) + if (kvp.Value.WornOn != null || kvp.Value.AttachedTo != null || kvp.Value.GestureState == RlvGestureState.Active) { foundItems.Add(kvp.Value); } diff --git a/LibreMetaverse.RLV/RlvCommandProcessor.cs b/LibreMetaverse.RLV/RlvCommandProcessor.cs index 6dde415b..d55e33e6 100644 --- a/LibreMetaverse.RLV/RlvCommandProcessor.cs +++ b/LibreMetaverse.RLV/RlvCommandProcessor.cs @@ -151,7 +151,7 @@ namespace LibreMetaverse.RLV private bool CanRemAttachItem(RlvInventoryItem item, bool enforceNostrip, bool enforceRestrictions) { - if (item.WornOn == null && item.AttachedTo == null) + if (item.WornOn == null && item.AttachedTo == null && item.GestureState != RlvGestureState.Active) { return false; } @@ -161,7 +161,9 @@ namespace LibreMetaverse.RLV return false; } - if (enforceNostrip && item.Folder != null && item.Folder.Name.ToLowerInvariant().Contains("nostrip")) + // Special exception: If a folder with (nostrip) contains inventory links to other items, those linked items can still + // be removed. Only the objects actual parent folder or the actual item itself counts. + if (enforceNostrip && !item.IsLink && item.Folder != null && item.Folder.Name.ToLowerInvariant().Contains("nostrip")) { return false; } @@ -199,7 +201,7 @@ namespace LibreMetaverse.RLV foreach (var item in folder.Items) { - if (item.AttachedTo != null || item.WornOn != null) + if (item.AttachedTo != null || item.WornOn != null || item.GestureState == RlvGestureState.Active) { continue; } @@ -263,7 +265,7 @@ namespace LibreMetaverse.RLV { foreach (var item in items) { - if (item.AttachedTo == null && item.WornOn == null) + if (item.AttachedTo == null && item.WornOn == null && item.GestureState != RlvGestureState.Active) { continue; } diff --git a/LibreMetaverse.RLV/RlvGestureState.cs b/LibreMetaverse.RLV/RlvGestureState.cs new file mode 100644 index 00000000..e4dd2c29 --- /dev/null +++ b/LibreMetaverse.RLV/RlvGestureState.cs @@ -0,0 +1,8 @@ +namespace LibreMetaverse.RLV +{ + public enum RlvGestureState + { + Inactive, + Active + } +} diff --git a/LibreMetaverse.RLV/RlvGetRequestHandler.cs b/LibreMetaverse.RLV/RlvGetRequestHandler.cs index 0b078a14..ba9829a5 100644 --- a/LibreMetaverse.RLV/RlvGetRequestHandler.cs +++ b/LibreMetaverse.RLV/RlvGetRequestHandler.cs @@ -168,7 +168,6 @@ namespace LibreMetaverse.RLV } } - if (specificType.HasValue) { if (attachedTypes.Contains(specificType.Value)) @@ -440,7 +439,7 @@ namespace LibreMetaverse.RLV } private static void GetInvWornInfo_Internal(RlvSharedFolder folder, bool recursive, ref int totalItems, ref int totalItemsWorn) { - totalItemsWorn += folder.Items.Count(n => n.AttachedTo != null || n.WornOn != null); + totalItemsWorn += folder.Items.Count(n => n.AttachedTo != null || n.WornOn != null || n.GestureState == RlvGestureState.Active); totalItems += folder.Items.Count; if (recursive) diff --git a/LibreMetaverse.RLV/RlvInventoryItem.cs b/LibreMetaverse.RLV/RlvInventoryItem.cs index 624e252c..59803cd6 100644 --- a/LibreMetaverse.RLV/RlvInventoryItem.cs +++ b/LibreMetaverse.RLV/RlvInventoryItem.cs @@ -8,20 +8,24 @@ namespace LibreMetaverse.RLV public RlvSharedFolder? Folder { get; } public Guid? FolderId { get; } public string Name { get; set; } + public bool IsLink { get; set; } public RlvWearableType? WornOn { get; set; } public RlvAttachmentPoint? AttachedTo { get; set; } public Guid? AttachedPrimId { get; set; } + public RlvGestureState? GestureState { get; set; } /// /// Creates an inventory item associated with an external folder /// /// Item ID /// Item Name + /// Item is an item link /// ID of the external folder containing this item /// Attachment point if the item is attached /// ID of the attached prim /// Wearable type if the item is worn - public RlvInventoryItem(Guid id, string name, Guid? externalFolderId, RlvAttachmentPoint? attachedTo, Guid? attachedPrimId, RlvWearableType? wornOn) + /// Gesture state if item is a gesture, otherwise null + public RlvInventoryItem(Guid id, string name, bool isLink, Guid? externalFolderId, RlvAttachmentPoint? attachedTo, Guid? attachedPrimId, RlvWearableType? wornOn, RlvGestureState? gestureState) { if (string.IsNullOrEmpty(name)) { @@ -29,15 +33,17 @@ namespace LibreMetaverse.RLV } Name = name; + IsLink = isLink; AttachedTo = attachedTo; WornOn = wornOn; Id = id; Folder = null; FolderId = externalFolderId; AttachedPrimId = attachedPrimId; + GestureState = gestureState; } - internal RlvInventoryItem(Guid id, string name, RlvSharedFolder folder, RlvAttachmentPoint? attachedTo, Guid? attachedPrimId, RlvWearableType? wornOn) + internal RlvInventoryItem(Guid id, string name, bool isLink, RlvSharedFolder folder, RlvAttachmentPoint? attachedTo, Guid? attachedPrimId, RlvWearableType? wornOn, RlvGestureState? gestureState) { if (string.IsNullOrEmpty(name)) { @@ -49,12 +55,14 @@ namespace LibreMetaverse.RLV } Name = name; + IsLink = isLink; AttachedTo = attachedTo; WornOn = wornOn; Id = id; Folder = folder ?? throw new ArgumentException("Folder cannot be null", nameof(folder)); FolderId = folder.Id; AttachedPrimId = attachedPrimId; + GestureState = gestureState; } public override string ToString() diff --git a/LibreMetaverse.RLV/RlvSharedFolder.cs b/LibreMetaverse.RLV/RlvSharedFolder.cs index 46a03b61..8995177f 100644 --- a/LibreMetaverse.RLV/RlvSharedFolder.cs +++ b/LibreMetaverse.RLV/RlvSharedFolder.cs @@ -50,18 +50,20 @@ namespace LibreMetaverse.RLV /// /// Item ID /// Item Name - /// Item attachment point if attached - /// ID of the attached prim - /// Item wearable type if worn + /// Item is an item link + /// Item attachment point if attached, null if not attached + /// ID of the attached prim, null if not attached + /// Item wearable type if worn, null if not a wearable + /// Gesture state, or null if this is not a gesture /// Newly added item - public RlvInventoryItem AddItem(Guid id, string name, RlvAttachmentPoint? attachedTo, Guid? attachedPrimId, RlvWearableType? wornOn) + public RlvInventoryItem AddItem(Guid id, string name, bool isLink, RlvAttachmentPoint? attachedTo, Guid? attachedPrimId, RlvWearableType? wornOn, RlvGestureState? gestureState) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Name cannot be null or empty", nameof(name)); } - var newItem = new RlvInventoryItem(id, name, this, attachedTo, attachedPrimId, wornOn); + var newItem = new RlvInventoryItem(id, name, isLink, this, attachedTo, attachedPrimId, wornOn, gestureState); _items.Add(newItem); return newItem;