Thread Tools Display Modes
04-15-12, 04:09 AM   #1
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 264
Beautycase borders on Grid2 units

So, I've been trying to find where Grid2 handles its healthbars so I can add !beautycase borders to them with its "createborderlight" function, but I can't find it. Anyone that can help me with this?

Or, if there's another way to skin the borders of the actual unitframes, not just the background frame, that would be great

Thanks in advance!
  Reply With Quote
04-16-12, 08:38 AM   #2
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 264
I've been trying to find something similar with "statusbar", or a createframe that creates the health statusbar, or just the background of each unit. Without luck, though.
  Reply With Quote
04-16-12, 01:30 PM   #3
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Post

Here is a standalone version of the code I use to apply borders to Grid. It's been a while since I looked at the internals of Grid2, but I don't think the basics of frame setup is that different. Maybe it will give you some clues, especially the parts I highlighted in gold. The parts highlighted in green are specific to my border code, so may need changes for use with Beautycase.
Code:
local function SkinGrid()
	local GridFrame = Grid and Grid:GetModule("GridFrame")
	if GridFrame and GridFrame.registeredFrames then
		-- print("Adding borders to Grid frames")

		local function Grid_SetBackdropBorderColor(f, r, g, b, a)
			if a and a == 0 then
				f:SetBorderColor()
			else
				f:SetBorderColor(r, g, b)
			end
		end

		local function Grid_AddBorder(f)
			if not f.SetBorderColor then
				f:SetBorderSize(0.1)
				AddBorder(f)
				f.SetBackdropBorderColor = Grid_SetBackdropBorderColor
				f.SetBorderSize = noop
			end
		end

		for frame in pairs(GridFrame.registeredFrames) do
			Grid_AddBorder(_G[frame])
		end

		local o = GridFrame.RegisterFrame
		GridFrame.RegisterFrame = function(self, f)
			o(self, f)
			Grid_AddBorder(f)
		end

		return true
	end
end

if not SkinGrid() then
	local f = CreateFrame("Frame")
	f:RegisterEvent("ADDON_LOADED")
	f:RegisterEvent("PLAYER_LOGIN")
	f:SetScript("OnEvent", function()
		if SkinGrid() then
			f:UnregisterAllEvents()
			f:SetScript("OnEvent", nil)
			SkinGrid = nil
		end
	end)
end

Last edited by Phanx : 04-17-12 at 03:48 PM.
  Reply With Quote
04-17-12, 12:11 PM   #4
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 264
Thanks for sharing Phanx! Really nice of you, I think I took water over my head on this one

I've moved back to Grid because I like it better, and trying to get your code to work. To be honest, LUA is still an unfamiliar thing for me so I don't really know what to do with this code. Could I please ask for your help?

Here are the borders I'm trying to add btw;

  Reply With Quote
04-17-12, 03:47 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by lerb View Post
To be honest, LUA is still an unfamiliar thing for me so I don't really know what to do with this code. Could I please ask for your help?
Create a folder named "GridBorders" in your AddOns folder. Inside it, create a file named "addon.lua" and paste the code into it, and then create a basic TOC file named "GridBorders.toc" and paste this into it:
Code:
## Interface: 40300
addon.lua
Also, I edited my previous post to highlight the lines that may need to be changed for use with Beautycase instead of my personal border addon.
  Reply With Quote
05-10-12, 03:58 PM   #6
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 264
Hi again Phanx! Hope you don't mind me necroing this thread.

I've been playing around with this again lately and got it working a little bit, but I can't get it to skin all the units. I've used /fstack to find out the names of the frames for the actual units in grid, not the background frame, and tried to attach a beautycase border to them with the beautycase function, which looks like this when I'm using your code;

Code:
		local function Grid_AddBorder(f)
			CreateBorderChat(GridLayoutHeader1UnitButton1, LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, 2)
		end
As you can see, if I hover myself in grid the frame is named GridLayoutHeader1UnitButton1. There was a couple of different frames to choose from but this one worked. Problem is, sometimes there's up to 40 of these. Do you have any clue how I could get a border on every unit? I guess I could create 40 CreateBorder lines, but that doesn't seem to be the correct way to go.

The different frames appearing when hovering the first unit in my party/raid with /fstack is;

1. GridLayoutHeader1UnitButton1
2. GridLayoutHeader1
3. GridLayoutFrame

Here's the full code as it looks right now, I have no way if it is efficient as it is now but at least it's partially working;

Code:
local function SkinGrid()
	local GridFrame = Grid and Grid:GetModule("GridFrame")
	if GridFrame and GridFrame.registeredFrames then
		-- print("Adding borders to Grid frames")

		local function Grid_AddBorder(f)
			CreateBorderChat(GridLayoutHeader1UnitButton1, LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, 2)
		end

		local o = GridFrame.RegisterFrame
		GridFrame.RegisterFrame = function(self, f)
			o(self, f)
			Grid_AddBorder(f)
		end

		return true
	end
end

if not SkinGrid() then
	local f = CreateFrame("Frame")
	f:RegisterEvent("ADDON_LOADED")
	f:RegisterEvent("PLAYER_LOGIN")
	f:SetScript("OnEvent", function()
		if SkinGrid() then
			f:UnregisterAllEvents()
			f:SetScript("OnEvent", nil)
			SkinGrid = nil
		end
	end)
end
And here's a screen to explain what I mean. As you can see, only the first "UnitButton" is skinned.


Last edited by lerb : 05-10-12 at 05:11 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Beautycase borders on Grid2 units


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