Thread Tools Display Modes
12-27-09, 07:44 PM   #1
rberry88
Premium Member
Join Date: Feb 2005
Posts: 42
Adding scale to a layout

I'm using oUF_shkm, he is no longer updating the mod since July and I was trying to get it a little larger by using the scale command. I'm new to lua but I added "local scale = 1.2" without the quotes at the beginning of the lua file where the other locals are defined but it has no effect.


Any easy way to add scaling to this layout?
  Reply With Quote
12-27-09, 09:30 PM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Originally Posted by rberry88 View Post
I'm using oUF_shkm, he is no longer updating the mod since July and I was trying to get it a little larger by using the scale command. I'm new to lua but I added "local scale = 1.2" without the quotes at the beginning of the lua file where the other locals are defined but it has no effect.


Any easy way to add scaling to this layout?

Defining a local is not necessary to scale frames. It's a way to apply the same number to all places where you use a scale, though.

For example ...

Setting a scale goes more or less like this (the numbers in brackets are the scale values which vary in my example below):

oUF_Player:SetScale(1.0)
oUF_Target:SetScale(1.4)
oUF_Focus:SetScale(0.6)

in your case, you could apply your local like this
oUF_Player:SetScale(Scale)
oUF_Target:SetScale(Scale)
oUF_Focus:SetScale(Scale)

which would result in all frames being scaled by 1.2
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
12-27-09, 10:35 PM   #3
rberry88
Premium Member
Join Date: Feb 2005
Posts: 42
Awesome, thanks a lot. Works like a charm.
  Reply With Quote
12-28-09, 02:28 AM   #4
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
A way to do it without having to set it for each one (unless that's what you want to do ) is to add a line at the end of the layout function that looks like this:
self:SetAttribute('initial-scale', 1.2)

That way they're all set as they're created. I'm not sure if SetScale is protected during combat or not, but if so you can run into problems if the unit frames are created during combat (logging in after a DC, for example). Using SetAttribute gets around that.
  Reply With Quote
12-28-09, 07:20 AM   #5
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Originally Posted by wurmfood View Post
That way they're all set as they're created. I'm not sure if SetScale is protected during combat or not, but if so you can run into problems if the unit frames are created during combat (logging in after a DC, for example). Using SetAttribute gets around that.
Mhm, sounds possible. I'm using the SetScale code for my layout(s) and never got any issue reports. I'm not using those options myself, though. I just put them in, because others might have a use for it.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
12-28-09, 07:36 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
:SetScale() is protected in combat. Just set the attributes instead and let oUF/Blizzard handle it and you'll be fine.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
12-28-09, 03:26 PM   #7
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
will self:SetAttribute('initial-scale', 1.2) also work for separate frames like this

oUF_Player:SetAttribute('initial-scale', PlayerScale)


or do I have to to use it like this
if unit = player then
self:SetAttribute('initial-scale', PlayerScale)
elseif unit = whatever then
self:SetAttribute('initial-scale', whateverScale)
...

end

Thing is I do NOT want all frames to have to have the same scale.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
12-28-09, 05:31 PM   #8
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Pretty sure you have to go with the second option. In your case, oUF_Player is spawned by the oUF:Spawn() call, during with the initial attributes are set. After it's been spawned, only SetScale will change the scale, but by then it's too late to avoid taint issues if called in combat.
  Reply With Quote
12-28-09, 06:10 PM   #9
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
What wurmfood says is correct, except that single frames spawned directly are created before the combat restriction hits. Setting scale outside the function is really only an issue for header frames.

And to Dawn, you might want to take a look at how oUF_Lily is split up when it comes to handling multiple units in one layout.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Adding scale to a layout


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