WHITESPINE
Explore posts from serversLOELeague of Extraordinary FoundryVTT Developers
•Created by WHITESPINE on 5/29/2023 in #system-development
Migrating to DataModels - how to get data pre `cleanData`?
Hello. In the lancer system, we have some old fields in our Actor/Item models what predate the existence of UUIDs - they instead used a "RegRef" structure to achieve basically the same thing as a UUID now does. For context, a regref example:
Going forward, we'd prefer these just be a UUID string represented via a slightly modified StringField. The issue we are running into, though, is that it is difficult to migrate this data considering that the
_source
data of all actors is being modified via the DataModel._initializeSource
-> BaseActor._initializeSource
-> DataModel.cleanData
, which destroys the above object and replaces it with "[object Object]". I tried accessing them via game.actors._source
but it appears that the transformations in cleanData affect that data too. Is there a good way around this? Thanks14 replies