mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 13:15:50 +00:00
Basic reification, works for model-like projects but not place-like ones
This commit is contained in:
@@ -4,6 +4,27 @@ local Logging = require(script.Parent.Logging)
|
||||
|
||||
local REMOTE_URL = ("http://localhost:%d"):format(Config.port)
|
||||
|
||||
local function reify(instanceData, id, parent)
|
||||
local data = instanceData[id]
|
||||
|
||||
local instance = Instance.new(data.ClassName)
|
||||
|
||||
for key, value in pairs(data.Properties) do
|
||||
-- TODO: Branch on value.Type
|
||||
instance[key] = value.Value
|
||||
end
|
||||
|
||||
instance.Name = data.Name
|
||||
|
||||
for _, childId in ipairs(data.Children) do
|
||||
reify(instanceData, childId, instance)
|
||||
end
|
||||
|
||||
instance.Parent = parent
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
local Session = {}
|
||||
Session.__index = Session
|
||||
|
||||
@@ -25,7 +46,8 @@ function Session.new()
|
||||
:andThen(function()
|
||||
return api:read({api.rootInstanceId})
|
||||
end)
|
||||
:andThen(function()
|
||||
:andThen(function(response)
|
||||
reify(response.instances, api.rootInstanceId, game.ReplicatedStorage)
|
||||
return api:retrieveMessages()
|
||||
end)
|
||||
:catch(function(message)
|
||||
|
||||
Reference in New Issue
Block a user