Quantcast a little help with frame names and more - WoWInterface
Thread Tools Display Modes
09-16-14, 03:06 PM   #1
saxitoxin
A Wyrmkin Dreamwalker
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 59
a little help with frame names and more

I would please like some help with some frame names and some other commands
I have made my character frame look (in my opinion) better in some ways. but I have some issues.



1. The borders from the " CharacterModelFrame " are still visible when I have expanded the frames, I would like to remove them, and could not find the name of those.
2. The borders around the itemslots are looking wierd after I moved them around, how can I remove them or add custom ones?
3. I would like to know if I can change the texture of a itemslot, specific the cape
4. Is it possible to make the character frame spawn on the center of the screen, I have tried to use "PaperDollFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)" but it is not working

Thanks for any help
  Reply With Quote
09-16-14, 03:34 PM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
1. You need to hide these frames:

Lua Code:
  1. PaperDollInnerBorderTopLeft:Hide()
  2. PaperDollInnerBorderTopRight:Hide()
  3. PaperDollInnerBorderBottomLeft:Hide()
  4. PaperDollInnerBorderBottomRight:Hide()
  5. PaperDollInnerBorderLeft:Hide()
  6. PaperDollInnerBorderRight:Hide()
  7. PaperDollInnerBorderTop:Hide()
  8. PaperDollInnerBorderBottom:Hide()
  9. PaperDollInnerBorderBottom2:Hide()

2. You can remove the border from every slot frame like this, not sure how can you override this yet:

Lua Code:
  1. CharacterHeadSlot:DisableDrawLayer("Background")
  2. CharacterNeckSlot:DisableDrawLayer("Background")
  3. CharacterShoulderSlot:DisableDrawLayer("Background")
  4. CharacterBackSlot:DisableDrawLayer("Background")
  5. CharacterChestSlot:DisableDrawLayer("Background")
  6. CharacterShirtSlot:DisableDrawLayer("Background")
  7. CharacterTabardSlot:DisableDrawLayer("Background")
  8. CharacterWristSlot:DisableDrawLayer("Background")
  9. CharacterHandsSlot:DisableDrawLayer("Background")
  10. CharacterWaistSlot:DisableDrawLayer("Background")
  11. CharacterLegsSlot:DisableDrawLayer("Background")
  12. CharacterFeetSlot:DisableDrawLayer("Background")
  13. CharacterFinger0Slot:DisableDrawLayer("Background")
  14. CharacterFinger1Slot:DisableDrawLayer("Background")
  15. CharacterTrinket0Slot:DisableDrawLayer("Background")
  16. CharacterTrinket1Slot:DisableDrawLayer("Background")
  17. CharacterMainHandSlot:DisableDrawLayer("Background")
  18. CharacterSecondaryHandSlot:DisableDrawLayer("Background")

3. Easiest way to do that is to extract the "Data/interface.MPQ/Interface/PaperDoll" folder with an MPQ extractor (I would suggest to use the MPQ Plugin for Total Commander), then copy this into your "Interface" folder, than just edit the images, but keep the names.

4. Use this code:

Lua Code:
  1. if ShowUIPanel then
  2.     hooksecurefunc("ShowUIPanel", function(self)
  3.         if self == CharacterFrame then
  4.             CharacterFrame:ClearAllPoints()
  5.             CharacterFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  6.         end
  7.     end)
  8. end
  9. if CharacterFrame_Collapse then
  10.     hooksecurefunc("CharacterFrame_Collapse", function(self)
  11.         CharacterFrame:ClearAllPoints()
  12.         CharacterFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  13.     end)
  14. end
  15. if CharacterFrame_Expand then
  16.     hooksecurefunc("CharacterFrame_Expand", function(self)
  17.         CharacterFrame:ClearAllPoints()
  18.         CharacterFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  19.     end)
  20. end

Last edited by Resike : 09-16-14 at 04:14 PM.
  Reply With Quote
09-16-14, 11:07 PM   #3
saxitoxin
A Wyrmkin Dreamwalker
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 59
Originally Posted by Resike View Post
...
thanks for the answers, all worked but point 3
the icon I want to change is the same icon used by the chestslot, also this is why I want to change it. So I was wondering if I could override the texture selected for the back slot with my own texture?
  Reply With Quote
