Quantcast
oUF 10.0 Upgrade Guide for Shadowlands - WoWInterface
Thread Tools Display Modes
10-07-20, 01:57 PM   #1
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,703
oUF 10.0 Upgrade Guide for Shadowlands

Upgrade Guide

Aside from other API changes from Blizzard themselves (such as deprecated API or backdrops now requiring a template/mixin),
and other changes not directly related to oUF, here are the headlines for what's coming to oUF version 10.0 and Shadowlands.

Version 10.x of oUF is not backwards compatible, and will only work in Shadowlands and the prepatch coming October 13th.
This guide is here to aid layout authors in updating before that release.

Version 10.0.0 will be tagged and released on October 12th, but feel free to test out your layouts from the master branch on the beta or PTR in the mean time.

Breaking changes
  • AdditionalPower:
    • element:PostUpdate(unit, cur, max) callback signature changed to element:PostUpdate(cur, max)
    • element:UpdateColor(cur, max) override signature changed to element.UpdateColor(self, event, unit, powerType)
    • Removed support for automatically applying atlas as a widget texture
      • layouts can set these manually instead with element:SetStatusBarAtlas(atlas)
  • AlternativePower:
    • Removed support for automatically applying atlas as a widget texture
      • layouts can set these manually instead with element:SetStatusBarAtlas(atlas)
  • Castbar:
    • The entire element has been refactored, and callbacks have been merged and renamed:
      Code:
      castbar:PostCastStart(unit, name)
      castbar:PostChannelStart(unit, name)
      => castbar:PostCastStart(unit)
      
      castbar:PostCastDelayed(unit, name)
      castbar:PostChannelUpdate(unit, name)
      => castbar:PostCastUpdate(unit)
      
      castbar:PostCastStop(unit, name)
      castbar:PostChannelStop(unit, name)
      => castbar:PostCastStop(unit, spellID)
      
      castbar:PostCastFailed(unit)
      castbar:PostChannelInterrupted(unit)
      => castbar:PostCastFail(unit, spellID)
      
      castbar:PostCastNotInterruptible(unit)
      castbar:PostCastInterruptible(unit)
      => castbar:PostCastInterruptible(unit)
    • The .Spark sub-widget is now no longer positioned by the element, the layout needs to position this itself.
      This can be accomplished easily in the layout, e.g. with this:
      Lua Code:
      1. Castbar.Spark:SetPoint("CENTER", Castbar:GetStatusBarTexture(), "RIGHT", 0, 0)
    • Castbars for *target units are no longer supported (e.g. for targettarget, focustarget, or raid14target),
      as they had no event-driven updates, requiring constant polling.
  • Health:
    • element:UpdateColor(unit, cur, max) override signature changed to element.UpdateColor(self, event, unit)
  • Power:
    • element:UpdateColor(unit, cur, min, max, displayType) override signature changed to element.UpdateColor(self, event, unit)
    • Deprecated altPowerColor option has been removed
      • override the color through element:GetAlternativeColor() instead
    • Removed support for automatically applying atlas as a widget texture
      • layouts can set these manually instead with element:SetStatusBarAtlas(atlas)
  • Runes:
    • element:UpdateColor(runeID) override signature changed to element.UpdateColor(self, event, unit)
  • Stagger:
    • element:UpdateColor(cur, max) override signature changed to element.UpdateColor(self, event, unit)
    • Element now only available to player units
  • Tags:
    • The prefix and suffix delimiters have been changed from `>` and `<` into `$>` and `<$` respectively,
      allowing the `<` and `>` character to be used in prefixes and suffixes.

