Thread Tools Display Modes
06-10-14, 03:43 AM   #1
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Question How to change global function on-the-fly (change color of texture on-the-fly)?

Hello, everybody!
First of all words, sorry for my bad english!
What i want to do:
------------------
Change color of proc abilities of my monk inside "SpellActivationOverlayFrame": "Combo Breaker: Tiger Palm" and "Combo Breaker: Blackout Kick". Blizzards make them too dark for my eyes.

How i thinking to do it:
---------------------
playing with event "SPELL_ACTIVATION_OVERLAY_SHOW". This event give us next args: "spellID, texturePath, location, scale, r, g, b". So i need to change last 3 args and put them on-the-fly to some global function, that show me abilities, but i`m not sure, what function should i use for it and how to do this magic correctly: "SpellActivationOverlay_OnEvent" or "SpellActivationOverlay_ShowAllOverlays" or "SpellActivationOverlay_ShowOverlay" or maybe some other function.
Can some one lead me in this process?
Google didnt help me in this question. Probably nobody was necessary this

Thx You in advance!
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
06-10-14, 05:43 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Based on a brief glance at the default UI code I'd guess this would work:

Code:
local modifierForSpell = {
	[116768] = 1.1, -- Combo Breaker: Blackout Kick
	[118864] = 1.25, -- Combo Breaker: Tiger Palm
}

local originalFunction = SpellActivationOverlay_ShowOverlay
function SpellActivationOverlay_ShowOverlay(self, spellID, texturePath, position, scale, r, g, b, vFlip, hFlip)
	local modifier = modifierForSpell[spellID]
	if modifier then
		r, g, b = r * modifier, g * modifier, b * modifier
	end
	originalFunction(self, spellID, texturePath, position, scale, r, g, b, vFlip, hFlip)
end
If you'd rather specify your own RGB values instead of just brightening or darkening the provided ones:

Code:
local colorForSpell = {
	[116768] = { r = 1, g = 0, b = 0 }, -- Combo Breaker: Blackout Kick
	[118864] = { r = 0, g = 1, b = 1 }, -- Combo Breaker: Tiger Palm
}

local originalFunction = SpellActivationOverlay_ShowOverlay
function SpellActivationOverlay_ShowOverlay(self, spellID, texturePath, position, scale, r, g, b, vFlip, hFlip)
	local color = colorForSpell[spellID]
	if color then
		r, g, b = color.r, color.g, color.b
	end
	originalFunction(self, spellID, texturePath, position, scale, r, g, b, vFlip, hFlip)
end
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.bool.no/
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
06-10-14, 07:50 AM   #3
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Originally Posted by Phanx View Post
Based on a brief glance at the default UI code I'd guess this would work:

...load of usefull text in middle

If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.bool.no/
Thank a lot for code and links, Phanx. Will check it as soon, as i can.
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
06-11-14, 01:26 AM   #4
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Thumbs up

Originally Posted by Phanx View Post
-- text was here --
Tested:
Everything is fine, but i got 1 problem - texture still not bright. I even changed default texture to textures of other classes, and all of them were not bright. Maybe i somehow changed opacity of "SpellActivationOverlayFrame" before, not sure =)
Anyway thx for help, Phank
__________________
Felischaus @ [Lovely Bones] Stormrage - EU
  Reply With Quote
06-11-14, 01:52 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I haven't looked into the system much (or at all, really) but I'm pretty sure that most of the textures have a color "baked in" so when you colorize it, you're adding your color to the existing color, not replacing it. So, for example, if the original texture is blue and you try to make it yellow, you'll end up with green. If this is the case, you'd need to dig deeper and find the function that's actually showing and coloring the texture object, and have it desaturate the texture before applying your custom color.

If you don't think that's the problem, then I don't really know what you mean by "not bright" -- post a screenshot showing the original appearance and the altered appearance of the same texture.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
06-18-14, 12:45 AM   #6
atuin_wow
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 11
Thumbs up

Originally Posted by Phanx View Post
I haven't looked into the system much (or at all, really) but I'm pretty sure that most of the textures have a color "baked in" so when you colorize it, you're adding your color to the existing color, not replacing it. So, for example, if the original texture is blue and you try to make it yellow, you'll end up with green. If this is the case, you'd need to dig deeper and find the function that's actually showing and coloring the texture object, and have it desaturate the texture before applying your custom color.

If you don't think that's the problem, then I don't really know what you mean by "not bright" -- post a screenshot showing the original appearance and the altered appearance of the same texture.
Hi!
Problem with "not bright" was solved by moving slider inside game system settings to the right side. This slider work with apha lvl of overlay frame. That is. Dont remember when and why i moved this slider to the left =)
__________________
Felischaus @ [Lovely Bones] Stormrage - EU

Last edited by atuin_wow : 06-18-14 at 07:28 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to change global function on-the-fly (change color of texture on-the-fly)?


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