Thread Tools Display Modes
Unread 09-08-09, 06:49 AM   #1
Kodewulf
Premium Member
 
Kodewulf's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 112
nUI Layout Test

First off, this is pre-alpha-alpha code...

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.

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...

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.

-- Kodewulf
Attached Files
File Type: zip nUI_Test.zip (1.5 KB, 778 views)
__________________
I will never forget. I will never regret. I will live my life.
Kodewulf is offline  
Unread 09-08-09, 07:11 AM   #2
Petrah
A Pyroguard Emberseer
 
Petrah's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 2,865
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.
__________________
♪~ ( ) I My Sonos!
Petrah is offline  
Unread 09-08-09, 07:19 AM   #3
Kodewulf
Premium Member
 
Kodewulf's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 112
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
__________________
I will never forget. I will never regret. I will live my life.
Kodewulf is offline  
Unread 09-08-09, 08:17 AM   #4
Petrah
A Pyroguard Emberseer
 
Petrah's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 2,865
I'll try again... thanks for pointing that out
__________________
♪~ ( ) I My Sonos!

Last edited by Petrah : 09-08-09 at 01:00 PM.
Petrah is offline  
Unread 09-08-09, 10:48 AM   #5
Xrystal
nUI User and Supporter
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,030
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.
__________________
Xrystal is offline  
Unread 09-10-09, 07:14 AM   #6
Kodewulf
Premium Member
 
Kodewulf's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 112
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.
__________________
I will never forget. I will never regret. I will live my life.
Kodewulf is offline  
Unread 09-10-09, 07:26 AM   #7
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
THey should be in [ Interface > AddOns > nUI > Layouts > Default > HUDLayouts > {hud mode} > nUI_HUDSkin_{hud mode}_Target.lua ]
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
spiel2001 is offline  
Unread 09-10-09, 07:58 AM   #8
Kodewulf
Premium Member
 
Kodewulf's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 112
If you look at the attached image, the area marked with the red is what I'd like to move.
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_091009_235503.gif
Views:	824
Size:	34.7 KB
ID:	3358  
__________________
I will never forget. I will never regret. I will live my life.
Kodewulf is offline  
Unread 09-10-09, 08:39 AM   #9
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
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 ]
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
spiel2001 is offline  
Unread 09-10-09, 08:58 AM   #10
Kodewulf
Premium Member
 
Kodewulf's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 112
Beeeaaaauuutiful... 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.
__________________
I will never forget. I will never regret. I will live my life.
Kodewulf is offline  
 

Go BackWoWInterface » Featured Projects » nUI, MozzFullWorldMap and PartySpotter » Customization » nUI: Developer Chat » nUI Layout Test

Thread Tools
Display Modes

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