WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Cooldown spiral no longer inherit alpha? (https://www.wowinterface.com/forums/showthread.php?t=49950)

Ereki 09-20-14 04:54 PM

Cooldown spiral no longer inherit alpha?
 
Hi I have an addon for moving around DK runes and fading them out of combat. But now i WoD the cooldown spiral no longer seems to inherit the alpha from the frame it self, the scale also seems off (but I'm not sure on that)

Pic: http://i.imgur.com/IYZoR19.jpg

The code I'm using is just a simple RuneFrame:SetAlpha(RHaic) where RHaic is a local variable, this works fine on live but results in the cooldown spiral still showing when I'm testing it on the WoD beta. Is this related to the changes to animation and if so how do I fix it?

Code:

if (event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_REGEN_ENABLED") and not UnitInVehicleControlSeat("player") then
        RuneFrame:SetAlpha(RHaoc)       
        RuneFrame:SetScale(RHs)               
elseif event == "PLAYER_REGEN_DISABLED" and not UnitInVehicleControlSeat("player") then
        RuneFrame:SetAlpha(RHaic)
        RuneFrame:SetScale(RHs)
end
       
if ((event == "UNIT_ENTERING_VEHICLE") and UnitInVehicleControlSeat("player"))  then
        local unitID = ...
        if unitID == "player" then
                RuneFrame:SetAlpha(RHaiv)       
        end
elseif event == "PLAYER_ENTERING_WORLD" then
        if InCombatLockdown() then
                RuneFrame:SetAlpha(RHaic)
                RuneFrame:SetScale(RHs)       
        else
                RuneFrame:SetAlpha(RHaoc)
                RuneFrame:SetScale(RHs)
        end
elseif event == "UNIT_EXITED_VEHICLE" then
        local unitID = ...
        if unitID == "player" then
                if InCombatLockdown() then
                        RuneFrame:SetAlpha(RHaic)
                        RuneFrame:SetScale(RHs)
                else
                        RuneFrame:SetAlpha(RHaoc)
                        RuneFrame:SetScale(RHs)
                end
        end
end


semlar 09-20-14 07:06 PM

Don't quote me on this, but you might try something like this..
Lua Code:
  1. for i = 1, 6 do
  2.     local cooldown = _G['RuneButtonIndividual' .. i .. 'Cooldown']
  3.     cooldown:SetSwipeTexture('', 0, 0, 0, RHaoc)
  4.     local start, duration, runeReady = GetRuneCooldown(i)
  5.     if not runeReady and start then
  6.         CooldownFrame_SetTimer(cooldown, start, duration, 1)
  7.     end
  8. end
I don't think it will update the texture unless you call SetCooldown on it afterward, but there might be a better way to do this.

zork 09-22-14 05:45 AM

https://code.google.com/p/rothui/sou...n.lua&old=1281

Lua Code:
  1. <widget>:SetSwipeColor(r, g, b, [a])
  2. <widget>:SetSwipeTexture(file, [r, g, b, a])
  3. <widget>:SetDrawSwipe(boolean)
  4. --<widget>:SetEdgeColor(r, g, b, [a])
  5. <widget>:SetEdgeTexture(file, [r, g, b, a])
  6. <widget>:SetDrawEdge(boolean)
  7. <widget>:SetCooldown(start,duration)

Source: http://www.wowinterface.com/forums/s...ad.php?t=49501

Ereki 09-22-14 09:57 AM

Quote:

Originally Posted by zork (Post 297081)
https://code.google.com/p/rothui/sou...n.lua&old=1281

Lua Code:
  1. <widget>:SetSwipeColor(r, g, b, [a])
  2. <widget>:SetSwipeTexture(file, [r, g, b, a])
  3. <widget>:SetDrawSwipe(boolean)
  4. --<widget>:SetEdgeColor(r, g, b, [a])
  5. <widget>:SetEdgeTexture(file, [r, g, b, a])
  6. <widget>:SetDrawEdge(boolean)
  7. <widget>:SetCooldown(start,duration)

Source: http://www.wowinterface.com/forums/s...ad.php?t=49501

Thanks <widget>:SetSwipeColor(r, g, b, [a]) fixes the alpha of the cooldown spiral but the coodown spiral is still square and doesn't really fit the runes at all which isn't the case on live. On live the sprial is contained within the borders of the rune.

Although I just tested it and it seems to be on the standard RuneFrame as well so I guess this is a bug on Blizzards side.

semlar 09-22-14 10:19 AM

Quote:

Originally Posted by Ereki (Post 297085)
On live the sprial is contained within the borders of the rune.

Find a round texture to use with cooldown:SetSwipeTexture.

The swipe texture isn't round on live, its corners are just being covered by the round border. It's not actually possible to create a round cooldown texture on live.

This seems to work, although I have managed to crash the client several times attempting to change the swipe texture while it was running.
Lua Code:
  1. for i = 1, 6 do
  2.     local cooldown = _G['RuneButtonIndividual' .. i .. 'Cooldown']
  3.     cooldown:SetSwipeTexture('interface/CHARACTERFRAME/TempPortraitAlphaMaskSmall')
  4.     cooldown:SetSwipeColor(0, 0, 0, 0.3)
  5. end
After you set the texture you should only need to call SetSwipeColor when you want to update its alpha. Unlike SetSwipeTexture, it appears to update the swipe immediately.

Ereki 09-22-14 11:31 AM

Woho that works great, thanks alot for the help guys! Weird that the spiral is bigger on the beta than on live though..

Oh well it works great with the texture you found now anyways!

zork 09-23-14 01:00 AM

Holy cow you crash the client changing a texture. WoW.

Duugu 09-23-14 06:40 AM

Quote:

Originally Posted by zork (Post 297115)
Holy cow you crash the client changing a texture. WoW.

Does the bug with very large textures (like 4092x4092) on a Mac that crashes the client still exist? :)

Tuller 10-14-14 07:57 PM

So, SetSwipeColor does make it possible to hide the normal spiral, but it doesn't actually do anything about the shine effect at the end of a cooldown.

semlar 10-14-14 08:13 PM

I'll just document some of the other cooldown methods that you might be interested in here.
Lua Code:
  1. -- Hides flash animation (bling) at the end of the cooldown
  2. Cooldown:SetDrawBling(false)
  3. -- Hides background (swipe texture) of the cooldown
  4. Cooldown:SetDrawSwipe(false)
  5. -- Hides the glowing line that marks the edge of the cooldown swipe
  6. Cooldown:SetDrawEdge(false)
  7. -- Hides the countdown numbers regardless of the cvar setting
  8. Cooldown:SetHideCountdownNumbers(true)

zork 10-15-14 03:25 PM

Have you found a solution? Because I need one for rActionBarStyler. Buttons with alpha 0 will still have the cooldown visible.

Do I actually have to check if the frame is a button with a cooldown and change it via swipecolor? Meh.

Tuller 10-15-14 04:25 PM

Bartender appears to update the swipe color when updating a cooldown.
In Dominos, I reparent the cooldown to a hidden frame when alpha == 0.

zork 10-16-14 01:52 AM

I thought about it. This may fix the issue. According to the ActionButtonTemplate.xml the cooldown is available as button.cooldown.

There is a problem though. There may be any sort of inate alpha. We need to save that.

Lua Code:
  1. --SetCooldownSwipeAlpha
  2. local function SetCooldownSwipeAlpha(self,alpha)
  3.   local r,g,b = self.cooldown:GetSwipeColor()
  4.   self.cooldown:SetSwipeColor(r,g,b,self.cooldown.alpha*alpha)
  5. end
  6.  
  7. --ApplyButtonCooldownAlphaFix
  8. local function ApplyButtonCooldownAlphaFix(button)
  9.   if not button then return end
  10.   if not button.cooldown then return end
  11.   local r,g,b,a = button.cooldown:GetSwipeColor()
  12.   button.cooldown.alpha = a
  13.   hooksecurefunc(button, "SetAlpha", SetCooldownSwipeAlpha)
  14. end
  15.  
  16. do
  17.   --style the actionbar buttons
  18.   for i = 1, NUM_ACTIONBAR_BUTTONS do
  19.     ApplyButtonCooldownAlphaFix(_G["ActionButton"..i])
  20.     ApplyButtonCooldownAlphaFix(_G["MultiBarBottomLeftButton"..i])
  21.     ApplyButtonCooldownAlphaFix(_G["MultiBarBottomRightButton"..i])
  22.     ApplyButtonCooldownAlphaFix(_G["MultiBarRightButton"..i])
  23.     ApplyButtonCooldownAlphaFix(_G["MultiBarLeftButton"..i])
  24.   end
  25.   --override buttons
  26.   for i = 1, 6 do
  27.     ApplyButtonCooldownAlphaFix(_G["OverrideActionBarButton"..i])
  28.   end
  29.   --petbar buttons
  30.   for i=1, NUM_PET_ACTION_SLOTS do
  31.     ApplyButtonCooldownAlphaFix(_G["PetActionButton"..i])
  32.   end
  33.   --stancebar buttons
  34.   for i=1, NUM_STANCE_SLOTS do
  35.     ApplyButtonCooldownAlphaFix(_G["StanceButton"..i])
  36.   end
  37.   --possess buttons
  38.   for i=1, NUM_POSSESS_SLOTS do
  39.     ApplyButtonCooldownAlphaFix(_G["PossessButton"..i])
  40.   end
  41. end

semlar 10-16-14 07:47 AM

Quote:

Originally Posted by Tuller (Post 297927)
In Dominos, I reparent the cooldown to a hidden frame when alpha == 0.

Don't do this, you're breaking my ability to detect what action button a cooldown frame belongs to.

zork 10-16-14 11:13 AM

Err. There is actually no get method for the swipe color. Grmpf.

Here is my working fix for now.

lua Code:
  1. --cooldown spiral alpha fix
  2.  
  3.   --SetCooldownSwipeAlpha
  4.   local function SetCooldownSwipeAlpha(self,cooldown,alpha)
  5.     cooldown:SetSwipeColor(0,0,0,0.8*alpha)
  6.   end
  7.    
  8.   --ApplyButtonCooldownAlphaFix
  9.   local function ApplyButtonCooldownAlphaFix(button)
  10.     if not button then return end
  11.     if not button.cooldown then return end
  12.     local parent = button:GetParent():GetParent()
  13.     hooksecurefunc(parent, "SetAlpha", function(self,alpha) SetCooldownSwipeAlpha(self,button.cooldown,alpha) end)
  14.   end
  15.    
  16.   do
  17.     --style the actionbar buttons
  18.     for i = 1, NUM_ACTIONBAR_BUTTONS do
  19.       ApplyButtonCooldownAlphaFix(_G["ActionButton"..i])
  20.       ApplyButtonCooldownAlphaFix(_G["MultiBarBottomLeftButton"..i])
  21.       ApplyButtonCooldownAlphaFix(_G["MultiBarBottomRightButton"..i])
  22.       ApplyButtonCooldownAlphaFix(_G["MultiBarRightButton"..i])
  23.       ApplyButtonCooldownAlphaFix(_G["MultiBarLeftButton"..i])
  24.     end
  25.     --override buttons
  26.     for i = 1, 6 do
  27.       ApplyButtonCooldownAlphaFix(_G["OverrideActionBarButton"..i])
  28.     end
  29.     --petbar buttons
  30.     for i=1, NUM_PET_ACTION_SLOTS do
  31.       ApplyButtonCooldownAlphaFix(_G["PetActionButton"..i])
  32.     end
  33.     --stancebar buttons
  34.     for i=1, NUM_STANCE_SLOTS do
  35.       ApplyButtonCooldownAlphaFix(_G["StanceButton"..i])
  36.     end
  37.     --possess buttons
  38.     for i=1, NUM_POSSESS_SLOTS do
  39.       ApplyButtonCooldownAlphaFix(_G["PossessButton"..i])
  40.     end
  41.   end

Duugu 10-16-14 11:48 AM

Hm. Do I miss something here? :)
Whats with Cooldown:SetDrawSwipe(false)?
I'm doing it on SPELL_UPDATE_COOLDOWN for my Buttons and it seems to work.

zork 10-16-14 11:51 AM

Well. Don't you think that Blizzard would just set it to true if a new cooldown is started?

Duugu 10-16-14 11:54 AM

Sorry. :) See my edit.

[e]
Oh, and I'm using self:HookScript('OnShow',... to do it there too.

zork 10-19-14 07:51 AM

Btw my solution works but it seems to reset the swipecolor and thus the alpha value on instance change.

Sounds like a bug to me that the cooldown does not take the parented alpha value into account.

semlar 10-19-14 08:25 AM

It doesn't even take its own alpha into account, it's definitely bugged.

You can call cooldown:SetAlpha() directly and it won't have any effect on it.


All times are GMT -6. The time now is 09:55 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI