mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Basic reification, works for model-like projects but not place-like ones
This commit is contained in:
parent
05594ecca0
commit
d807d22350
1 changed files with 23 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue