Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WorldPivotData not being written in studio #238

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0a860f5
Fix WorldPivotData not being written in studio
blackshibe Oct 11, 2022
cfbcfaf
prepare patch for generate_reflection
blackshibe Oct 11, 2022
a64ad05
separate plugin_injector fix from this PR
blackshibe Oct 12, 2022
5517437
use AliasFor instead of custom Scriptability
blackshibe Oct 12, 2022
d801ed6
fix generator crash if Plugins directory isn't defined
blackshibe Oct 12, 2022
acf4c47
Fix the mess, update database.json, fix generate_reflection breaking …
blackshibe Oct 12, 2022
0be06b2
remove unnecessary duplication of CFrame entry
blackshibe Oct 12, 2022
76c9773
Properly tie together WorldPivot and WorldPivotData
blackshibe Oct 12, 2022
c980697
the runner doesn't seem to appreciate OptionalCFrames - maybe CFrame …
blackshibe Oct 12, 2022
2d98cc0
treat CFrames as OptionalCFrames if OptionalCFrame is expected in rbx…
blackshibe Oct 12, 2022
e4587f5
allow Change section in patch files to declare DataTypes
blackshibe Oct 12, 2022
d4c1c0c
add NeedsPivotMigration to patchfile
blackshibe Oct 13, 2022
c83a735
Merge remote-tracking branch 'upstream/master'
blackshibe Nov 2, 2023
0ce5321
finish merge
blackshibe Nov 2, 2023
5cbbb8d
update database, fix text_deserializer compiler error with OptionalCF…
blackshibe Jan 3, 2024
61d47fc
oops, remove spare semicolon
blackshibe Jan 3, 2024
a1497bc
use flatten instead of filter_map
blackshibe Jan 3, 2024
c7a87bc
Merge pull request #1 from rojo-rbx/master
blackshibe Jan 3, 2024
b23c974
make header public, remove unused FileHeader import
blackshibe Jan 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions generate_reflection/src/plugin_injector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rbx_dom_weak::{InstanceBuilder, WeakDom};
use roblox_install::RobloxStudio;
use serde::Deserialize;
use tiny_http::Response;
use fs_err;

static PLUGIN_SOURCE: &str = include_str!("../plugin/main.lua");

Expand Down Expand Up @@ -65,6 +66,9 @@ fn install_plugin(roblox_studio: &RobloxStudio) {
.plugins_path()
.join("RbxDomGenerateReflectionPlugin.rbxmx");

// trying to write to plugin_path fails if plugins_path() doesn't already exist
fs_err::create_dir_all(roblox_studio.plugins_path()).expect("Couldn't create plugins path");

blackshibe marked this conversation as resolved.
Show resolved Hide resolved
let output = BufWriter::new(File::create(plugin_path).unwrap());
rbx_xml::to_writer_default(output, &plugin, &[plugin.root_ref()]).unwrap();
}
Expand Down
8 changes: 8 additions & 0 deletions patches/model-pivot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Add:
Model:
WorldPivotData:
Serialization:
Type: Serializes
DataType:
Value: OptionalCFrame
Scriptability: Custom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WorldPivotData is kind of a funny name. That's what this property serializes as, but we should surface it as WorldPivot to the user. There is a little bit of guidance in this document that might help: https://dom.rojo.space/patching-database.html

You can also look at the patches in instance.yml that add support for attributes. They serialize as AttributesSerialize but we expose them as Attributes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it use an alias like you suggested in the latest commit.

2 changes: 2 additions & 0 deletions rbx_dom_lua/src/EncodedValue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ types = {
},
}

types.OptionalCFrame = types.CFrame;

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

Expand Down
11 changes: 11 additions & 0 deletions rbx_dom_lua/src/customProperties.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ return {
end,
},
},
Model = {
WorldPivotData = {
read = function(instance, key)
return true, instance.WorldPivot
end,
write = function(instance, key, value)
instance.WorldPivot = value
return true
end,
},
},
LocalizationTable = {
Contents = {
read = function(instance, key)
Expand Down
93 changes: 92 additions & 1 deletion rbx_dom_lua/src/database.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,32 @@
},
"Tags": {
"BinaryString": ""
},
"WorldPivotData": {
"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
]
]
}
}
}
},
Expand Down Expand Up @@ -394,7 +420,7 @@
"BinaryString": ""
},
"CancelAirMomentum": {
"Bool": true
"Bool": false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, this is kinda weird. I wonder what's up with this diff!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll break everything randomly and we don't even know it yet.

},
"MoveMaxForce": {
"Float32": 10000.0
Expand Down Expand Up @@ -23080,6 +23106,19 @@
"Serialization": "DoesNotSerialize"
}
}
},
"WorldPivotData": {
"Name": "WorldPivotData",
"Scriptability": "Custom",
"DataType": {
"Value": "OptionalCFrame"
},
"Tags": [],
"Kind": {
"Canonical": {
"Serialization": "Serializes"
}
}
}
},
"DefaultProperties": {
Expand All @@ -23094,6 +23133,32 @@
},
"Tags": {
"BinaryString": ""
},
"WorldPivotData": {
"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
]
]
}
}
}
},
Expand Down Expand Up @@ -49696,6 +49761,32 @@
},
"UnionsScaleNonuniformly": {
"Enum": 0
},
"WorldPivotData": {
"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
]
]
}
}
}
},
Expand Down
Binary file modified rbx_reflection_database/database.msgpack
Binary file not shown.