Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-11-22, 10:08 AM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,863
Dragonflight : EditMode System

I know it's unlikely, but just in case someone was fortunate to have had time to figure this out for their needs any idea why this is having a problem ?

Seeing as nUI and the new EditMode system doesn't get along at all, I have been attempting to rebuild at least some of nUI and use the EditMode system in it and thus removing the need of nUI's mover system.

Now, with the minimap having the smallest editmode setup I thought I would try to emulate what it does to do its stuff with the EditMode system.

Now, looking at ( https://github.com/Gethe/wow-ui-sour...ML/Minimap.xml / https://github.com/Gethe/wow-ui-sour...ML/Minimap.lua ) we have an inherit to a template in ( https://github.com/Gethe/wow-ui-sour...mTemplates.xml ) which has a mixin coded in ( https://github.com/Gethe/wow-ui-sour...mTemplates.lua )

But we don't stop there... inside the minimap editmode template there are a few key values set up with one of them being the Edit Mode System that is linked to it (Enum.EditModeSystem.Minimap) . Sounds good so far right ?

Lua Code:
  1. [Enum.EditModeSystem.Minimap] = {
  2.         settings = {
  3.             [Enum.EditModeMinimapSetting.HeaderUnderneath] = 0,
  4.         },
  5.         anchorInfo = {
  6.             point = "TOPRIGHT",
  7.             relativeTo = "UIParent",
  8.             relativePoint = "TOPRIGHT",
  9.             offsetX = 0,
  10.             offsetY = 0,
  11.         },
  12.     },

Wrong!

So, using this as a guide I have extracted just the dashboard display code including its scaling code and displays fine on the screen using its regular coding and .. doesn't error out when trying to use the EditMode system
Lua Code:
  1. [Enum.EditModeSystem.Dashboard] = {
  2.     settings = {
  3.         [Enum.EditModeDashboardSetting.Etc] = 0,
  4.     },
  5.     anchorInfo = {
  6.         point = "BOTTOM",
  7.         relativeTo = "UIParent",
  8.         relativePoint = "BOTTOM",
  9.         offsetX = 0,
  10.         offsetY = 0,
  11.     },
  12. }
This prompted this error: "Interface/AddOns/nUI_Dashboard/EditModeSystem.lua:2: unexpected symbol near '['" on that first line

I then copied the minimaps EditMode SystemMixin and renamed/edited it to work for the dashboard with Minimap replaced with Dashboard and HeaderUnderneath functions with an Etc function
Lua Code:
  1. EditModeDashboardSystemMixin = {};
  2.  
  3. --[[ This will ultimately call the actual frames function - in this case Etc ]]
  4. function EditModeDashboardSystemMixin:UpdateSystemSettingEtc()
  5.     self:Etc(self:GetSettingValueBool(Enum.EditModeDashboardSetting.Etc));
  6. end
  7.  
  8. --[[ This appears to update any system settings that may exist]]
  9. function EditModeDashboardSystemMixin:UpdateSystemSetting(setting, entireSystemUpdate)
  10.    
  11.     -- Update this setting for this system
  12.     EditModeSystemMixin.UpdateSystemSetting(self, setting, entireSystemUpdate);
  13.  
  14.     -- if the setting didn't change then no need to do anything
  15.     if not self:IsSettingDirty(setting) then
  16.         -- If the setting didn't change we have nothing to do
  17.         return;
  18.     end
  19.  
  20.     --[[ Assumedly each of the settings for this system needs to be checked here and the corresponding function added ]]
  21.     if setting == Enum.EditModeDashboardSetting.Etc and self:HasSetting(Enum.EditModeDashboardSetting.Etc) then
  22.         self:UpdateSystemSettingEtc();
  23.     end
  24.  
  25.     -- Finally mark everything clean
  26.     self:ClearDirtySetting(setting);
  27. end
This resulted in this error : "nUI_Dashboard: Has bad mixin: EditModeDashboardSystemMixin" which seeing as I also copied the Minimaps equivalent mixin and did the necessary changes there
Lua Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://www.blizzard.com/wow/ui/">    
  2.     <Frame name="EditModeDashboardSystemTemplate" inherits="EditModeSystemTemplate" mixin="EditModeDashboardSystemMixin" virtual="true">
  3.         <KeyValues>
  4.             <KeyValue key="system" value="Enum.EditModeSystem.Dashboard" type="global"/>
  5.             <KeyValue key="systemNameString" value="Dashboard" type="global"/>
  6.         </KeyValues>
  7.         <Frames>
  8.             <Frame parentKey="Selection" inherits="EditModeSystemSelectionTemplate" setAllPoints="true" hidden="true"/>
  9.         </Frames>
  10.     </Frame>
  11. </Ui>

With this being the first line of my Dashboard frame setting up the appropriate files
Lua Code:
  1. <Frame name="nUI_Dashboard" frameStrata="BACKGROUND" toplevel="false" parent="UIParent" inherits="EditModeDashboardSystemTemplate" mixin="DashboardMixin" >

Now the regular mixin for this frame has no issues .. but yet the EditMode one did despite being created in the same way.

I am also not getting errors about trying to index Enum.EditModeSystem or Enum so attaching my code to it appears to be fine even though I can't find where Enum and EditModeSystem are set up so possibly behind the scenes.

So, to ask my question again. Anyone know why this could be happening ? Or have an example of how to use the EditMode system on your own frames.

Thanks.
__________________
  Reply With Quote
 

WoWInterface » PTR » PTR API and Graphics Changes » Dragonflight : EditMode System

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