Thread Tools Display Modes
01-07-14, 02:48 PM   #61
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
No, in your Spawn function. The function that gets called when a new frame is created. The function where you actually define "self.Buffs" and/or "self.Debuffs".
__________________
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
01-07-14, 09:05 PM   #62
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
No, in your Spawn function. The function that gets called when a new frame is created. The function where you actually define "self.Buffs" and/or "self.Debuffs".
You right, that got it working, now I just need to do something about this gap here.

Probably just see if I can figure out how to anchor the debuff frame above the buff frame without having to limit the number of Buffs.

code

figured a basic way to do this would be
Code:
Debuffs:SetPoint("BOTTOM",Buffs,"TOP",0,1)
but when the buffs come to a second row they overlap with the debuffs :/ I guess I want have to watch for an event and then update the position?
__________________
Tweets YouTube Website
  Reply With Quote
01-07-14, 10:51 PM   #63
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
(1) Add somewhere:
Code:
local function Buffs_PostUpdate(element, unit)
	local rows = ceil(element.visibleBuffs / element.iconsPerRow)
	element:SetHeight(rows * (element.size + element.spacing))
end
(2) In your spawn function, add the green bits, remove the blue ones:
Code:
        Buffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 1)
        Buffs:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, 1)
        Buffs:SetPoint'LEFT'
        Buffs:SetPoint'RIGHT'
        Buffs:SetHeight(cfg.Buffs.size + cfg.Buffs.spacing)

        Buffs.iconsPerRow = floor(self:GetWidth() / (cfg.Buffs.size + cfg.Buffs.spacing) + 0.5)
        Buffs.PostUpdate = Buffs_PostUpdate

        Debuffs:SetPoint("BOTTOMLEFT", Buffs, "TOPLEFT")
        Debuffs:SetPoint("BOTTOMRIGHT", Buffs, "TOPRIGHT")
        Debuffs:SetPoint'LEFT'
        Debuffs:SetPoint'RIGHT'
oUF offers tons of hooks for elements -- you should really spend some time reading the oUF element code to see what's available. Pretty much every element has at least a PreUpdate and PostUpdate (or an Override if you want to control the whole update yourself) and many elements have more.
__________________
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.

Last edited by Phanx : 01-08-14 at 03:34 AM.
  Reply With Quote
01-07-14, 11:18 PM   #64
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
(1) Add somewhere:
Code:
local function Buffs_PostUpdate = function(element, unit)
	local rows = ceil(element.visibleBuffs / element.iconsPerRow)
	element:SetHeight(rows * (element.size + element.spacing)
end
(2) In your spawn function, add the green bits, remove the blue ones:
Code:
        Buffs:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 1)
        Buffs:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, 1)
        Buffs:SetPoint'LEFT'
        Buffs:SetPoint'RIGHT'
        Buffs:SetHeight(cfg.Buffs.size + cfg.Buffs.spacing)

        Buffs.iconsPerRow = floor(self:GetWidth() / (cfg.Buffs.size + cfg.Buffs.spacing) + 0.5)
        Buffs.PostUpdate = Buffs_PostUpdate

        Debuffs:SetPoint("BOTTOMLEFT", Buffs, "TOPLEFT")
        Debuffs:SetPoint("BOTTOMRIGHT", Buffs, "TOPRIGHT")
        Debuffs:SetPoint'LEFT'
        Debuffs:SetPoint'RIGHT'
oUF offers tons of hooks for elements -- you should really spend some time reading the oUF element code to see what's available. Pretty much every element has at least a PreUpdate and PostUpdate (or an Override if you want to control the whole update yourself) and many elements have more.
Still doesn't work right. Though I don;t see why call SetPoint twice

Got this error
Code:
1x oUF_Bob-1\modules\units.lua:483: "(" expected near "="


Locals:
function script
buff script

I'll browse oUF see what's there figured I;d post that here because you would probably answer before I find something. Mostly because your awesome like that Phanx

EDIT:
Shouldn't the function be like this rather than calling function twice in the same line?

Code:
local function Buffs_PostUpdate(element, unit)
	local rows = ceil(element.visibleBuffs / element.iconsPerRow)
	element:SetHeight(rows * (element.size + element.spacing))
end
__________________
Tweets YouTube Website

Last edited by 10leej : 01-07-14 at 11:23 PM.
  Reply With Quote
01-08-14, 03:33 AM   #65
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by 10leej View Post
Though I don;t see why call SetPoint twice
SetPoint sets a point. You can call it multiple times to set multiple points -- in this case you want to attach the bottom left corner of the buffs to the top left corner of the unit frame, and the bottom right corner of the buffs to the top right corner of the unit frame. This achieves the same result as attaching the bottom of the buffs to the top of the frame + using SetWidth on the buffs with the same value you used on the frame, except that it will automatically change the width of the buffs if you change the width of the frame.

Also, you were already calling SetPoint three times -- you were anchoring bottomleft-to-topleft, and left-to-left, and right-to-right -- to achieve the same results, but less sensibly.

