Skip to content

Commit

Permalink
Backport #868 to 7.4 (custom pivot geter/setter) (#869)
Browse files Browse the repository at this point in the history
This PR backports some changes to rbx_dom_lua to fix serving model
pivots
  • Loading branch information
kennethloeffler authored Feb 20, 2024
1 parent f716928 commit 88efbd4
Show file tree
Hide file tree
Showing 5 changed files with 518 additions and 97 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased Changes
* Fixed incorrect results when building model pivots ([#865])
* Fixed incorrect results when serving model pivots ([#868])
* Rojo now converts any line endings to LF, preventing spurious diffs when syncing Lua files on Windows ([#854])
* Fixed Rojo plugin failing to connect when project contains certain unreadable properties ([#848])
* Fixed various cases where patch visualizer would not display sync failures ([#845], [#844])
Expand All @@ -13,6 +14,7 @@
[#847]: https://github.com/rojo-rbx/rojo/pull/847
[#854]: https://github.com/rojo-rbx/rojo/pull/854
[#865]: https://github.com/rojo-rbx/rojo/pull/865
[#868]: https://github.com/rojo-rbx/rojo/pull/868

## [7.4.0] - January 16, 2024
* Improved the visualization for array properties like Tags ([#829])
Expand Down
23 changes: 23 additions & 0 deletions plugin/rbx_dom_lua/EncodedValue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,32 @@ types = {
},
}

types.OptionalCFrame = {
fromPod = function(pod)
if pod == nil then
return nil
else
return types.CFrame.fromPod(pod)
end
end,

toPod = function(roblox)
if roblox == nil then
return nil
else
return types.CFrame.toPod(roblox)
end
end,
}

function EncodedValue.decode(encodedValue)
local ty, value = next(encodedValue)

if ty == nil then
-- If the encoded pair is empty, assume it is an unoccupied optional value
return true, nil
end

local typeImpl = types[ty]
if typeImpl == nil then
return false, "Couldn't decode value " .. tostring(ty)
Expand Down
35 changes: 35 additions & 0 deletions plugin/rbx_dom_lua/allValues.json
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,41 @@
},
"ty": "NumberSequence"
},
"OptionalCFrame-None": {
"value": {
"OptionalCFrame": null
},
"ty": "OptionalCFrame"
},
"OptionalCFrame-Some": {
"value": {
"OptionalCFrame": {
"position": [
0.0,
0.0,
0.0
],
"orientation": [
[
1.0,
0.0,
0.0
],
[
0.0,
1.0,
0.0
],
[
0.0,
0.0,
1.0
]
]
}
},
"ty": "OptionalCFrame"
},
"PhysicalProperties-Custom": {
"value": {
"PhysicalProperties": {
Expand Down
12 changes: 12 additions & 0 deletions plugin/rbx_dom_lua/customProperties.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ return {
return true, instance:ScaleTo(value)
end,
},
WorldPivotData = {
read = function(instance)
return true, instance:GetPivot()
end,
write = function(instance, _, value)
if value == nil then
return true, nil
else
return true, instance:PivotTo(value)
end
end,
},
},
Terrain = {
MaterialColors = {
Expand Down
Loading

0 comments on commit 88efbd4

Please sign in to comment.