09-17-14, 03:27 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by saxitoxin View Post
thanks for the answers, all worked but point 3
the icon I want to change is the same icon used by the chestslot, also this is why I want to change it. So I was wondering if I could override the texture selected for the back slot with my own texture?
Couln't find where does the game load those textures, if it's in the C code, then you can't really alter it.

Edit: Victory, try this code:

Lua Code:
  1. local frame = CreateFrame("FRAME")
  2. frame:RegisterEvent("PLAYER_ENTERING_WORLD")
  3.  
  4. local function IsProtected(frame)
  5.     if frame:IsProtected() and InCombatLockdown() then
  6.         return true
  7.     end
  8.     return false
  9. end
  10.  
  11. local function SetTexture(frame, texture)
  12.     if IsProtected(frame) then
  13.         return
  14.     end
  15.     if frame.lockTexture then
  16.         local p = frame.lockTexture
  17.         frame.lockTexture = nil
  18.         frame:SetTexture(texture)
  19.         frame.lockTexture = p
  20.     end
  21. end
  22.  
  23. local function LockTexture(frame)
  24.     if IsProtected(frame) then
  25.         return
  26.     end
  27.     if not frame.lockTexture then
  28.         if not frame.lockTextureHook then
  29.             hooksecurefunc(frame, "SetTexture", function(self)
  30.                 local id = GetInventoryItemID("player", GetInventorySlotInfo("BackSlot"))
  31.                 if id then
  32.                     local texture = GetInventoryItemTexture("player", GetInventorySlotInfo("BackSlot"))
  33.                     SetTexture(self, texture)
  34.                 else
  35.                     local texture = "Interface\\PaperDoll\\UI-PaperDoll-Slot-SecondaryHand"
  36.                     SetTexture(self, texture)
  37.                 end
  38.             end)
  39.             frame.lockTextureHook = true
  40.         end
  41.         frame.lockTexture = true
  42.     end
  43. end
  44.  
  45. local function UnlockTexture(frame)
  46.     frame.lockTexture = nil
  47. end
  48.  
  49. frame:SetScript("OnEvent", function(self, event, ...)
  50.     LockTexture(CharacterBackSlotIconTexture)
  51. end)

Just edit "Interface\\PaperDoll\\UI-PaperDoll-Slot-SecondaryHand" to any texture you want to use.

Last edited by Resike : 09-17-14 at 06:34 AM.
  Reply With Quote
