WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   nUI: Developer Chat (https://www.wowinterface.com/forums/forumdisplay.php?f=96)
-   -   nUI Layout Test (https://www.wowinterface.com/forums/showthread.php?t=27168)

Kodewulf 09-08-09 06:49 AM

nUI Layout Test
 
1 Attachment(s)
First off, this is pre-alpha-alpha code... :D

This is an attempt to manage the nUI layout without editing the nUI core files. It's main purpose is to move the ui elements around a bit too fit nicely into all those new cool nUI dashboards, but it should be possible to override any layout info from nUI_DefaultConfig.

I used nUI Tribal for the artwork. Please download and install that prior to trying this out.

Right, now for the code. :)

Code:

local frame = CreateFrame( "Frame", "nUI_Test", UIParent )
This is the standard create frame code found in most artwork plugins.

Code:

local function setupSkin()
        if not nUI then return end
        if not nUI_DefaultConfig then return end

        if not nUI_Skins then nUI_Skins = {}; end
        local skin = nUI_Skins["custom"] or nUI_DefaultConfig
       
        -- skin.MicroMenu.options.enabled = "no"
        skin.MicroMenu.anchor = {
                -- anchor_pt  = "BOTTOM",
                -- relative_to = "nUI_TopBars",
                -- relative_pt = "BOTTOM",
                -- xOfs        = 15,
                -- yOfs        = 150,
                anchor_pt  = "TOP",
                relative_to = "nUI_Dashboard",
                relative_pt = "TOP",
                xOfs        = 440,
                yOfs        = -60,
        }
       
        -- skin.ButtonBars.nUI_ActionBar.btn_size = 53.5    -- 53.5
        -- skin.ButtonBars.nUI_ActionBar.gap      = 2        -- 2
        -- skin.ButtonBars.nUI_ActionBar.anchor  = "BOTTOM" -- "BOTTOM"
        skin.ButtonBars.nUI_ActionBar.xOfs    = -300        -- 0
        skin.ButtonBars.nUI_ActionBar.yOfs    = 150          -- 123
        -- skin.ButtonBars.nUI_ActionBar.rows    = 1        -- 1
        -- skin.ButtonBars.nUI_ActionBar.cols    = 12      -- 12
       
        nUI_Options.onebag = true
       
        skin.BagBar.anchor = "BOTTOM"
        skin.BagBar.xOfs = 130
        skin.BagBar.yOfs = 150

        skin.SpecialBars.anchor.xOfs        = -595
        skin.SpecialBars.anchor.yOfs        = 210

        nUI_Skins["custom"] = skin
        nUI_Options.skin = "custom"
        frame:UnregisterEvent("ADDON_LOADED")
end

This is where the magic happens. :D

Code:

local function setupArtwork()
        nUI_TopBars1:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_2_Console" );
        nUI_TopBars2:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_2_Console" );
        nUI_TopBars3:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_2_Console" );
        nUI_TopBars4:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_2_Console" );
        nUI_TopBars5:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_2_Console" );

        nUI_BottomBars1:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_21" );
        nUI_BottomBars2:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_22" );
        nUI_BottomBars3:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_23" );
        nUI_BottomBars4:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_24" );
        nUI_BottomBars5:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_25" );
       
        nUI_Dashboard_Panel1:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_21" );
        nUI_Dashboard_Panel2:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_22" );
        nUI_Dashboard_Panel3:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_23" );
        nUI_Dashboard_Panel4:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_24" );
        nUI_Dashboard_Panel5:SetTexture( "Interface\\AddOns\\nUI_Carbon_Tribal_2\\nUI_Carbon_Tribal_25" );

        frame:UnregisterEvent("PLAYER_ENTERING_WORLD");
end

I just wrapped the code from the onEvent from the skin into a new function.

Code:

local function onEvent(self, event, ...)
        if event == "ADDON_LOADED" then
                setupSkin()
        elseif event == "PLAYER_ENTERING_WORLD" then
                setupArtwork()
        end
end

This is the new onEvent code. Simple. On "ADDON_LOADED" it loads your skin settings, effectively overriding nUI_DefaultConfig. When "PLAYER_ENTERING_WORLD" fires the artwork gets loaded.

Code:

frame:SetScript("OnEvent", onEvent)
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")

The obligatory Setscript and RegisterEvent thingies. :)

Unfortunately I'm graphically challenged so all the layout coords and offsets might be all wrong, but I expect you skin guru's will be able to figure things out. Enjoy the code. If it works for you: "Wooooo!!!"; if not, then it wasn't me... :D

Feel free to tweak things, even calling me an idiot and fixing things would be ok. I'm off to bed now, haven't slept in 2 days so this code might very well make your goldfish swallow your cat. :banana:

-- Kodewulf

Petrah 09-08-09 07:11 AM

I've never had any issues with getting an addon to show up in the list, but for the life of me I cannot get the tribal skin to show up (I'm on the PTR). The only addons I have installed are nUI, nUI Test, and nUI Tribal. The other two are showing up just fine, just not the skin.

Kodewulf 09-08-09 07:19 AM

It's because it's in a sub folder. In the archive it's in

Code:

nUI_Carbon_Tribal\nUI_Carbon_Tribal_2\
but all the files should just be in

Code:

nUI_Carbon_Tribal_2\
-- Kodewulf

Petrah 09-08-09 08:17 AM

I'll try again... thanks for pointing that out ;)

Xrystal 09-08-09 10:48 AM

Ah, I was wondering if it was possible to change some settings in a separate addon so that I don't have to keep editing the files to make my main action bar buttons bigger and my micro menu customed.

Kodewulf 09-10-09 07:14 AM

Any of you coding gurus know where the coords for the target auras are defined? Might just be because I'm trying to do this at 4am, but it seems to be eluding me. :)

spiel2001 09-10-09 07:26 AM

THey should be in [ Interface > AddOns > nUI > Layouts > Default > HUDLayouts > {hud mode} > nUI_HUDSkin_{hud mode}_Target.lua ]

Kodewulf 09-10-09 07:58 AM

1 Attachment(s)
If you look at the attached image, the area marked with the red is what I'd like to move. :)

spiel2001 09-10-09 08:39 AM

Ah... okay... you'll find that in the "help" segment of the ["Aura"] section in [ Interface > AddOns > nUI > Layouts > Default > UnitPanels > {panel mode} > nUI_UnitSkin_{panel mode}Target.lua ]

Kodewulf 09-10-09 08:58 AM

Beeeaaaauuutiful... :D You're my hero. I'm so glad you have a grip on the complex code that is nUI. I'm slowly getting the hang of things. By the time I understand it all, I'll have to start learning v6.x I imagine. Lol.


All times are GMT -6. The time now is 01:05 PM.

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