WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF 1.4 documentation thread (https://www.wowinterface.com/forums/showthread.php?t=33563)

zork 06-28-10 07:21 AM

oUF 1.4 documentation thread
 
Maybe we can gather some kind of documentation thread for all the oUF 1.4 features.

Current wiki:
http://wiki.github.com/haste/oUF/

oUF 1.4 the list
http://www.wowinterface.com/forums/s...ad.php?t=29937

Latest commit:
http://github.com/haste/oUF/commits/master

zork 06-28-10 07:22 AM

What I'm looking for is a documentation on how to spawn units.

Especially those that can be tricky.

- party
- raid
- boss
- vehicle
- partypet
- raidpet
- arena
- arenatarget

haste 06-28-10 08:04 AM

Here's the wiki related todo items on my list:
- [3] Document changes between 1.3.x and 1.4.x
- [3] Write wiki page about pit falls
- [2] Write wiki page about the core
- [1] Write wiki page about auras
- [1] Write wiki page about how the event handler differ
- [1] Write wiki page about how hooks/callbacks work
- [1] Write wiki page about portraits
- [1] Write wiki page about rune bar
- [1] Write wiki page about tags
- [1] Write wiki page about the element system
- [1] Write wiki page about the range element

The number in front is the priority it has. I won't be able to do anything with any of these until August however =/.

Dawn 06-28-10 08:20 AM

I'm currently spawning maintank (and maintank target via xml template) and boss frames like this

Code:

        self:SetActiveStyle"Nivea - Boss"
        local boss = {}
                for i = 1, MAX_BOSS_FRAMES do
                        local unit = self:Spawn("boss"..i, "oUF_NiveaBoss"..i)

                        if i==1 then
                                unit:SetPoint("CENTER", 400, 200)
                        else
                                unit:SetPoint("TOPLEFT", boss[i-1], "BOTTOMLEFT", 0, -10)
                        end
                        boss[i] = unit
                end
               
        self:SetActiveStyle"Nivea - MainTank"
        local Main_Tank = self:SpawnHeader("oUF_MainTank", nil, 'raid,party,solo',
                'showRaid', true,
                "groupFilter", "MAINTANK",
                'yOffset', -20,
                "template", "oUF_NiveaMTartemplate"
        )
        Main_Tank:SetPoint("TOP", UIParent, "TOP", 540, -280)


and I adress them via

Code:

local UnitSpecific = {
        boss = function(self)
                Shared(self)
               
                self.Power:SetWidth(Ncfgfs.width.M)                       
                self:SetAttribute('initial-height', Ncfgfs.height.M)
                self:SetAttribute('initial-width', Ncfgfs.width.M)               
        end,
       
        MainTank = function(self)
                Shared(self)
               
                self.Power:SetWidth(Ncfgfs.width.M)                       
                self:SetAttribute('initial-height', Ncfgfs.height.M)
                self:SetAttribute('initial-width', Ncfgfs.width.M)               
        end,       
               
}

I don't know if that's a good way, but it works. I'll have to look into arena frames, later.

zork 06-28-10 02:57 PM

Can anyone explain my the new SpawnHeader for party please. God...this doesn't work for me...:(

crap...I had to use a setpoint on party...

haste 06-28-10 03:18 PM

oUF:SpawnHeader(overrideName, template, visibility, ...)
- overrideName: just a custom frame name. Leaving it as nil/false will make oUF generate one based on style (and "unit"). Like: oUF_LilyParty.
- template: What template to base the header on. Leaving it as nil/false will make oUF use SecureGroupHeaderTemplate.
- visibility: A comma separated string that controls the headers visibility. By default oUF defines the following states:
Code:

raid40: Show when in a raid with 26 or more, but not party.
raid25: Show when in a raid with 11 or more, but not party.
raid10: Show when in a raid with 6 or more, but not party.
raid: Show when in a raid, but not party.
party: Show when in a party, but not raid.
solo: Show when not in a group.

- ...: Just a list of attributes you want to set on the header. It's what replaces :SetManyAttributes().

You can also create custom visibility rules with:
Code:

custom [combat] show;hide
Using oUF_Lily's :SpawnHeader() as an example:
Lua Code:
  1. local party = self:SpawnHeader(nil, nil, 'raid,party,solo', 'showParty', true, 'showPlayer', true, 'yOffset', -20)
  2. party:SetPoint("TOPLEFT", 30, -30)
This spawns a party frame named oUF_<Style>Party, which is shown when you are in a raid, party or solo. It also sets the attributes showParty and showPlayer as they are required to populate the header with units.

The main reason that it has solo in the visibility list is really because I tend to do showSolo, true when I want to test some minor things. It can safely be removed.

Hope this helps slightly at least :P.

haste 06-28-10 03:22 PM

Oh, and don't be afraid to ask questions regarding 1.4.x stuff. My vacation starts in 36 hours, so I'll probably be quite AFK until the weekend. I'll try to answer as much as possible before that time.

Dawn 06-28-10 09:30 PM

Is it possible to use raid10, raid25 and raid40 as UnitSpecific, directly? I mean just like player, pet, etc.

Something like this ...

Code:

local UnitSpecific = {
        raid10 = function(self)
                Shared(self)
                                       
                self:SetAttribute('initial-height', 26)
                self:SetAttribute('initial-width', 80)               
        end,
       
        raid25 = function(self)
                Shared(self)
                               
                self:SetAttribute('initial-height', 20)
                self:SetAttribute('initial-width', 40)               
        end,       
               
}

That would be pretty damn awesome, because you could have different raidframes for different raid sizes, really easy. :eek:

haste 06-29-10 01:44 AM

oUF doesn't really know about the visibility states when it executes the style function, but it does feed it 'party' and 'raid' now, instead of nil.

aiikachi 06-29-10 08:38 AM

In previous versions of oUF, my personal layout had a code to skin the mirrorbars to match my castbars...It seems that that same code is currently non-functional in 1.4. I am in no means an expert at lua, but if you could point me in the right direction to updating my code for 1.4, I'd appreciate it.

Rostok 06-29-10 11:59 AM

oUF does not care about mirrorbars.

Code:

for _, bar in pairs({'MirrorTimer1','MirrorTimer2','MirrorTimer3',}) do 
        for i, region in pairs({_G[bar]:GetRegions()}) do
                if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
                        region:Hide()
                end
        end

        _G[bar..'Border']:Hide()

        _G[bar]:SetParent(UIParent)
        _G[bar]:SetPoint('TOP', UIParent, 'TOP', 0, -300)
        _G[bar]:SetScale(1)
        _G[bar]:SetHeight(16)
        _G[bar]:SetWidth(180)
        _G[bar]:SetBackdrop(backdrop)
        _G[bar]:SetBackdropColor(0,0,0)

        _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
        _G[bar..'Background']:SetTexture(texture)
        _G[bar..'Background']:SetAllPoints(bar)
        _G[bar..'Background']:SetVertexColor(29/255,29/255,29/255,.75)

        _G[bar..'Text']:SetFont(font,9)
        _G[bar..'Text']:ClearAllPoints()
        _G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)

        _G[bar..'StatusBar']:SetAllPoints(_G[bar])
        _G[bar..'StatusBar']:SetStatusBarTexture(texture)
        _G[bar..'StatusBar']:GetStatusBarTexture():SetHorizTile(false)
