Skip to content

Commit

Permalink
Merge branch 'syncback-merge' into syncback-internal-release-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekkonot committed Sep 24, 2024
2 parents 92901d2 + 099643f commit 6704061
Show file tree
Hide file tree
Showing 41 changed files with 11,992 additions and 1,405 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
[#911]: https://github.com/rojo-rbx/rojo/pull/911
[#915]: https://github.com/rojo-rbx/rojo/pull/915

## [7.4.3] - August 6th, 2024
* Fixed issue with building binary files introduced in 7.4.2
* Fixed `value of type nil cannot be converted to number` warning spam in output. [#955]

[#955]: https://github.com/rojo-rbx/rojo/pull/955

## [7.4.2] - July 23, 2024
* Added Never option to Confirmation ([#893])
* Fixed removing trailing newlines ([#903])
Expand Down
59 changes: 41 additions & 18 deletions plugin/rbx_dom_lua/customProperties.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ local TERRAIN_MATERIAL_COLORS = {
Enum.Material.Pavement,
}

local function isAttributeNameValid(attributeName)
-- For SetAttribute to succeed, the attribute name must be less than or
-- equal to 100 characters...
return #attributeName <= 100
-- ...and must only contain alphanumeric characters, periods, hyphens,
-- underscores, or forward slashes.
and attributeName:match("[^%w%.%-_/]") == nil
end

local function isAttributeNameReserved(attributeName)
-- For SetAttribute to succeed, attribute names must not use the RBX
-- prefix, which is reserved by Roblox.
return attributeName:sub(1, 3) == "RBX"
end

-- Defines how to read and write properties that aren't directly scriptable.
--
-- The reflection database refers to these as having scriptability = "Custom"
Expand All @@ -40,26 +55,33 @@ return {
local didAllWritesSucceed = true

for attributeName, attributeValue in pairs(value) do
local isNameValid =
-- For our SetAttribute to succeed, the attribute name must be
-- less than or equal to 100 characters...
#attributeName <= 100
-- ...must only contain alphanumeric characters, periods, hyphens,
-- underscores, or forward slashes...
and attributeName:match("[^%w%.%-_/]") == nil
-- ... and must not use the RBX prefix, which is reserved by Roblox.
and attributeName:sub(1, 3) ~= "RBX"

if isNameValid then
instance:SetAttribute(attributeName, attributeValue)
else
if isAttributeNameReserved(attributeName) then
-- If the attribute name is reserved, then we don't
-- really care about reporting any failures about
-- it.
continue
end

if not isAttributeNameValid(attributeName) then
didAllWritesSucceed = false
continue
end

instance:SetAttribute(attributeName, attributeValue)
end

for key in pairs(existing) do
if value[key] == nil then
instance:SetAttribute(key, nil)
for existingAttributeName in pairs(existing) do
if isAttributeNameReserved(existingAttributeName) then
continue
end

if not isAttributeNameValid(existingAttributeName) then
didAllWritesSucceed = false
continue
end

if value[existingAttributeName] == nil then
instance:SetAttribute(existingAttributeName, nil)
end
end

Expand Down Expand Up @@ -113,13 +135,14 @@ return {
},
WorldPivotData = {
read = function(instance)
return true, instance:GetPivot()
return true, instance.WorldPivot
end,
write = function(instance, _, value)
if value == nil then
return true, nil
else
return true, instance:PivotTo(value)
instance.WorldPivot = value
return true
end
end,
},
Expand Down
Loading

0 comments on commit 6704061

Please sign in to comment.