|Go to Page...|
|Thread Tools||Display Modes|
|05-30-21, 08:13 AM||#1|
A Kobold Labourer
Join Date: Aug 2019
Upgrading old addon for BCC Backdrop change.
I've been trying to get sRaidFrames working on BCC for a bit now, but not being great at LUA I'm having trouble getting the suggestions in other threads about this working.
Since the addon had an outdated Ace3 version I swapped in the most recent version of that first which seems to have worked fine. Then based on this and some of the posts here, I edited the lines with CreateFrame that I could see how to easily, adding the BackdropTemplateMixin and "BackdropTemplate" part, but I'm still seeing these errors
Message: Interface\AddOns\sRaidFrames\sRaidFrames.lua:1451: attempt to call method 'SetBackdrop' (a nil value)
Message: Interface\AddOns\sRaidFrames\sRaidFrames.lua:1705: attempt to call global 'UnitHasVehicleUI' (a nil value)
As to not crowd this post with code blocks, here's the code around the first error I'm seeing, but there's more not throwing errors (yet), or ones that I couldn't figure out how to edit looking at examples, so checking the full source is probably best.
This code corresponds to
It's line 98 in that which causes the first error, but there are more examples in the full code.
Any advice or pointing in the right direction is greatly appreciated. Thanks!
|05-30-21, 09:22 AM||#2|
I did that?
In every version of the game up to Classic Vanilla, frames were created with a backdrop by default. Since then (Shadowlands/Classic TBC), backdrops are optional and you have to "add" them to your frame(s) if you want one.
This is done by either inheriting the BackdropTemplate when the frame is created or via a Mixin after the frame is created. The template/mixin adds all the regions and methods originaly gained by default like :SetBackdrop(), :SetBackdropColor() etc.
The following allows your code to be use in all versions by detecting if the mixin or one of the backdrop methods exist.
To add on during creation:
local = CreateFrame("Frame", "name", parent, BackdropTemplateMixin and "BackdropTemplate")
if not frame.SetBackdrop then Mixin(frame, BackdropTemplateMixin) end
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
Last edited by Fizzlemizz : 05-30-21 at 01:42 PM.
|WoWInterface » Developer Discussions » Lua/XML Help » Upgrading old addon for BCC Backdrop change.|