Loading...

[Elvui] Custom Datatext panels

1
Hi guys.
Can someone help me to create custom datatext panels through plugin for Elvui?
I have this

Code: Select all

local E, L, V, P, G = unpack(ElvUI)
local EUI = E:NewModule('ExUI', 'AceHook-3.0', 'AceEvent-3.0', 'AceTimer-3.0')
local EP = LibStub('LibElvUIPlugin-1.0')
local DT = E:GetModule('DataTexts')

local l_dt_panel = CreateFrame('Frame', 'LeftDatatextPanel', E.UIParent)
local r_dt_panel = CreateFrame('Frame', 'RightDatatextPanel', E.UIParent)

do
	DT:RegisterPanel(LeftDatatextPanel, 1, 'ANCHOR_BOTTOM', 0, -4)
	DT:RegisterPanel(RightDatatextPanel, 1, 'ANCHOR_BOTTOM', 0, -4)

	L['LeftDatatextPanel'] = L['Datatext Left Panel']
	L['RightDatatextPanel'] = L['Datatext Right Panel']
end

local function CreateDTPanels()
	-- Left
	l_dt_panel:Point('CENTER', E.UIParent, 'CENTER', 0, 0)
	l_dt_panel:Size(200, 20)
	l_dt_panel:SetTemplate('Default')
	l_dt_panel:SetFrameStrata('LOW')
	--Right
	r_dt_panel:Point('CENTER', E.UIParent, 'CENTER', 0, 25)
	r_dt_panel:Size(200, 20)
	r_dt_panel:SetTemplate('Default')
	r_dt_panel:SetFrameStrata('LOW')
end

function EUI:Initialize()
	CreateDTPanels()
end
Panels created, but didn't registered in elvui config. Can't set text for this panels.

And second question is:
Elvui have options to create 'Custom Text' for unitframes. How to create new custom text for unitframes through plugin installer?
My english is not so good, so i think thats enough to understand me. ;)
Ext#21124

[Elvui] Custom Datatext panels

2

Code: Select all

	L['LeftDatatextPanel'] = L['Datatext Left Panel']
	L['RightDatatextPanel'] = L['Datatext Right Panel']
Should probably be

Code: Select all

	L['LeftDatatextPanel'] = 'Datatext Left Panel'
	L['RightDatatextPanel'] = 'Datatext Right Panel'
You also need to add your datatext panels to the existing panels table:

Code: Select all

P.datatexts.panels['LeftDatatextPanel'] = {['middle'] = ''}
P.datatexts.panels['RightDatatextPanel'] = {['middle'] = ''}
The ElvUI config builds the table of available datatext panels by looking at the P.datatexts.panels table.

I would suggest that you pick a more unique name for your custom datatext panels, as "LeftDatatextPanel" is very generic and may clash with other plugins which uses the same name. A good idea is to prefix it with ExUI_ perhaps, so it becomes "ExUI_LeftDatatextPanel".
ElvUI: Request Feature | Report Bug

My replies might be short sometimes due to time constraints. Nothing personal.

[Elvui] Custom Datatext panels  [Accepted Answer]

4
Oh yeah, sorry.

The way you would do it is this:

Code: Select all

--Create customTexts table for the player unit (but only if it does not exist)
E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["customTexts"] or {}
--Create table for My Unique CustomText Name
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"] = {}
--Set settings for My Unique CustomText Name
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["attachTextTo"] = "Health"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["font"] = "Arial Narrow"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["justifyH"] = "LEFT"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["fontOutline"] = "OUTLINE"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["xOffset"] = 0
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["yOffset"] = 0
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["text_format"] = "[namecolor][name:short]"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["size"] = 16
You can also shorten most of it to just be

Code: Select all

--Create customTexts table for the player unit (but only if it does not exist)
E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["customTexts"] or {}
--Create table for My Unique CustomText Name and set settings
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"] = {
	["attachTextTo"] = "Health",
	["font"] = "Arial Narrow",
	["justifyH"] = "LEFT",
	["fontOutline"] = "OUTLINE",
	["xOffset"] = 0,
	["yOffset"] = 0,
	["text_format"] = "[namecolor][name:short]",
	["size"] = 16,
}
If you export settings from a profile ingame in the plugin format, then you will get it in the format as outlined in my first example. You will need to add the code to create the tables yourself though.
ElvUI: Request Feature | Report Bug

My replies might be short sometimes due to time constraints. Nothing personal.

[Elvui] Custom Datatext panels

6
Blazeflack wrote: Mon Apr 09, 2018 6:29 pm Oh yeah, sorry.

The way you would do it is this:

Code: Select all

--Create customTexts table for the player unit (but only if it does not exist)
E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["customTexts"] or {}
--Create table for My Unique CustomText Name
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"] = {}
--Set settings for My Unique CustomText Name
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["attachTextTo"] = "Health"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["font"] = "Arial Narrow"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["justifyH"] = "LEFT"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["fontOutline"] = "OUTLINE"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["xOffset"] = 0
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["yOffset"] = 0
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["text_format"] = "[namecolor][name:short]"
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"]["size"] = 16
You can also shorten most of it to just be

Code: Select all

--Create customTexts table for the player unit (but only if it does not exist)
E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["customTexts"] or {}
--Create table for My Unique CustomText Name and set settings
E.db["unitframe"]["units"]["player"]["customTexts"]["My Unique CustomText Name"] = {
	["attachTextTo"] = "Health",
	["font"] = "Arial Narrow",
	["justifyH"] = "LEFT",
	["fontOutline"] = "OUTLINE",
	["xOffset"] = 0,
	["yOffset"] = 0,
	["text_format"] = "[namecolor][name:short]",
	["size"] = 16,
}
If you export settings from a profile ingame in the plugin format, then you will get it in the format as outlined in my first example. You will need to add the code to create the tables yourself though.
Hi, i want to create a Datatext, that shows me in wich Raid Group i'm actually in e.g. "Group 2" or "Grp 2" . Can i use this code to geht it work? I think i'm missing something like the connection to figure out in which Grp i'm in. How can i realize this?

[Elvui] Custom Datatext panels

8
Regarding DataText Panels, I created four of them (Top, Bot, Left, Right) to create a cinematic Viewport to watch and record WOW on my 46" TV. They look awesome, and so less finicky than other options I've tried like Sunnart and Viewport, plus it's all tied into ELVUI/BENKUI which I love.

Quick question tho, I notice when I export my profile to other accounts that the DataText panels don't show up on the others. Well they're there, when I go into DataTexts>Panels on the other accounts I can see all four of them, but they're empty, with just the Position dropdowns and a delete button, none of the other editing options. Is that by design that you can't export them? Or a glitch in the matrix (ie something I've stuffed up)?

https://ibb.co/xzrfp3N