09-17-14, 08:15 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That seems... incredibly overcomplicated. Nothing in the character frame is ever "protected" (that's only for the in-game store UI) and texture objects are never secure, so you can freely manipulate them in combat without any danger. Assuming the frame name and texture path in your code are correct, all you should need is this:

Code:
local setting
hooksecurefunc(CharacterBackSlotIconTexture, "SetTexture", function(self, texture)
     if not setting and string.find(texture, "PaperDoll") then
          setting = true
          self:SetTexture("Interface\\PaperDoll\\UI-PaperDoll-Slot-SecondaryHand")
          setting = nil
     end
end)
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-17-14, 09:53 AM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Phanx View Post
That seems... incredibly overcomplicated. Nothing in the character frame is ever "protected" (that's only for the in-game store UI) and texture objects are never secure, so you can freely manipulate them in combat without any danger. Assuming the frame name and texture path in your code are correct, all you should need is this:

Code:
local setting
hooksecurefunc(CharacterBackSlotIconTexture, "SetTexture", function(self, texture)
     if not setting and string.find(texture, "PaperDoll") then
          setting = true
          self:SetTexture("Interface\\PaperDoll\\UI-PaperDoll-Slot-SecondaryHand")
          setting = nil
     end
end)
The only reason i wrote it like that, so i could use this LockTexture in the future in other frames. I'm not sure about textures cannot be protected or not, since you could use a simple texture as a button, and also has SetPoint and ClearAllPoint methods, i just went with the safe method, but you could be right. The issue with your code, the game using the same texture for empty and equipped slots, so you need to add this:

Lua Code:
  1. local setting
  2. hooksecurefunc(CharacterBackSlotIconTexture, "SetTexture", function(self, texture)
  3.     if not setting and string.find(texture, "PaperDoll") then
  4.         setting = true
  5.         local id = GetInventoryItemID("player", GetInventorySlotInfo("BackSlot"))
  6.         if id then
  7.             local texture = GetInventoryItemTexture("player", GetInventorySlotInfo("BackSlot"))
  8.             self:SetTexture(texture)
  9.         else
  10.             local texture = "Interface\\PaperDoll\\UI-PaperDoll-Slot-SecondaryHand"
  11.             self:SetTexture(texture)
  12.         end
  13.         setting = nil
  14.     end
  15. end)

Last edited by Resike : 09-17-14 at 10:05 AM.
  Reply With Quote
09-17-14, 09:59 AM   #7
saxitoxin
A Wyrmkin Dreamwalker
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 59
Thanks

Thanks alot for solutions to my problems, You have been to alot of help the both of you
  Reply With Quote
09-17-14, 01:16 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Resike View Post
I'm not sure about textures cannot be protected or not, since you could use a simple texture as a button, and also has SetPoint and ClearAllPoint methods, i just went with the safe method, but you could be right.
You can't use a texture as a button. Textures have no mouse interactivity features whatsoever. You can put a texture on a button, which is maybe what you're thinking of.

Originally Posted by Resike View Post
The issue with your code, the game using the same texture for empty and equipped slots, so you need to add this:
Yes, that's what the string.find already accounts for -- equipped item textures will not have "PaperDoll" in their path, because item textures are all in "Interface\\Icons".
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-18-14, 05:43 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Phanx View Post
You can't use a texture as a button. Textures have no mouse interactivity features whatsoever. You can put a texture on a button, which is maybe what you're thinking of.
I mixed it up with models, models can have pretty much any script functions as a button.

Originally Posted by Phanx View Post
Yes, that's what the string.find already accounts for -- equipped item textures will not have "PaperDoll" in their path, because item textures are all in "Interface\\Icons".
Makes sense.
  Reply With Quote
09-18-14, 07:48 AM   #10
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
There's a perfect event to use for the texture thing, too. You should be able to use the frame in question, I reckon.
Code:
CharacterBackSlot:HookScript("OnEvent", function(self, event, slot, hasItem)
	if event == "PLAYER_EQUIPMENT_CHANGED" and slot == self:GetID() and not hasItem then
		self.icon:SetTexture([[stuff]])
	end
end)
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 09-18-14 at 07:59 AM.
  Reply With Quote
09-18-14, 10:37 AM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Lombra View Post
There's a perfect event to use for the texture thing, too. You should be able to use the frame in question, I reckon.
Code:
CharacterBackSlot:HookScript("OnEvent", function(self, event, slot, hasItem)
	if event == "PLAYER_EQUIPMENT_CHANGED" and slot == self:GetID() and not hasItem then
		self.icon:SetTexture([[stuff]])
	end
end)
Nope, the event is okay, but the server side is very slow handling the items you equip or put them into bags or delete them, so the texture changes will be late and glitchy.
  Reply With Quote
09-18-14, 10:05 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Resike View Post
Nope, the event is okay, but the server side is very slow handling the items you equip or put them into bags or delete them, so the texture changes will be late and glitchy.
There's also no guarantee that your handler for that event will be run before the default UI's handler for the same event. Hooking the actual texture change is a better solution all around.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-19-14, 03:20 AM   #13
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Phanx View Post
There's also no guarantee that your handler for that event will be run before the default UI's handler for the same event. Hooking the actual texture change is a better solution all around.
Before? You mean after? I'm hooking the button in question, so it will run afterwards, and I'm pretty sure this is the event that's used by the default UI to update the texture, so there should be no way it could fail. Seems less hacky than hooking SetTexture, to me.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
09-19-14, 03:39 AM   #14
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Lombra View Post
Before? You mean after? I'm hooking the button in question, so it will run afterwards, and I'm pretty sure this is the event that's used by the default UI to update the texture, so there should be no way it could fail. Seems less hacky than hooking SetTexture, to me.
Yes but it runs after the server updated the values and vertified the item change, which takes much longer time, while the SetTexture runs in the middle of the change. At least that method seems to be smoother for me.
Also since i couldnt find where does the default UI set/update thoose textures in the Interface code, it probably gets updated in the C code.
  Reply With Quote
09-19-14, 04:48 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Lombra View Post
Before? You mean after? I'm hooking the button in question, so it will run afterwards, and I'm pretty sure this is the event that's used by the default UI to update the texture, so there should be no way it could fail. Seems less hacky than hooking SetTexture, to me.
No, I mean, if two frames are registered for the same event, you can't guarantee which frame's event handler will run first. In practice they are usually run in the order registered, but it's technically undefined, like the order in which values are returned from pairs, so you shouldn't rely on it.

Originally Posted by Resike View Post
Also since i couldnt find where does the default UI set/update thoose textures in the Interface code, it probably gets updated in the C code.
PaperDollFrame.lua#2418

And after reading that it looks like the whole issue of hooking is irrelevant, and you can just change the default texture for any slot by putting the path to the desired texture under the "backgroundTextureName" key on the slot frame:

Code:
CharacterBackSlot.backgroundTextureName = "Path\\To\\MyNewEmptyCloakTexture"
Then the default UI will use that texture for the empty slot instead of the default one.

Source:
PaperDollFrame.lua#2289
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
09-19-14, 06:20 AM   #16
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Phanx View Post
No, I mean, if two frames are registered for the same event, you can't guarantee which frame's event handler will run first. In practice they are usually run in the order registered, but it's technically undefined, like the order in which values are returned from pairs, so you shouldn't rely on it.



PaperDollFrame.lua#2418

And after reading that it looks like the whole issue of hooking is irrelevant, and you can just change the default texture for any slot by putting the path to the desired texture under the "backgroundTextureName" key on the slot frame:

Code:
CharacterBackSlot.backgroundTextureName = "Path\\To\\MyNewEmptyCloakTexture"
Then the default UI will use that texture for the empty slot instead of the default one.

Source:
PaperDollFrame.lua#2289
Dayum, i just grepwin to slotnames, thats why i couln't find it.
Anyway based on this it would be intresting to write an addon to override item icontextures with their transmog icon.

Last edited by Resike : 09-19-14 at 06:24 AM.
  Reply With Quote
09-19-14, 08:37 AM   #17
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Resike View Post
Yes but it runs after the server updated the values and vertified the item change, which takes much longer time, while the SetTexture runs in the middle of the change. At least that method seems to be smoother for me.
I don't understand. You can't update the texture until the server has made the change and sent the event to the client; the API returns won't be up to date until then. The default UI calls SetTexture in response to this event.
Originally Posted by Phanx View Post
No, I mean, if two frames are registered for the same event, you can't guarantee which frame's event handler will run first. In practice they are usually run in the order registered, but it's technically undefined, like the order in which values are returned from pairs, so you shouldn't rely on it.
Maybe. Either way, it's not two different frames. The slot buttons (eg CharacterBackSlot) are the frames responsible for setting their own textures. Although come to think of it, not sure if some other event updated the texture as well.

Anyway, setting that field will be better of course.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
09-19-14, 09:23 AM   #18
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Lombra View Post
I don't understand. You can't update the texture until the server has made the change and sent the event to the client; the API returns won't be up to date until then. The default UI calls SetTexture in response to this event.
If you hook both function/event then you can see that the SetTexture runs before the equip change:

Lua Code:
  1. hooksecurefunc(CharacterBackSlotIconTexture, "SetTexture", function(self, texture)
  2.     print(self:GetTexture())
  3. end)
  4.  
  5. CharacterBackSlot:HookScript("OnEvent", function(self, event, slot, hasItem)
  6.     if event == "PLAYER_EQUIPMENT_CHANGED" then
  7.         print(event)
  8.     end
  9. end)

And it should because when the equip change event triggers, you should be able to access the newly equipped item's texture properly. Between this 2 events the game still sets the original background texture, and in some cases it could be visible.
  Reply With Quote
09-19-14, 01:06 PM   #19
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
The original SetTexture will be called before the OnEvent hook, yes, but it's still not really any different. SetTexture is done as part of the original event handler, which gets called before the hook. They both wait for the server to send the event.

There will never be any visible flicker as a result of these kind of things, because the UI isn't drawn until all code has finished executing.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
09-19-14, 03:56 PM   #20
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by Lombra View Post
The original SetTexture will be called before the OnEvent hook, yes, but it's still not really any different. SetTexture is done as part of the original event handler, which gets called before the hook. They both wait for the server to send the event.

There will never be any visible flicker as a result of these kind of things, because the UI isn't drawn until all code has finished executing.
Not sure, the first method i tried was based on this event, and i had some issues so mainly thats why i went with the settexture hook.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » a little help with frame names and more

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off