Non-breaking changes
  • AdditionalPower:
    • New callback element:PostUpdateColor(r, g, b)
    • New callback element:PostVisibility(isVisible)
    • New method element:SetFrequentUpdates(state[, force]) to toggle the frequent updates
    • New option frequentUpdates to update the element more frequently
  • AlternativePower:
    • Added multiple options for automatically updating the texture colors, alike health and power
    • New callback element:PostUpdateColor(unit, r, g, b)
    • New override element.UpdateColor(self, event, unit, ...)
  • Castbar:
    • Added .hideTradeSkills option, which when set to true will no longer display tradeskill-related casts
    • The .SafeZone sub-widget now supports vertically-oriented castbars properly
  • ClassPower:
    • New callback element:PostVisibility(isVisible)
    • New callback element:PostUpdateColor(r, g, b)
    • Holy power is now available for all Paladin specializations
  • Health:
    • New callback element:PostUpdateColor(unit, r, g, b)
    • New method element:SetColorDisconnected(state[, force]) to toggle disconnected color updates
    • New method element:SetColorSelection(state[, force]) to toggle target change color updates
    • New method element:SetColorTapping(state[, force]) to toggle tapped color updates
    • New method element:SetColorThreat(state[, force]) to toggle threat color updates
    • .frequentUpdates option was removed, as all health updates are "frequent" now
  • HealthPrediction:
    • .frequentUpdates option was removed, as all health updates are "frequent" now
  • PhaseIndicator:
    • Tooltip support, if the element is a Frame as opposed to a Texture
  • Power:
    • New callback element:PostUpdateColor(unit, r, g, b)
    • New method element:SetColorDisconnected(state[, force]) to toggle disconnected color updates
    • New method element:SetColorSelection(state[, force]) to toggle target change color updates
    • New method element:SetColorThreat(state[, force]) to toggle threat color updates
    • New override element:GetDisplayPower()
      • use this to override when the unit should show an alternate power type (e.g. Priest's insanity)
  • Runes:
    • New callback element:PostUpdateColor(r, g, b)
  • Stagger:
    • New callback element:PostUpdateColor(r, g, b)
  • Tags:
    • Tags can now be passed arguments, e.g. [shortname(5)], which will be passed directly to the tag implementation, e.g:
      Lua Code:
      1. oUF.Tags.Methods['shortname'] = function(unit, realUnit, arg1)
      2.     -- return the first N letters from the name, as provided by `arg1`
      3.     -- if arg1 is not provided, return the full name
      4.     return UnitName(realUnit or unit):sub(1, tonumber(arg1))
      5. end
      • You can add as many arguments as you want, separated by a single comma (e.g. [mytag(a,b,c,d)]).
      • Do not use spaces when separating the arguments (e.g. don't do this: [mytag(a, b, c, d)]).
  • Threat:
    • Threat color can now be customized through the color table


For the full details of all the changes, see the commit log.

For any questions regarding this specific upgrade guide, please reply to this thread.
For any issues, please search the issues tracker or open a new issue.
For anything not related to the upgrade guide, please search for an existing thread on the subject or open a new thread.
  Reply With Quote
10-16-20, 09:41 AM   #2
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 107
Thank you for that update guide! It already helped alot!

So among other things you changed the method signature of UpdateColor to:

Lua Code:
  1. UpdateColor(self, event, unit, ....)

My Code for AdditionalPower before version 10 was:

Lua Code:
  1. function UNITS:AdditionalPower_UpdateColor(unit)
  2.     if (unit) then
  3.         local _, powerToken = UNITS:UnitPowerType(unit);
  4.  
  5.         if (powerToken == ADDITIONAL_POWER_BAR_NAME) then
  6.             self:Hide();
  7.         else
  8.             local color = Colors:GetColorForPower(ADDITIONAL_POWER_BAR_NAME);
  9.  
  10.             self:SetStatusBarColor(color.r, color.g, color.b, color.a);
  11.         end
  12.     end
  13. end

So now it is:

Lua Code:
  1. function UNITS:AdditionalPower_UpdateColor(_, unit)
  2.     if (unit) then
  3.         local _, powerToken = UNITS:UnitPowerType(unit);
  4.  
  5.         if (powerToken == ADDITIONAL_POWER_BAR_NAME) then
  6.             self:Hide();
  7.         else
  8.             local color = Colors:GetColorForPower(ADDITIONAL_POWER_BAR_NAME);
  9.  
  10.             self:SetStatusBarColor(color.r, color.g, color.b, color.a);
  11.         end
  12.     end
  13. end

But im getting:

Lua Code:
  1. 8x Lybrial_UI\units\elements\powerAdditional.lua:74: attempt to call method 'SetStatusBarColor' (a nil value)

So do I need to do something different?

Last edited by Lybrial : 10-16-20 at 10:52 AM.
  Reply With Quote
10-16-20, 09:50 AM   #3
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 107
Always the same, after I asked I find the answer myself:

Lua Code:
  1. function UNITS:AdditionalPower_UpdateColor(_, unit)
  2.     if (unit) then
  3.         local self = self.AdditionalPower;
  4.         local _, powerToken = UNITS:UnitPowerType(unit);
  5.  
  6.         if (powerToken == ADDITIONAL_POWER_BAR_NAME) then
  7.             self:Hide();
  8.         else
  9.             local color = Colors:GetColorForPower(ADDITIONAL_POWER_BAR_NAME);
  10.  
  11.             self:SetStatusBarColor(color.r, color.g, color.b, color.a);
  12.         end
  13.     end
  14. end

Once again thank you for the update guide
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF 10.0 Upgrade Guide for Shadowlands

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