Originally Posted by 10leej View Post
Got this error
Look at the line indicated. There's a missing parenthesis. I didn't read through your code but I assume it's on the line from my last post:

Code:
element:SetHeight(rows * (element.size + element.spacing))
Originally Posted by 10leej View Post
Shouldn't the function be like this rather than calling function twice in the same line?
Erm, yes. Obvious synax error is obvious. >_>
__________________
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
01-08-14, 05:54 PM   #66
bartg71
A Murloc Raider
Join Date: Oct 2011
Posts: 9
turning off 3d Portraits?

Love the Unit Frames w/built in xp/rep etc, works great. Only thing I was wondering howerver, is if there was a way to turn off the 3D portraits? Didn't see anything about portrait control in the config.lua unless I totally missed something. Any help would be greatly appreciated. Thx! If there isnt a way to do this currently, could there be added a way to set a 'class icon' as the portrait instead, or option to turn portrait box off or both? Just curious-- love the work all you lovely addon peeps do, was thinking of starting work on learnin' how to do this myself but havent found the time yet sadly.
  Reply With Quote
01-08-14, 07:32 PM   #67
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by bartg71 View Post
Love the Unit Frames w/built in xp/rep etc, works great. Only thing I was wondering howerver, is if there was a way to turn off the 3D portraits? Didn't see anything about portrait control in the config.lua unless I totally missed something. Any help would be greatly appreciated. Thx! If there isnt a way to do this currently, could there be added a way to set a 'class icon' as the portrait instead, or option to turn portrait box off or both? Just curious-- love the work all you lovely addon peeps do, was thinking of starting work on learnin' how to do this myself but havent found the time yet sadly.
Turn the portrait on and off can be done easily not certain on a class icon in portrait that's something I'll have to look for
__________________
Tweets YouTube Website
  Reply With Quote
01-08-14, 10:35 PM   #68
bartg71
A Murloc Raider
Join Date: Oct 2011
Posts: 9
portrait stuff

Mostly looking to have the 3d portrait able to be turned off entirely or the ability to remove any portrait at all, so its just the plain health / mana / power bar etc., if thats doable.
  Reply With Quote
01-09-14, 05:01 PM   #69
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Mostly looking to have the 3d portrait able to be turned off entirely or the ability to remove any portrait at all, so its just the plain health / mana / power bar etc., if thats doable.
Got that in the beta svn now upload is pending.

SetPoint sets a point. You can call it multiple times to set multiple points -- in this case you want to attach the bottom left corner of the buffs to the top left corner of the unit frame, and the bottom right corner of the buffs to the top right corner of the unit frame. This achieves the same result as attaching the bottom of the buffs to the top of the frame + using SetWidth on the buffs with the same value you used on the frame, except that it will automatically change the width of the buffs if you change the width of the frame.

Also, you were already calling SetPoint three times -- you were anchoring bottomleft-to-topleft, and left-to-left, and right-to-right -- to achieve the same results, but less sensibly.
Honestly I was using what haste used in oUF_Classic for auras at the time.

Anyways got all but party/raid, boss, and arena now working on the boss frames now planning on have the arena frames share the same config though i don't really know the intelligence in that.

Problem is that i'm not sure I'm spawning the boss frames right because their not showing with phanx's test code.

spawn code
unit specific settings
__________________
Tweets YouTube Website

Last edited by 10leej : 01-09-14 at 05:18 PM.
  Reply With Quote
01-09-14, 06:01 PM   #70
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by 10leej View Post
Honestly I was using what haste used in oUF_Classic for auras at the time.
Yeah, I've seen him (and Tekkub) anchor/size things that way, and I really don't understand why. It seems completely illogical, and also inefficient since the same result could be achieved more logically with fewer function calls.

Originally Posted by 10leej View Post
Problem is that i'm not sure I'm spawning the boss frames right because their not showing with phanx's test code.
they're*

Code:
for index = 1, MAX_BOSS_FRAMES do
        -- (1) Unit tokens are lowercase. This should be "boss"..index
        -- not "Boss"..index. In practice, most/all functions don't
        -- actually care, but you should do it right anyway.
        local boss = self:Spawn('Boss' .. index)
        if(index == 1) then
                boss:SetPoint('TOPRIGHT', BOTTOMRIGHT, 'BOTTOM', -5, -50)
        else
                boss:SetPoint('TOP', _G['oUF_BobBoss' .. index - 1], 'BOTTOM', 0, -6)
        end

        -- (2) You don't need to do this. oUF already
        -- handles disabling Blizzard frames.
        local blizzardFrames = _G['Boss' .. index .. 'TargetFrame']
        blizzardFrames:UnregisterAllEvents()
        blizzardFrames:Hide()
end
Other than those minor issues, are the frames actually being created?
/dump oUF_BobBoss4 and "EXISTS" or "DOES NOT EXIST"
You might also want to add some print statements in your code so you can see what's happening as it happens.
__________________
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
01-09-14, 06:49 PM   #71
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
ok so if I put a print command in the unit specific section I get a message in the chat frame.

