Thread Tools Display Modes
07-19-20, 08:43 AM   #1
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
SetBackdropBorderColor removed in 9.0?

Hello,
While testing one of my addons on the PTR server, I got this error:
Code:
attempt to call method 'SetBackdropBorderColor' (a nil value)
It's in a frame script, from an XML document:
Code:
		<Scripts>
			<OnLoad>
				self.SetText=function(self,arg)
					self:SetBackdropBorderColor(0.5,0.5,0.5);
					self:SetBackdropColor(0.3,0.3,0.3,0.5);
				end;
			</OnLoad>
		</Scripts>
SetBackdropBorderColor is removed in Shadowlands? Is there an equivalent?

Thanks.
  Reply With Quote
07-19-20, 08:48 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Might be related to this ... https://us.forums.blizzard.com/en/wo...beta/586355/11

"One of the major changes in 9.0 is a change to SetBackdrop. The TL/DR, on live, 100% of frames support backdrops, whether they are used or not. 1000s of frames between every addon and default UI, even frames that never see such as event frames have backdrops. UI team realized this is a serious performance issue. so effective in 9.0, no frames have backdrops unless the addon imports/inherits the backdrop template.
this means addons that aren’t importing them now throw nil errors with method “Setbackdrop”. This issue affects a large number of addons."
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
07-19-20, 09:42 AM   #3
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Thank you very much.
  Reply With Quote
07-19-20, 01:27 PM   #4
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
Originally Posted by Zax View Post
testing one of my addons on the PTR server
PTR is on 9.x or do you mean Beta?
  Reply With Quote
07-19-20, 04:14 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by sezz View Post
PTR is on 9.x or do you mean Beta?

Retail PTR is showing as 8.3.7 to me .. so I assume they are talking about the Beta which has the Backdrop changes in place.
__________________
  Reply With Quote
07-19-20, 11:53 PM   #6
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Sorry, I'm talking about the beta (9.x).
  Reply With Quote
07-20-20, 05:56 PM   #7
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,237
How does one import or inherit the SetBackdrop template? Preferably in Lua. I dislike XML.
  Reply With Quote
07-20-20, 06:21 PM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,857
Code:
local f = CreateFrame("Frame", nil, self, BackdropTemplateMixin and "BackdropTemplate")
Testing for BackdropTemplateMixin is to differentiate between 9 and pre 9.

Then use as normal:
Code:
f:SetBackdrop({ ... })
This is from people that are in the Beta.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-20-20 at 06:23 PM.
  Reply With Quote
07-20-20, 07:11 PM   #9
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,237
Cool, thanks. Do the mixin and template exist on 8.3.x? I'm guessing no.
  Reply With Quote
07-20-20, 07:28 PM   #10
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by myrroddin View Post
Cool, thanks. Do the mixin and template exist on 8.3.x? I'm guessing no.
Nope new to 9.0.1

https://www.townlong-yak.com/framexml/beta
Backdrop.lua / Backdrop.xml
__________________
  Reply With Quote
07-20-20, 08:22 PM   #11
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,857
Using:
Code:
BackdropTemplateMixin and "BackdropTemplate"
Allows the same code to exist/run in both 8.x and 9+ versions ie. if the mixin doesn't exist, don't use the template and if it does, magic it in.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-28-20, 09:03 AM   #12
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
I don't understand how could I apply alpha to a texture/background using this new syntax:
Code:
f.Backdrop = _G[name.."Backdrop"] or CreateFrame("Frame", name.."Backdrop", f, "BackdropTemplate")
f.Backdrop:SetAllPoints()
f.Backdrop.backdropInfo = {
	bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
	edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
	tile = true,
	tileSize = 32,
	edgeSize = 32,
	insets = { left = 11, right = 12, top = 12, bottom = 9, },
}
f.Backdrop:ApplyBackdrop()
Thank you.
  Reply With Quote
07-28-20, 10:18 AM   #13
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,857
Same as normal. The Mixin that is applied when using the template applies all the pre 9x backdrop methods to the frame. Nothing really changes once you've inherited the template.