end

Nothing in this is related to oUF (don't play anymore, so I don't know if this works).

aiikachi 06-29-10 03:51 PM

Thanks for the quick reply Rostok. That code was very similar to what I had previously used, and with a little tweeking is now working for me just fine :)

zork 06-30-10 04:19 AM

My own oUF/elements/aura.lua documentation

Hopefully most of the stuff is correct

--[[

Elements handled: self.Auras, self.Buffs, self.Debuffs

Icon sub-objects:
- button.overlay: contains the border that will get displayed on on specific debuffs
- button.parent:containts the parent object the current button is attached to
- button.icon: the texture of the aura icon that is displayed on the button
- button.count: some buttons have a stack (count) this is the fontstring that contains the stack
- button.cd: the cooldown spiral

Other sub-objects:
- icon.isPlayer: is the caster of the icon the player
- icon.owner: owner of the icon
- icon.filter: filter for icon display
- icon.debuff: defines if the icon is a debuff
- auras.visibleBuffs: number of visible buffs displayed
- auras.visibleDebuffs: number of visible debuffs displayed
- auras.visibleAuras: number of visible auras displayed

self.Auras, self.Buffs, self.Debuffs (shared):
- .spacing: Padding between aura icons. (Default: 0)
- .size: Size of the aura icons. (Default: 16)
- .initialAnchor: Initial anchor in the aura frame. (Default: "BOTTOMLEFT")
- .onlyShowPlayer: Only display icons casted by the player. (Default: nil)
- ["growth-x"]: Growth direction, affected by initialAnchor. (Default: "UP")
- ["growth-y"]: Growth direction, affected by initialAnchor. (Default: "RIGHT")
- .disableCooldown: Disable the Cooldown Spiral on the Aura Icons. (Default: nil)
- .filter: Expects a string with filter. See the UnitAura[1] documentation for more information.
[1] http://www.wowwiki.com/API_UnitAura

.Auras only:
- .gap: Adds a empty icon to separate buffs and debuffs. (Default: nil)
- .numBuffs: The maximum number of buffs that should be shown. (Default: 32)
- .numDebuffs: The maximum number of debuffs that should be shown. (Default: 40)
- .buffFilter: See filter on Shared. (Default: "HELPFUL")
- .debuffFilter: See filter on Shared. (Default: "HARMFUL")
- Variables set by .Auras:
- .visibleBuffs: Number of currently visible buff icons.
- .visibleDebuffs: Number of currently visible debuff icons.
- .visibleAuras: Total number of currently visible buffs + debuffs.

.Buffs only:
- .num: The maximum number of buffs that should be shown. (Default: 32)
- Variables set by .Buffs:
- .visibleBuffs: Number of currently visible buff icons.

.Debuffs only:
- .num: The maximum number of debuffs that should be shown. (Default: 40)
- Variables set by .Debuffs:
- .visibleDebuffs: Number of currently visible debuff icons.

Functions that can be overridden from within a layout:
- PostCreateIcon(self, button)
- PostUpdateIcon(self, unit, icon, index, offset)
- PostUpdate(self, unit)
- PreUpdate(self, unit)
- PreSetPosition(self, num)

Examples on how to attach functions to your layout:

--------------------------------------------------
-- POSTCREATEICON FUNCTION
-- lets you style aura icons after they got created
--------------------------------------------------


local function myPostCreateIcon(self, button)
--do stuff
end

--possible calls
self.Auras.PostCreateIcon = myPostCreateIcon
self.Buffs.PostCreateIcon = myPostCreateIcon
self.Debuffs.PostCreateIcon = myPostCreateIcon

--------------------------------------------------
-- POSTUPDATEICON FUNCTION
-- lets you do stuff to aura icons once they got updated
--------------------------------------------------


local function myPostUpdateIcon(self, unit, icon, index, offset)
--do stuff
end

--possible calls
self.Auras.PostUpdateIcon = myPostUpdateIcon
self.Buffs.PostUpdateIcon = myPostUpdateIcon
self.Debuffs.PostUpdateIcon = myPostUpdateIcon

--------------------------------------------------
-- POSTUPDATE FUNCTION
-- lets you do stuff to auras after they get updated
--------------------------------------------------


local function myPostUpdate(self, unit)
--do stuff
end

--possible calls
self.Auras.PostUpdate = myPostUpdate
self.Buffs.PostUpdate = myPostUpdate
self.Debuffs.PostUpdate = myPostUpdate

--------------------------------------------------
-- PREUPDATE FUNCTION
-- lets you do stuff to auras before they get updated
--------------------------------------------------


local function myPreUpdate(self, unit)
--do stuff
end

--possible calls
self.Auras.PreUpdate = myPreUpdate
self.Buffs.PreUpdate = myPreUpdate
self.Debuffs.PreUpdate = myPreUpdate

--------------------------------------------------
-- PRESETPOSITION FUNCTION
-- lets you do stuff to auras before they get arranged in position
--------------------------------------------------


local function myPreSetPosition(self, num)
--do stuff
end

--possible calls
self.Auras.PreSetPosition = myPreSetPosition
self.Buffs.PreSetPosition = myPreSetPosition
self.Debuffs.PreSetPosition = myPreSetPosition

]]--

