lune-org/lune

Writing a model file always generates a unique file, leading to diff noise

Closed this issue · 1 comments

local roblox = require("@lune/roblox")

local gameFile = fs.readFile("place.rbxl")
local game = roblox.deserializePlace(gameFile)

local model = game.Workspace.Model
local modelFile = roblox.serializeModel({ model })

fs.writeFile("model.rbxm", modelFile)

As of Lune version 0.7.2 this will always generate a completely unique model.rbxm file, which can be problematic when many models are extracted from a place using an automated process, and then stored in version control.

The root of the issue is that writing a model file will clone the instance within the same dom before transfer out into the dom that will then be written to the model file. This leads to unique id collisions, and new ids being generated (source). Relevant methods in our roblox library - from_instance_array, clone_into_external_dom

This could be solved by rbx-dom (#282, #284), but we could also solve the first linked issue here ourselves in Lune by stripping unique ids in from_instance_array.

I bit the bullet and implemented removal of unique ids in model serialization, so this is fixed in 0.7.3