Lua Code:
  1. if not f.Backdrop then
  2.     f.Backdrop = CreateFrame("Frame", name.."Backdrop", f, "BackdropTemplate")
  3.     f.Backdrop:SetAllPoints()
  4.     f.Backdrop.backdropInfo = {
  5.         bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background-Dark",
  6.         edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  7.         tile = true,
  8.         tileSize = 32,
  9.         edgeSize = 32,
  10.         insets = { left = 11, right = 12, top = 12, bottom = 9, },
  11.     }
  12.     f.Backdrop:SetBackdrop(f.Backdrop.backdropInfo)
  13.     f.Backdrop:SetBackdropColor(r, g, b, a)
  14.     f.Backdrop:SetBackdropBorderColor(r, g, b, a)
  15. end
f could just have easily inherited the backdrop template negating the need for a separate frame unless the backdrop is applied after the frame is created eg. something like KGPanels where a backdrop can be added/removed at runtime.

Example
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-28-20 at 10:55 AM.
  Reply With Quote
07-28-20, 12:26 PM   #14
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Originally Posted by Fizzlemizz View Post
Same as normal. The Mixin that is applied when using the template applies all the pre 9x backdrop methods to the frame. Nothing really changes once you've inherited the template.
Nice, I didn't understand this point.

Thank you very much
  Reply With Quote
08-02-20, 04:43 AM   #15
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Originally Posted by Fizzlemizz View Post
Code:
local f = CreateFrame("Frame", nil, self, BackdropTemplateMixin and "BackdropTemplate")
Testing for BackdropTemplateMixin is to differentiate between 9 and pre 9.
And what about Classic? Is Blizzard planning to change SetBackdrop() in Classic also?

As I am actually in the process of update my addons to 9.x, I would like some of them to work in Classic.
The problem is many of my frames are defined in XML, and of course inherits="BackdropTemplate" raises an error in Classic.

So, if Classic will not use BackdropTemplate, is there a way to dynamically modify an inheritance defined in XML?

Thanks.
  Reply With Quote
08-02-20, 10:08 AM   #16
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,857
Test and add a backdrop frame in the OnLoad script:

This adds an extra frame for the backdrop rather than just inheriting the template.
Code:
<Frame>
  <Scripts>
    <OnLoad>
    	if BackdropTemplateMixin then
		self.background = CreateFrame("Frame", nil, self, "BackdropTemplate")
		self.background:SetAllPoints()
		self.background:SetBackdrop({ ... })
      		self.background:SetFrameLevel(self:GetFrameLevel())
      	end
    </OnLoad>
  </Scripts>
</Frame>
Blizzard are not concerned with making addons compatible between Classic and Retail. Addon authors have to decide how far they are willing to go if that's what they want to do.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-02-20 at 10:16 AM.
  Reply With Quote
08-03-20, 12:54 AM   #17
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Nice trick, thank you
  Reply With Quote
08-03-20, 01:10 AM   #18
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,857
Once again, not mine. I don't have beta access.

This would need to add some "pass-through" methods to the parent frame if you are modifying the backdrop during play and want to maintain the single code base for retail and classic.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
08-04-20, 08:55 AM   #19
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Adding this since it's probably useful:

If you want to add a backdrop to a frame you don't control the creation of (e.g. from another addon), you can mix in the mixin:
Lua Code:
  1. Mixin(yourFrame, BackdropTemplateMixin)

Then you should be able to use :SetBackdrop and the likes on that frame.
  Reply With Quote
08-04-20, 11:36 AM   #20
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Originally Posted by p3lim View Post
Lua Code:
  1. Mixin(yourFrame, BackdropTemplateMixin)
Great!

Now I just have to use this code on OnLoad of my old frames, without inherits="BackdropTemplate" and it works on both 8.x and 9.0 versions:
Code:
---------------------------------- testing WoW version
local wowversion, wowbuild, wowdate, wowtocversion = GetBuildInfo()
if (wowtocversion > 90000) then Mixin(self, BackdropTemplateMixin)
---------------------------------- same code for 8.x and 9.x
self:SetBackdrop({
	bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", 
	edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
	tile = true,
	tileSize = 32,
	edgeSize = 32,
	insets = {left = 12, right = 12, top = 12, bottom = 11},
})
----------------------------------
  Reply With Quote

WoWInterface » PTR » PTR API and Graphics Changes » SetBackdropBorderColor removed in 9.0?

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