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 all 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
5 changes: 5 additions & 0 deletions generate_reflection/src/property_patches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct PropertyPatches {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase", deny_unknown_fields)]
pub struct PropertyChange {
pub data_type: Option<DataType<'static>>,
pub alias_for: Option<String>,
pub serialization: Option<PropertySerialization>,
pub scriptability: Option<Scriptability>,
Expand Down Expand Up @@ -150,6 +151,10 @@ impl PropertyPatches {
if let Some(scriptability) = &property_change.scriptability {
existing_property.scriptability = *scriptability;
}

if let Some(data_type) = &property_change.data_type {
existing_property.data_type = data_type.clone();
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions patches/model-pivot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Change:
Model:
WorldPivot:
DataType:
Value: CFrame
Serialization:
Type: SerializesAs
As: WorldPivotData
Model:
WorldPivotData:
AliasFor: WorldPivot
DataType:
Value: OptionalCFrame
Scriptability: None
4 changes: 1 addition & 3 deletions rbx_binary/src/deserializer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod error;
mod header;
pub mod header;
mod state;

use std::{io::Read, str};
Expand All @@ -9,8 +9,6 @@ use rbx_reflection::ReflectionDatabase;

use self::state::DeserializerState;

pub(crate) use self::header::FileHeader;

pub use self::error::Error;

/// A configurable deserializer for Roblox binary models and places.
Expand Down
3 changes: 2 additions & 1 deletion rbx_binary/src/deserializer/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,8 @@ impl<'db, R: Read> DeserializerState<'db, R> {
}
},
Type::OptionalCFrame => match canonical_type {
VariantType::OptionalCFrame => {
// Model.WorldPivotData may be serialized as a CFrame. The easiest fix is to treat it like an OptionalCFrame
VariantType::OptionalCFrame | VariantType::CFrame => {
let referents = &type_info.referents;
let mut rotations = Vec::with_capacity(referents.len());

Expand Down
5 changes: 3 additions & 2 deletions rbx_binary/src/text_deserializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rbx_dom_weak::types::{
};
use serde::{ser::SerializeSeq, Serialize, Serializer};

use crate::{chunk::Chunk, core::RbxReadExt, deserializer::FileHeader, types::Type};
use crate::{chunk::Chunk, core::RbxReadExt, deserializer::header::FileHeader, types::Type};

#[derive(Debug, Serialize)]
pub struct DecodedModel {
Expand Down Expand Up @@ -695,9 +695,10 @@ impl DecodedValues {
Some(CFrame::new(Vector3::new(x, y, z), rotation))
}
})
.flatten()
.collect();

Some(DecodedValues::OptionalCFrame(values))
Some(DecodedValues::CFrame(values))
}
Type::UniqueId => {
let mut values = Vec::with_capacity(prop_count);
Expand Down
2 changes: 2 additions & 0 deletions rbx_dom_lua/src/EncodedValue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ types = {
},
}

types.OptionalCFrame = types.CFrame

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

Expand Down
Loading
Loading