Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-07-16, 10:11 PM   #1
MilleXIV
A Deviate Faerie Dragon
 
MilleXIV's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2016
Posts: 16
AceDB Resetting

Started having an issue earlier where AceDB wasn't keeping my settings, however my SavedVariables are saving right. Was wondering if anybody has encountered this before. I'm using AceConfig with a dropdown to choose between "BOTTOM" and "TOP". When I do the call to Refresh() it changes correctly, but after a UIReload it goes back to the BOTTOM.

TOC Information:
Lua Code:
  1. ## SavedVariables: TEST_CONFIG, XIVBarDB

Here's how I'm initiating the DB (in AddOn:OnInitialization):
Lua Code:
  1. self.db = LibStub("AceDB-3.0"):New("XIVBarDB", self.defaults)

Here's the defaults:
Lua Code:
  1. XIVBar.defaults = {
  2.   profile = {
  3.     general = {
  4.       barPosition = "BOTTOM",
  5.     },
  6.     color = {
  7.       barColor = {
  8.         r = 0.25,
  9.         g = 0.25,
  10.         b = 0.25,
  11.         a = 1
  12.       },
  13.       normal = {
  14.         r = 0.8,
  15.         g = 0.8,
  16.         b = 0.8,
  17.         a = 0.75
  18.       },
  19.       inactive = {
  20.         r = 1,
  21.         g = 1,
  22.         b = 1,
  23.         a = 0.25
  24.       },
  25.       useCC = true,
  26.       hover = {
  27.         r = 1,
  28.         g = 1,
  29.         b = 1,
  30.         a = 1
  31.       }
  32.     },
  33.     text = {
  34.       fontSize = 12,
  35.       smallFontSize = 11,
  36.       font =  L['Homizio Bold']
  37.     },
  38.     modules = {
  39.  
  40.     }
  41.   }
  42. };

SavedVariables:
Lua Code:
  1. XIVBarDB = {
  2.     ["profileKeys"] = {
  3.         ["Chiasmae - Zul'jin"] = "Chiasmae - Zul'jin",
  4.     },
  5.     ["profiles"] = {
  6.         ["Chiasmae - Zul'jin"] = {
  7.             ["general"] = {
  8.                 ["barPosition"] = "TOP",
  9.             },
  10.         },
  11.     },
  12. }

Here's how I'm setting it in my AceConfig options:
Lua Code:
  1. set = function(info, value) self.db.profile.general.barPosition = value; self:Refresh(); end,

Here's how I'm using it (in Addon:Refresh):
Lua Code:
  1. self.frames.bar:SetPoint(self.db.profile.general.barPosition)

EDIT:
For reference, full source: https://github.com/MilleXIV/XIV_Databar/tree/ace-rework and commit it broke after: https://github.com/MilleXIV/XIV_Data...214a286bc1840b.

Last edited by MilleXIV : 08-08-16 at 09:37 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » AceDB Resetting


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