run the dump script I get

Dump: value=oUF_BobBoss4 and "EXISTS" or "DOES NOT EXIST"
[1]="DOES NOT EXIST"
so frame what that means I guess my frames aren't spawning correctly or possibly my test script I screwed up on

code
__________________
Tweets YouTube Website
  Reply With Quote
01-09-14, 08:49 PM   #72
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Sounds like you are using the wrong frame name somewhere. When you're spawning frames, you're anchoring them to oUF_BobBossX, but in your test code you're referring to oUFBobBossX with no underscore. Add print(self:GetName()) in your spawn function to see what oUF is auto-naming the frame (I'm pretty sure it removes underscores) or pass an explicit name if you really want that awkward underscore.
__________________
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
01-09-14, 09:18 PM   #73
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
Sounds like you are using the wrong frame name somewhere. When you're spawning frames, you're anchoring them to oUF_BobBossX, but in your test code you're referring to oUFBobBossX with no underscore. Add print(self:GetName()) in your spawn function to see what oUF is auto-naming the frame (I'm pretty sure it removes underscores) or pass an explicit name if you really want that awkward underscore.
turns out their called "oUF_Boss" I shoulda guessed that but for some reason I had it stuck in my head they would inherit the layout name like all the other frames seem to.

Ok so now I've got pretty much everything spawning (i think) just gotta setup a debuff filter for raid debuffs and should be set.

code
__________________
Tweets YouTube Website

Last edited by 10leej : 01-09-14 at 10:32 PM.
  Reply With Quote
01-10-14, 05:36 AM   #74
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Phanx View Post
Yeah, I've seen him (and Tekkub) anchor/size things that way, and I really don't understand why. It seems completely illogical, and also inefficient since the same result could be achieved more logically with fewer function calls.
I wouldn't really worry much about a few extra function calls to fairly lightweight functions. :P
__________________
「貴方は1人じゃないよ」
  Reply With Quote
01-10-14, 01:25 PM   #75
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by haste View Post
I wouldn't really worry much about a few extra function calls to fairly lightweight functions. :P
Eh it works.

Anyways how would I go about having the raid and party frames spawn horizontally?
__________________
Tweets YouTube Website
  Reply With Quote
01-10-14, 05:19 PM   #76
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
This should get you going

https://github.com/tekkub/wow-ui-sou...rs.lua#L24-L53
https://github.com/haste/oUF_Classic....lua#L300-L307

Last edited by p3lim : 01-10-14 at 05:22 PM.
  Reply With Quote
01-10-14, 06:11 PM   #77
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by haste View Post
I wouldn't really worry much about a few extra function calls to fairly lightweight functions. :P
The reduction in function calls is a collateral benefit. The real question is why you anchor BOTTOM->TOP and LEFT and RIGHT when you really want to anchor BOTTOMLEFT->TOPLEFT and BOTTOMRIGHT->TOPRIGHT instead of just doing that directly?
__________________
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
01-10-14, 07:17 PM   #78
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Ok I think i got everything now except I found out in a lfr test run that my alternate power bar doesn't work. Might just be because I'm running it in a player specific stuff rather than the global haven't tried it elsewhere mostly because outside of a raid not sure where to go to get that to show up. Probably something in the darkmoon fair does it.

Still need to do:
soul shards
holy power
shadow orbs
warlock stuff
chi

addon download
code

anyways got all the frame loading now
Attached Thumbnails
Click image for larger version

Name:	frames.PNG
Views:	153
Size:	858.3 KB
ID:	7998  
__________________
Tweets YouTube Website
  Reply With Quote
01-10-14, 09:26 PM   #79
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Dem giant frames. You must be even blinder than me!

Your alt power bar is invisible because it's one-dimensional -- you only gave it a height, but not a width.

On a side note, rather than checking IsAddOnLoaded("!Beautycase") you should just check it once at the top of the file, assign the return to a variable, and then check the variable.

Oh, and this is some awesome redundancy right here:
Code:
local function Aura_PostCreateIcon(element, button)
        if IsAddOnLoaded("!Beautycase") then
                button:CreateBeautyBorder(12) --skin it
        else
                return
        end
end
__________________
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.

Last edited by Phanx : 01-10-14 at 09:32 PM.
  Reply With Quote
01-10-14, 10:39 PM   #80
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
Dem giant frames. You must be even blinder than me!
that's actually just a cut out from my screen, I run the game at a 4k resolution so it will look larger to you. Due to my UI scale

Originally Posted by Phanx View Post
Your alt power bar is invisible because it's one-dimensional -- you only gave it a height, but not a width.
I uh... guess I forgot that >.>

Originally Posted by Phanx View Post
On a side note, rather than checking IsAddOnLoaded("!Beautycase") you should just check it once at the top of the file, assign the return to a variable, and then check the variable.
__________________
Tweets YouTube Website

Last edited by 10leej : 01-10-14 at 10:44 PM.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Trying my hand at ouf


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