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? Thanks6 Replies
actor._source should not have cleanData applied unless it has been committed.
If it does, then it's a bug in Foundry and should be reported.
I don't know about game.actors._source tho, I'm speaking of specific actor data
You could check
actor._source
vs that Actor's entry in the db to confirm. If it's [object Object] then it's been committed already.Hasn't been comitted
because I can observe it happening across refreshes
Let me get the full stack
DataModel constructor:
BaseActor initializeSource:
Using
game.actors._source
and a specific actor ._source
both appear to have the same transformations applied
I guess I'll file it since I've not been able to find any means of accessing the uncleaned data. If only I had tested before the v11 release Further investigation found game.data["actors"]
which provides what I need
Doesn't help with the case of compendium documents though... hm.