Luzzifus 07-01-10 01:44 AM

Quote:

Originally Posted by haste (Post 194937)
oUF:SpawnHeader(overrideName, template, visibility, ...)
- template: What template to base the header on. Leaving it as nil/false will make oUF use SecureGroupHeaderTemplate.

How do I use those templates? Are they like tags but for frame style or is it something else?

Rostok 07-01-10 02:56 AM

Code:

local party = self:SpawnHeader(nil, nil, 'raid,party,solo', 'showParty', true, 'showPlayer', true, 'yOffset', -20)
in the oUF_Lily code.

Dawn 07-01-10 06:42 PM

Question: How to adress party pets and raid pets?

I'm using

Code:

local UnitSpecific = {
        player = function(self)

        party = function(self)
etc.

end

Is there something like "partypet"? I know party pet doesn't work, but...

I spawn party pets via XML, they are there, but they inherit everything from party (oh wonder...).

How can I change the appearance of party and raid pets? How to adress them if I build my layout like that?

haste 07-02-10 08:47 AM

Quote:

Originally Posted by Luzzifus (Post 195297)
How do I use those templates? Are they like tags but for frame style or is it something else?

They're XML templates. oUF just feeds them directly to CreateFrame/:SetAttribute.

LCFHeLL 07-03-10 09:43 AM

is it buff or?
 
can't understand, how can i find is it buff or debuff in a PostCreateIcon function...
now I use different functions for creating icons for buffs and debuffs, perhaps you can do as it otherwise?

Freebaser 07-03-10 10:28 AM

Quote:

Originally Posted by LCFHeLL (Post 195654)
can't understand, how can i find is it buff or debuff in a PostCreateIcon function...
now I use different functions for creating icons for buffs and debuffs, perhaps you can do as it otherwise?

Have you tried using PostUpdateIcon instead?

zork 07-03-10 10:36 AM

Just check for button.debuff ! This one is filled if the aura is a debuff.


All times are GMT -6. The time now is 11:17 AM.

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