forked from rojo-rbx/rojo
Add ChangeBatcher to plugin for two-way sync (#478)
* Implement ChangeBatcher * Use ChangeBatcher for two-way sync * Pause updates during patch application * I can English good * Break after encountering a nil Parent change This prevents __flush from erroring out when an instance's Parent is changed to nil and it has other property changes in the same batch. * Update rbx_dom_lua * Don't connect changed listeners in a running game #468 made me realize how bad of an idea this is in general... * Update TestEZ and fix sibling Ref reification test * Add ChangeBatcher tests * Test instance unpausing by breaking functionality out to __cycle * Break up the module a bit and improve tests * Shuffle requires around and edit comment * Break out more stuff, rename createChangePatch -> createPatchSet * Make ChangeBatcher responsible for unpausing all paused instances This somewhat improves the situation (of course, it would preferrable to not have to hack around this problem with Source at all). It also sets us up nicely if we come across any other properties that do anything similar. * Remove old reference to pausedBatchInstances * Use RenderStepped instead of Heartbeat and trash multi-frame pauses I probably should have done this in the first place... ChangeBatcher still needs to unpause instances, but we don't need to hold pauses for any longer than one cycle. * Remove useless branch * if not next(x) -> if next(x) == nil * Add InstanceMap:unpauseAllInstances, use it in ChangeBatcher * Move IsRunning check to InstanceMap:__maybeFireInstanceChanged
This commit is contained in:
@@ -20,7 +20,21 @@ local function set(container, key, value)
|
||||
end
|
||||
|
||||
function PropertyDescriptor.fromRaw(data, className, propertyName)
|
||||
local key, value = next(data.DataType)
|
||||
|
||||
return setmetatable({
|
||||
-- The meanings of the key and value in DataType differ when the type of
|
||||
-- the property is Enum. When the property is of type Enum, the key is
|
||||
-- the name of the type:
|
||||
--
|
||||
-- { Enum = "<name of enum>" }
|
||||
--
|
||||
-- When the property is not of type Enum, the value is the name of the
|
||||
-- type:
|
||||
--
|
||||
-- { Value = "<data type>" }
|
||||
dataType = key == "Enum" and key or value,
|
||||
|
||||
scriptability = data.Scriptability,
|
||||
className = className,
|
||||
name = propertyName,
|
||||
@@ -77,4 +91,4 @@ function PropertyDescriptor:write(instance, value)
|
||||
end
|
||||
end
|
||||
|
||||
return PropertyDescriptor
|
||||
return PropertyDescriptor
|
||||
|
||||
Reference in New Issue
Block a user