Masque ButtonData
I am trying to assign a skin to my addon buttons with Masque, but there are some trouble with the cooldown layer. In fact, it often happens that the size of the cooldown are greater than those of the button. I think this is due to the fact that Masque not skins the cooldown layer. Reading the documentation, I came across this page. Honestly is not very clear explanation, and from what little I understood I should "feed" Masque with this table, but there no mention of how it should be done. The buttons are created and skinned in this way:
Lua Code:
How should do to get the right skin? |
1. Masque does "skin" the cooldown, by moving and resizing it according to the skin's definitions. If it's misplaced or incorrectly sized, either Masque isn't able to identify your button's cooldown object, or the skin you're using is broken. Compare to the same skin on other action buttons (eg. Bartender or Dominos) to see if it's a skin issue or not.
2. You only need to provide a button data table if your button (a) doesn't have all of the regions/children Masque expects, or (b) doesn't use the standard names/keys for its regions/children. It's not necessary for typical action buttons with the expected structure. 3. Please post your entire, actual button creation code. What you posted is just not enough to identify any issues, and is making my eye twitch with awful (hopefully fake example) globals like "myButton". :( |
Quote:
Lua code: http://nopaste.linux-dev.org/?830227 I use nopaste service 'cause is a bit long code, and I did not want write a flood post |
MyAddon:iconLocation() is just an icon reposizioning function
Lua Code:
|
XML, lines 13-15:
This does nothing, since you don't set any drag-related scripts on bars, only on buttons. Get rid of this. XML, lines 63-75: You probably don't actually want to create a separate dropdown frame for every button. Just create one dropdown for your whole addon, and pass the correct arguments to the toggle function to position it relative to the specific button that was clicked to open it. XML, line 86: Based on the Lua code you posted, this is the mouseover trigger for tooltips -- get rid of this, you don't need it, the whole button can (and should) trigger a tooltip. Lua, line 37: If you're going to create a dedicated function for concatenating values to form a button name, you should also use that same function to get the name you pass to CreateFrame. Lua, line 39: If you're going to use XML, you should actually use XML, and add a cooldown to your button template. Also (and much more importantly) you are creating a new cooldown object every time you update the button, which is bad. Lua, line 54: You should really try to find a way to do this that doesn't require creating a new function every time you update the button. See your "MyAddon_wpnenchScan_Onupdate" function as an example. An easy way to do this would be to attach keys to the button whose values contain the appopriate values of "bar" and "i", eg "f.bar = <reference to the bar frame>" and "f.id = i", and then refer to those in the function, so it can be called on any button and still have the data it needs. Also, while "0,005" may be correct for human language in your region, Lua requires "0.005" notation for decimal values; currently you're passing "0" and then "005" as separate arguments. Lua, line 58: Again, try to generalize this function and define it outside of this update function, so you don't need to create a new one every time you update a button. Lua, line 64: Same thing, except Blizzard has already defined a generic version of this function; just use SetScript("OnLeave", GameTooltip_Hide) to get this behavior. Lua, line 68: Your button doesn't have a "highlight" member. It has a highlight texture, but that's not automatically assigned to the "highlight" key. If you want to do that, you need to write "f.highlight = f:GetHighlightTexture()" somewhere (like in your button's OnLoad script) first. Lua, line 90: Now we finally get to Masque! Most like you don't need your individual bars to be skinned differently, so you should just use Group("MyAddon") to just create one entry in the Masque options UI for your whole addon. Masque's AddButton function can just take a reference to the button -- "f" in this context -- so you don't need to look up its name -- though if you did need to, you should just do "f:GetName()" instead of this! Your button's button data table should probably look like this: Code:
{ Cooldown: Masque can find this on its own since your cooldown object is named <buttonName>Cooldown like "real" action buttons. Highlight: Masque will just call button:GetHighlightTexture() to find this on its own. |
This is my new attempt, and its results:
The XML skeleton: https://gist.github.com/anonymous/2eebedd2141d3106f108 And the lua code: Lua Code:
The result is different from what I expected: http://imgur.com/ggJhCQo. As one can see from the picture, the cooldown overflow from icon because Masque failed to skin it. You should see the border, according to Masque settings: http://imgur.com/tLSEuSk The only thing I can add is that the buttons are created at the call of this function: Lua Code:
Where did I go wrong? |
The button skin tells Masque the dimensions of the cooldown swipe.
Lua Code:
I don't think you can change that with another addon, but I guess maybe you can if you have the dimensions to change. Anyway, if I'm wrong I'm sure someone will chime in here to tell me. :o |
As I mentioned earlier:
Quote:
If not, then it's likely the problem actually stems from the fact that your buttons don't have most of the textures a "regular" buttons have, but the skin is constructed with "regular" buttons in mind, where the border and/or normal textures would be filling up that space around the icon texture where the cooldown appears to be sticking out. If this is what's happening, then you'll probably just have to (1) tell Masque not to touch your cooldown (by setting Cooldown = false) in the buttonData table, and (2) manage the size of the cooldown yourself by registering for a OnSkinChanged callback from Masque, checking the size of the icon, and sizing/placing your cooldown object appropriately. |
Keep in mind: Masque DOES NOT skin default objects. IE default action bars or buffs, debuffs and there may be more objects that I'm missing (imagine that!). :o
|
After several attempts, I found that the problem lies in the texture structure, but I don't know how to configure it properly so Masque is able to skin it correctly. Any advice is welcome :D
|
Try resizing the cool down in whatever skin you are using. That should resize the swipe.
Look for something like Lua Code:
EDIT: You are using a Masque skin, right? /EDIT |
Quote:
Quote:
Quote:
If no, post screenshots of the same skin applied to both your addon (where it looks wrong) and another addon (where it looks correct) and post your entire addon (not just parts of it). |
All times are GMT -6. The time now is 04:01 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI