Loading...

[TukUI] actionbar swapping

#1
I've been working on my own external edit of TukUI (on and off) and one thing I've been stuck on for a while is the difference between the actionbars in TukUI and default Blizz (which I currently use). I'm used to a particular set of keybinds and swapping to TukUI gives me the same keybinds for the same spells but they are on the 'wrong' bars. So I'm swapping the whole bars. My problem is with the retractable bar on the left, the buttons in my center top bar (button from that hideable bar) also hide.

I know I have re-positioned buttons and bars separate from each other, because I wanted to avoid said problem. But I'm not finding the solution. So can someone point me in the right direction? I've tried to SetParent for the buttons but that resulted in mirrored bars (with different keybinds, very funny) and tried to remove script, but so far it didn't work. Partly because I have no idea how the hide/show functionality is created, else I could possibly remove/recreate it on the right bars.

I have decent lua/programming knowledge and good google skills so use difficult words if you have to. Thanks!

Code: Select all

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

-- Keep forgetting which bar goes where in the original TukUI:
--
-- 										b
-- 										a
-- 										r
--	 									5
-- 									
--           bar 2	|	bar 4		|	bar 3
--			|	bar 1		|	

-- And I want:
-- 										b
-- 										a
-- 										r
--	 									4
-- 									
--           bar 5	|	bar 2		|	bar 3
--			|	bar 1		|	

local ActionBars = T["ActionBars"]
local Panels = T["Panels"]
local Size = C.ActionBars.NormalButtonSize
local PetSize = C.ActionBars.PetButtonSize
local Spacing = C.ActionBars.ButtonSpacing

local function AddPanels()
    local A1 = Panels.ActionBar1
    local A2 = Panels.ActionBar2
    local A3 = Panels.ActionBar3
    local A4 = Panels.ActionBar4
    local A5 = Panels.ActionBar5

    A1:ClearAllPoints()
    A1:SetPoint("BOTTOM", UIParent, "BOTTOM", 0, -1)
	A1:SetWidth((Size * 12) + (Spacing * 13) + Spacing * 4)
    
end

hooksecurefunc(ActionBars, "AddPanels", AddPanels)


local function Bar2()
    local A2 = Panels.ActionBar2
    local A5 = Panels.ActionBar5

    --Fix position for each button in the bar
    for i = 1, NUM_ACTIONBAR_BUTTONS do
        if (i == 1) then
			A2["Button"..i]:ClearAllPoints()
			A2["Button"..i]:SetPoint("LEFT", A5, "LEFT", Spacing,-Spacing)
		else
			A2["Button"..i]:ClearAllPoints()
			A2["Button"..i]:SetPoint("LEFT", A2["Button"..(i-1)], "RIGHT", Spacing, 0)
		end
    end
    --Set new width/height of the whole bar and give the bar it's new position
    -- A2:SetWidth((Size * 13))
    -- A2:SetHeight((Size * 1))
    -- A2:ClearAllPoints()
    -- A2:SetPoint("BOTTOMLEFT", A1, "TOPLEFT", 0, 0)
end

hooksecurefunc(ActionBars, "CreateBar2", Bar2)


local function Bar4()
    local A4 = Panels.ActionBar4

    --Fix position for each button in the bar
    for i = 1, NUM_ACTIONBAR_BUTTONS do
        if (i == 1) then
			A4["Button"..i]:ClearAllPoints()
			A4["Button"..i]:SetPoint("TOPLEFT", A4, Spacing, -Spacing)
		else
			A4["Button"..i]:ClearAllPoints()
			A4["Button"..i]:SetPoint("TOPLEFT", A4["Button"..(i-1)], "BOTTOMLEFT", 0, -Spacing)
		end
    end
    --Set new width/height of the whole bar and give the bar it's new position
	A4:SetWidth((Size * 1) + (Spacing * 2))
	A4:SetHeight((Size * 12) + (Spacing * 13) + (Spacing * 4))
    A4:ClearAllPoints()
    A4:SetPoint("RIGHT", UIParent, "RIGHT", -1, 0)
end

hooksecurefunc(ActionBars, "CreateBar4", Bar4)

local function Bar5()
    local A1 = Panels.ActionBar1
    local A2 = Panels.ActionBar2
    local A5 = Panels.ActionBar5

	A5:SetScript("OnHide", nil)
	A5:SetScript("OnShow", nil)
	
    --Fix position for each button in the bar
    for i = 1, NUM_ACTIONBAR_BUTTONS do
        if (i == 1) then
			A5["Button"..i]:ClearAllPoints()
			A5["Button"..i]:SetPoint("TOPLEFT", A2, "TOPLEFT", Spacing, -Spacing)
		elseif (i == 7) then
			A5["Button"..i]:ClearAllPoints()
			A5["Button"..i]:SetPoint("TOP", A5["Button"..1], "BOTTOM", 0, -Spacing)
		else
			A5["Button"..i]:ClearAllPoints()
			A5["Button"..i]:SetPoint("LEFT", A5["Button"..(i-1)], "RIGHT", Spacing, 0)
		end
    end
    --Set new width/height of the whole bar and give the bar it's new position
	A5:SetWidth((Size * 12) + (Spacing * 13) + Spacing * 4)
	A5:SetHeight((Size * 1) + (Spacing * 2))
	A5:ClearAllPoints()
    A5:SetPoint("BOTTOM", A1, "TOP", 0, 0)
end

hooksecurefunc(ActionBars, "CreateBar5", Bar5)

[TukUI] actionbar swapping

#2
I guess you don't want to remap your actionbars and use the standard Tukui layout? (you could make a backup of your keybindings file in the addons folder, to keep the old ones and remap for tukui?

I've done a lot of reanchoring and reworking on the actionbars in MaxUI, take a look at the code, maybe that will point you in the right direction? the problem with the show/hide functionality (anchoring, reparenting, ....) eluded me too, I just made those buttons unavailable by hiding them completely for several layouts.

Those buttons are created in Tukui/Modules/ActionBars/Buttons.lua.

I did something like:

Code: Select all

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

------------------------------------------------------------------------------------------
--Show Hide Button adjustments
------------------------------------------------------------------------------------------

local ActionBars = T["ActionBars"]

local KillToggleButtons = function()
	for i = 4, 5 do
		local Button = T.Panels["ActionBar" .. i .. "ToggleButton"]
		Button:SetScript("OnEnter", nil)
		Button:SetScript("OnLeave", nil)
		Button:SetScript("OnClick", nil)
		Button:Hide()
	end
	
	for i = 2, 3 do
		local Button = T.Panels["ActionBar" .. i .. "ToggleButton"]
		Button:SetScript("OnEnter", nil)
		Button:SetScript("OnLeave", nil)
		Button:SetScript("OnClick", nil)
		Button:Hide()
	end
end
hooksecurefunc(ActionBars, "CreateToggleButtons", KillToggleButtons)
button 4 and 5 are buttons at actionbar 4 and 5, and 2 and 3 are used for the side actionbars.

Probably not quite the answer you wanted, but perhaps it helps
Maximvs-Aszune, MaxUI

[TukUI] actionbar swapping

#3
Some notes for you:
Parenting frames inherits some properties to the child but more importantly it places a call chain for several standard functions. e.g. a hide() call on the parent will also hide all its children. This is not the case with anchoring.
Anchoring only positions elements. You try to put your Bar2 buttons on the Bar5 panel. While that alone would work the show/hide call chain is still the old. So hiding the original Bar2 would empty your new Bar5. (Looking at your sketch you want the it the other way round anyway)

So in fact you need to do both: the anchoring of the buttons to their new position and also making them child of the bar(panel) you put them on. In that case you wouldnt move the panels then. I guess the show/hide buttons still wouldnt work correctly though when not affecting the whole bar at once because they are searched by name and that would still be wrong.

[TukUI] actionbar swapping

#4
Thank you both!

Maximvs:
I have your UI somewhere for reference, but I didn't look at your actionbars for this problem. I do like the retractable bars so I would like to keep that functionality. Thanks anyways for your code :) and thanks for pointing me to /Buttons.lua.

Jericho:
I figured something like that. With my current code it indeed works as you say. I did try to SetParent(A2)/SetParent(A5) on the buttons. And this made the bars work like they should but resulted in the spells getting copied from the main (#1) actionbar to both bar 2 and 5... which I totally not understand. Checked it again before I post this: If I add SetParent(A5) to the buttons of bar 2, they get the spells from bar 1. Same holds for the buttons of bar 5, see screenshot. But the show/hide functionality does work correctly. Should have maybe explained this in my original post, but didn't want to write a whole book :3

So I should either change the way the spells are added to the bar (which sounds like a bad plan) or somehow remove/add the hide functionality for the repositioned bars... I guess this will take a while :p
Image

[TukUI] actionbar swapping

#5
If you end up deciding that it isn't worth the effort to move around the actionbar buttons, then you could always use an addon to move the spells to different actionbuttons.
An example would be https://mods.curse.com/addons/wow/action-bar-profiles

You can create a profile with that addon for use with default actionbars, and then another profile that you use for Tukui actionbars.

At least it can be your plan B if all else fails :)
ElvUI: Request Feature | Report Bug

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

[TukUI] actionbar swapping

#6
Blazeflack wrote:
Wed Oct 25, 2017 3:46 pm
If you end up deciding that it isn't worth the effort to move around the actionbar buttons, then you could always use an addon to move the spells to different actionbuttons.
An example would be

You can create a profile with that addon for use with default actionbars, and then another profile that you use for Tukui actionbars.

At least it can be your plan B if all else fails :)
I'll keep that in mind Blaze! Problem is my serious case of perfectionism/OCD when it comes to these things :lol: I started an TukUI edit for the reason I like elegant/minimal solutions, that's why I want to fix these things in my edit and not with another addon. But it never hurts to know what things are out there :)

Who is online

Users browsing this forum: No registered users and 2 guests