mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Add support for ignoring auto-created instances in sync process
- Introduced a new configuration for ignored class names in Config.lua to streamline the sync process by skipping instances that are auto-created by Roblox, such as TouchTransmitter and Camera. - Updated PatchTree, applyPatch, and diff functions to utilize this configuration, enhancing efficiency by preventing unnecessary processing of these instances.
This commit is contained in:
parent
c5c6bf9a10
commit
3c33054afd
4 changed files with 16 additions and 6 deletions
|
|
@ -16,6 +16,12 @@ for i = 1, 3 do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- ClassNames to ignore during sync (auto-created by Roblox, not meaningful for sync)
|
||||||
|
local IgnoredClassNames = {
|
||||||
|
TouchTransmitter = true,
|
||||||
|
Camera = true,
|
||||||
|
}
|
||||||
|
|
||||||
return strict("Config", {
|
return strict("Config", {
|
||||||
isDevBuild = isDevBuild,
|
isDevBuild = isDevBuild,
|
||||||
codename = "Epiphany",
|
codename = "Epiphany",
|
||||||
|
|
@ -24,4 +30,5 @@ return strict("Config", {
|
||||||
protocolVersion = 5,
|
protocolVersion = 5,
|
||||||
defaultHost = "localhost",
|
defaultHost = "localhost",
|
||||||
defaultPort = "34872",
|
defaultPort = "34872",
|
||||||
|
ignoredClassNames = IgnoredClassNames,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ local Packages = Rojo.Packages
|
||||||
|
|
||||||
local Log = require(Packages.Log)
|
local Log = require(Packages.Log)
|
||||||
|
|
||||||
|
local Config = require(Plugin.Config)
|
||||||
local Timer = require(Plugin.Timer)
|
local Timer = require(Plugin.Timer)
|
||||||
local Types = require(Plugin.Types)
|
local Types = require(Plugin.Types)
|
||||||
local WhitespaceUtil = require(Plugin.WhitespaceUtil)
|
local WhitespaceUtil = require(Plugin.WhitespaceUtil)
|
||||||
|
|
@ -335,8 +336,8 @@ function PatchTree.build(patch, instanceMap, changeListHeaders)
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Skip TouchTransmitter (auto-created by Roblox when touch events are connected)
|
-- Skip auto-created instances that shouldn't be synced
|
||||||
if instance.ClassName == "TouchTransmitter" then
|
if Config.ignoredClassNames[instance.ClassName] then
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
local Packages = script.Parent.Parent.Parent.Packages
|
local Packages = script.Parent.Parent.Parent.Packages
|
||||||
local Log = require(Packages.Log)
|
local Log = require(Packages.Log)
|
||||||
|
|
||||||
|
local Config = require(script.Parent.Parent.Config)
|
||||||
local PatchSet = require(script.Parent.Parent.PatchSet)
|
local PatchSet = require(script.Parent.Parent.PatchSet)
|
||||||
local Types = require(script.Parent.Parent.Types)
|
local Types = require(script.Parent.Parent.Types)
|
||||||
local invariant = require(script.Parent.Parent.invariant)
|
local invariant = require(script.Parent.Parent.invariant)
|
||||||
|
|
@ -27,9 +28,9 @@ local function applyPatch(instanceMap, patch)
|
||||||
local deferredRefs = {}
|
local deferredRefs = {}
|
||||||
|
|
||||||
for _, removedIdOrInstance in ipairs(patch.removed) do
|
for _, removedIdOrInstance in ipairs(patch.removed) do
|
||||||
-- Skip TouchTransmitter (auto-created by Roblox when touch events are connected)
|
-- Skip auto-created instances that shouldn't be synced
|
||||||
local instance = if Types.RbxId(removedIdOrInstance) then instanceMap.fromIds[removedIdOrInstance] else removedIdOrInstance
|
local instance = if Types.RbxId(removedIdOrInstance) then instanceMap.fromIds[removedIdOrInstance] else removedIdOrInstance
|
||||||
if instance and instance.ClassName == "TouchTransmitter" then
|
if instance and Config.ignoredClassNames[instance.ClassName] then
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
local Packages = script.Parent.Parent.Parent.Packages
|
local Packages = script.Parent.Parent.Parent.Packages
|
||||||
local Log = require(Packages.Log)
|
local Log = require(Packages.Log)
|
||||||
|
|
||||||
|
local Config = require(script.Parent.Parent.Config)
|
||||||
local invariant = require(script.Parent.Parent.invariant)
|
local invariant = require(script.Parent.Parent.invariant)
|
||||||
local getProperty = require(script.Parent.getProperty)
|
local getProperty = require(script.Parent.getProperty)
|
||||||
local Error = require(script.Parent.Error)
|
local Error = require(script.Parent.Error)
|
||||||
|
|
@ -335,8 +336,8 @@ local function diff(instanceMap, virtualInstances, rootId)
|
||||||
-- corresponding virtual instance should be removed. Any instance that
|
-- corresponding virtual instance should be removed. Any instance that
|
||||||
-- does have a corresponding virtual instance is recursively diffed.
|
-- does have a corresponding virtual instance is recursively diffed.
|
||||||
for _, childInstance in ipairs(instance:GetChildren()) do
|
for _, childInstance in ipairs(instance:GetChildren()) do
|
||||||
-- Skip TouchTransmitter (auto-created by Roblox when touch events are connected)
|
-- Skip auto-created instances that shouldn't be synced
|
||||||
if childInstance.ClassName == "TouchTransmitter" then
|
if Config.ignoredClassNames[childInstance.ClassName] then
|
||||||
continue
|
continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue