Loading...
Forum Rules:
You may only create a new thread here if you have created a guide on how to do something with Tukui. Do not create a thread here if you just want to ask how to do something.

Hints and examples of Tukui Editing

1
Not truely a guide but some smaller examples of Tukui plugins and a basic framework to start your own plugin or edit. These are all externally done like Tukz wants.
They were all made over the course of time by following other examples, copy pasting code, adjusting and learning step by step. Each plugin is small and uses some simple coding.

To start your own edit, there is a basic Tukui plugin on this list, it will make sure your own modification will load and that it's edited externally.

the examples can show you how to:

- add textures to a panel
- create new panels
- adjust small parts of Tukui
- create a new option in the Tukui config
- set some descriptions for those options
- add your own texture
- add your own font
- ...

https://www.tukui.org/addons.php?cat=18

Fot those interested hopefully a bit of a guide to help them out?
Last edited by Maximvs on Wed Aug 23, 2017 2:19 pm, edited 1 time in total.
Maximvs-Aszune, MaxUI

Hints and examples of Tukui Editing

5
Things I learned doing by trying, examining, searching the internet, looking at someone else's code. Probably not the real terms or explanations but something to get you on your way. (Still a lua noob in many ways). this is not complete in any way, hoping to update it once in a while.

CREATE A PANEL:
the creation of a new panel starts like this:

Code: Select all

local YourOwnPanel = CreateFrame("Frame", "Thisismynewpanel", UIParent)

Code: Select all

local YourOwnPanel = CreateFrame("Frame", "YourOwnPanel", self)
local = needed so it's used locally, in this code/file only.
YourOwnPanel = the name you give your panel in the code, case sensitive!
CreateFrame = function to create the Frame
Frame = type of Frame
Thisismynewpanel = unique name so it can be found, you can also use the same name you used at the beginning of the line.
UIParent = the panel or frame that your new panel is a child of. Which frame it follows it's behavior from.
self = it has no parent, nothing to stick to or follow.

DIMENSIONS:
Ways to set the size of a panel:

Code: Select all

YourOwnPanel:Size(200, 40)
YourOwnPanel:Width(200)
YourOwnPanel:Height(40)

YourOwnPanel:Size(200+2, 40-3)
YourOwnPanel:Width(200+2)
YourOwnPanel:Height(40)

YourOwnPanel:Height(SomePanel:GetHeight())
YourOwnPanel:Height(SomePanel:GetWidth())

YourOwnPanel:Height(SomePanel:GetHeight() +2)
YourOwnPanel:Height(SomePanel:GetWidth() -3)

YourOwnPanel:Height(SomePanel:GetWidth() *2)
YourOwnPanel:Height(SomePanel:GetWidth() /3)
POSITIONING:
The position of your panel, relative to something else. Read it as:

Code: Select all

YourOwnPanel:Point("TOPLEFT", UIParent, "TOPLEFT", 6, -14)
I want to anchor YourOwnPanel's TOPLEFT to UIParent's TOPLEFT, but I want it 6 pixels to the right and 14 pixels lower.

anchor points you can use:
"TOPLEFT"
"LEFT"
"BOTTOMLEFT"
"BOTTOM"
"BOTTOMRIGHT"
"RIGHT"
"TOPRIGHT"

The first number is the X-Axis, Left (-any number, negative) and Right (+any number, positive)
The second number is the Y-Axis, Up (+any number, positive) and Down (+any number, negative)

ALPHA SETTINGS:
You can make a panel less or more solid by entering a number between 0 (opaque) and 1 (solid)

Code: Select all

YourOwnPanel:SetAlpha(1)
YourOwnPanel:SetAlpha(OtherPanel:GetAlpha())

FRAME LEVEL:
the level a frame has, tells if a frame is in front or behind another frame on the same strata/layer.

Code: Select all

YourOwnPanel:SetFrameLevel(2)
YourOwnPanel:SetFrameLevel(OtherPanel:GetFrameLevel() +1)
FRAME STRATA:
a kind of layer in which your panel is placed, so it will show up in front of other elements on lower layers.

Code: Select all

YourOwnPanel:SetFrameStrata("BACKGROUND")
BACKGROUND - Used by default for static UI elements such as the PlayerFrame and Minimap
LOW - Used by default for lower-priority UI elements such as the party member and target frames
MEDIUM - Default frame strata for general usage
HIGH - Used by default for higher-priority UI elements such as the Calendar and Loot frames
DIALOG - Used by default for alerts and other dialog boxes which should appear over nearly all other UI elements
FULLSCREEN - Used by default for full-screen windows such as the World Map
FULLSCREEN_DIALOG - Used by default for alerts or dialog boxes which should appear even when a full-screen window is visible
TOOLTIP - Used for mouse cursor tooltips, ensuring they appear over all other UI elements

TEMPLATES:

Code: Select all

YourOwnPanel:SetTemplate()
SHADOW:

Code: Select all

YourOwnPanel:CreateShadow("Default")
HIDING WHILE IN COMBAT/VISIBILITY OPTIONS AND BEHAVIOR:

Code: Select all

RegisterStateDriver(YourOwnPanel, "visibility", "[combat] hide; show")
ADDING COLOR:

Code: Select all



ADDING TEXT:

Code: Select all



ADDING TEXTURES/IMAGES:

Code: Select all



MOVABLE:

Code: Select all



SHOW/HIDE:

Code: Select all

YourOwnPanel:Show()
YourOwnPanel:Hide()
MOUSEOVER:

Code: Select all



HOOKING IT TO THE FUNCTIONS TUKUI ALREADY CREATED:

Code: Select all

local T, C, L = Tukui:unpack()

local function Enable()

end
hooksecurefunc(Panels, "Enable", Enable)
COMPLETE:
For adding a panel in your edit based on Tukui and hooking it to Tukui's functions:

Code: Select all

local T, C, L = Tukui:unpack()

local function Enable()
	local YourOwnPanel = CreateFrame("Frame", "Thisismynewpanel", UIParent)
	YourOwnPanel:SetTemplate()
	YourOwnPanel:Point("CENTER", UIParent, "CENTER", 6, -14)
	YourOwnPanel:Width(200)
	YourOwnPanel:Height(40)
	YourOwnPanel:SetAlpha(0.6)
	YourOwnPanel:SetFrameStrata("BACKGROUND")
	YourOwnPanel:SetFrameLevel(2)
	YourOwnPanel:CreateShadow("Default")
	RegisterStateDriver(YourOwnPanel, "visibility", "[combat] hide; show")

	local OtherPanel = CreateFrame("Frame", "OtherPanel", Thisismynewpanel)
	OtherPanel:SetTemplate()
	OtherPanel:Point("TOPLEFT", Thisismynewpanel, "BOTTOMRIGHT", 6, -14)
	OtherPanel:Width(YourOwnPanel:GetWidth()/2)
	OtherPanel:Height(YourOwnPanel:GetHeight()/2)
	OtherPanel:SetAlpha(0.3)
	OtherPanel:SetFrameStrata("BACKGROUND")
	OtherPanel:SetFrameLevel(YourOwnPanel:GetFrameLevel()+1)
	OtherPanel:CreateShadow("Default")
	RegisterStateDriver(OtherPanel, "visibility", "[combat] hide; show")
end
hooksecurefunc(Panels, "Enable", Enable)
Maximvs-Aszune, MaxUI