Tweak Transmog Restore Module - #492
Conversation
- Two-handed weapon doesn't show on the model because the off-hand item is equipped after the main-hand and overrides it. - Lua "pairs" order is intricate. So we capture the MH and OH items then equip them in the correct order. - Our old hack (triggering "SetupSlots" by toggling Separate Shoulders) worked, but it had performance issue due to item model refreshing.
- The native popup only has a "confirm wiping pending changes" option. - We added an option to move the pending changes over to the new outfit. - There is a checkbox to dismiss the popup and always move changes over. - Disgusting.
There was a problem hiding this comment.
My Raeview for this PR:
- Removed one tab (nitpick but styling).
- Logic suggestion for
CANCELon the popup (see the suggested change comment). - Discard does not discard pending situation changes. See Pending Situations Not Wiped.
- We differ from wow-ui-source in regards to ranged weapons, raising this just in case. See Ranged Weapon Slot.
Otherwise this looks fine, I had no clue these shenanigans about how slots were refreshed worked like this.. Especially not for weapons.
But it's good that we can manipulate the order the weapons are pushed in to avoid the dual refresh.
Pending Situations Not Wiped
So this popup TRANSMOG_PENDING_CHANGES shows on two cases:
- Pending transmog changes.
- Pending situation changes.
This means that unless we also wipe the situations, discarding makes you go to the next outfit with the same situations.. And then wanting to move again will raise it again, as situations remains un-discarded.
Video below illustrations.
2026-09-06_17-27-47-856.mp4
I suggest to use EL.WipePendingAppearanceFromDB(true), as the true explicitly discards situations too.
Not sure if we want to wipe last viewed too with the wipe function, but I'll leave that up to you.
Ranged Weapon Slot
So I checked the changes you did for OnRefreshSlots() and realized you went over the function that exists in wow-ui-source:
https://github.com/Gethe/wow-ui-source/blob/8ea15b61e45c0ed4eba01439c90757f86eb78d34/Interface/AddOns/Blizzard_Transmog/Blizzard_Transmog.lua#L1220-L1225
The blizz code seems to ignore ranged weapon slots, and we implicitly set it to 16 or 17.
Is this intentional or not? You know more about the model/actor/3D code than I ever will.
I'm not sure if this will cause problems on mainline or one of the classic flavors.
If we don't want this (or this causes issues), we might want to follow Blizz here:
local function OnRefreshSlots()
local f = TransmogFrame.CharacterPreview;
local mainOrOHSlotSelected = f.selectedSlotData and f.selectedSlotData.transmogLocation:IsEitherHand();
local rangedSlotSelected = f.selectedSlotData and f.selectedSlotData.transmogLocation:IsRangedSlot();
local previewRangedWeapon = C_PaperDollInfo.IsRangedSlotShown() and ((C_CVar.GetCVarBool("transmogPreviewedWeaponToggle") and not mainOrOHSlotSelected) or rangedSlotSelected);
if previewRangedWeapon then return; end
local actor = f.ModelScene:GetPlayerActor();
if not actor then return; end
local weaponSlotItemTransmogInfo = {};
+ local weaponSlotIsRanged = {};
for slotFrame in f.CharacterAppearanceSlotFramePool:EnumerateActive() do
local transmogLocation = slotFrame:GetTransmogLocation();
if transmogLocation then
local slotID = transmogLocation:GetSlotID();
if slotID == 16 or slotID == 17 then
local illusionSlotFrame = slotFrame:GetIllusionSlotFrame();
local illusionID = Constants.Transmog.NoTransmogID;
if illusionSlotFrame then
local illusionSlotInfo = illusionSlotFrame:GetSlotInfo();
if illusionSlotInfo and illusionSlotInfo.warning ~= Enum.TransmogOutfitSlotWarning.WeaponDoesNotSupportIllusions then
illusionID = illusionSlotInfo.transmogID;
end
end
local secondaryAppearanceID = Constants.Transmog.NoTransmogID;
local appearanceID = slotFrame:GetEffectiveTransmogID();
local itemTransmogInfo = ItemUtil.CreateItemTransmogInfo(appearanceID, secondaryAppearanceID, illusionID);
local mainHandCategoryID;
local isLegionArtifact = false;
if transmogLocation:IsMainHand() then
mainHandCategoryID = C_TransmogOutfitInfo.GetItemModifiedAppearanceEffectiveCategory(appearanceID);
isLegionArtifact = TransmogUtil.IsCategoryLegionArtifact(mainHandCategoryID);
itemTransmogInfo:ConfigureSecondaryForMainHand(isLegionArtifact);
end
if appearanceID == Constants.Transmog.NoTransmogID then
actor:UndressSlot(slotID);
else
- local slotToSetID = slotID;
- weaponSlotItemTransmogInfo[slotToSetID] = itemTransmogInfo;
+ weaponSlotItemTransmogInfo[slotID] = itemTransmogInfo;
+ --Don't specify a slot for ranged weapons, matching Blizzard's own RefreshSlots.
+ weaponSlotIsRanged[slotID] = mainHandCategoryID and TransmogUtil.IsCategoryRangedWeapon(mainHandCategoryID);
end
end
end
end
-- Weapons must be equipped in specific order
-- So main-hand can correctly override off-hand
- for slotToSetID = 17, 16, -1 do
- if weaponSlotItemTransmogInfo[slotToSetID] then
- actor:SetItemTransmogInfo(weaponSlotItemTransmogInfo[slotToSetID], slotToSetID);
+ for slotID = 17, 16, -1 do
+ if weaponSlotItemTransmogInfo[slotID] then
+ actor:SetItemTransmogInfo(weaponSlotItemTransmogInfo[slotID], not weaponSlotIsRanged[slotID] and slotID or nil);
end
end
endPlease look this over though as I don't know if this is needed / causes issues!
Co-authored-by: Raenore <172234435+Raenore@users.noreply.github.com>
- Good catch. Co-Authored-By: Raenore <172234435+Raenore@users.noreply.github.com>
- It helps indicate which key is the sub-option. Co-Authored-By: Raenore <172234435+Raenore@users.noreply.github.com>
Co-Authored-By: Raenore <172234435+Raenore@users.noreply.github.com>
Raenore
left a comment
There was a problem hiding this comment.
I do know you're still handling one more thing with the popup.
However, everything I raised was handled so green check from me.
Co-Authored-By: Raenore <172234435+Raenore@users.noreply.github.com>
|
Thanks, Rae, as diligent as ever. |
Introduced an alternative to fix the "two-handed weapon not showing on main model" issue with no FPS impact.
Display a popup when trying to select another outfit while having pending changes.