From 5d18294ec0b33333d151aacfa0ae6965249335de Mon Sep 17 00:00:00 2001 From: kennethloeffler Date: Wed, 23 Oct 2024 12:47:46 -0700 Subject: [PATCH 1/2] Add SharedString defaults to reflection database --- rbx_dom_lua/src/database.json | 93 +++++++++++++++++++++++ rbx_reflection_database/CHANGELOG.md | 2 + rbx_reflection_database/database.msgpack | Bin 551168 -> 552049 bytes rbx_reflector/src/defaults.rs | 4 +- 4 files changed, 97 insertions(+), 2 deletions(-) diff --git a/rbx_dom_lua/src/database.json b/rbx_dom_lua/src/database.json index 4047d1b81..6066ab1d8 100644 --- a/rbx_dom_lua/src/database.json +++ b/rbx_dom_lua/src/database.json @@ -511,6 +511,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -22232,6 +22235,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -27034,6 +27040,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -30797,6 +30806,9 @@ "Superclass": "PartOperation", "Properties": {}, "DefaultProperties": { + "AeroMeshData": { + "SharedString": "" + }, "Anchored": { "Bool": false }, @@ -30877,6 +30889,9 @@ "ChildData": { "BinaryString": "" }, + "ChildData2": { + "SharedString": "" + }, "CollisionGroup": { "String": "Default" }, @@ -30954,6 +30969,12 @@ "MeshData": { "BinaryString": "" }, + "MeshData2": { + "SharedString": "" + }, + "PhysicalConfigData": { + "SharedString": "" + }, "PhysicsData": { "BinaryString": "" }, @@ -35598,6 +35619,9 @@ } }, "DefaultProperties": { + "AeroMeshData": { + "SharedString": "" + }, "Anchored": { "Bool": false }, @@ -35762,6 +35786,9 @@ "MeshId": { "Content": "" }, + "PhysicalConfigData": { + "SharedString": "" + }, "PhysicsData": { "BinaryString": "" }, @@ -36534,6 +36561,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -37314,6 +37344,9 @@ "Superclass": "PartOperation", "Properties": {}, "DefaultProperties": { + "AeroMeshData": { + "SharedString": "" + }, "Anchored": { "Bool": true }, @@ -37394,6 +37427,9 @@ "ChildData": { "BinaryString": "" }, + "ChildData2": { + "SharedString": "" + }, "CollisionGroup": { "String": "Default" }, @@ -37471,6 +37507,12 @@ "MeshData": { "BinaryString": "" }, + "MeshData2": { + "SharedString": "" + }, + "PhysicalConfigData": { + "SharedString": "" + }, "PhysicsData": { "BinaryString": "" }, @@ -39644,6 +39686,9 @@ } }, "DefaultProperties": { + "AeroMeshData": { + "SharedString": "" + }, "Anchored": { "Bool": false }, @@ -39724,6 +39769,9 @@ "ChildData": { "BinaryString": "" }, + "ChildData2": { + "SharedString": "" + }, "CollisionGroup": { "String": "Default" }, @@ -39801,6 +39849,12 @@ "MeshData": { "BinaryString": "" }, + "MeshData2": { + "SharedString": "" + }, + "PhysicalConfigData": { + "SharedString": "" + }, "PhysicsData": { "BinaryString": "" }, @@ -65305,6 +65359,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -68951,6 +69008,9 @@ "Superclass": "PartOperation", "Properties": {}, "DefaultProperties": { + "AeroMeshData": { + "SharedString": "" + }, "Anchored": { "Bool": false }, @@ -69031,6 +69091,9 @@ "ChildData": { "BinaryString": "" }, + "ChildData2": { + "SharedString": "" + }, "CollisionGroup": { "String": "Default" }, @@ -69108,6 +69171,12 @@ "MeshData": { "BinaryString": "" }, + "MeshData2": { + "SharedString": "" + }, + "PhysicalConfigData": { + "SharedString": "" + }, "PhysicsData": { "BinaryString": "" }, @@ -74842,6 +74911,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -75024,6 +75096,9 @@ ] } }, + "ModelMeshData": { + "SharedString": "" + }, "ModelMeshSize": { "Vector3": [ 0.0, @@ -75128,6 +75203,12 @@ "HSRAssetId": { "Content": "" }, + "HSRData": { + "SharedString": "" + }, + "HSRMeshIdData": { + "SharedString": "" + }, "HistoryId": { "UniqueId": "00000000000000000000000000000000" }, @@ -75422,6 +75503,12 @@ "HSRAssetId": { "Content": "" }, + "HSRData": { + "SharedString": "" + }, + "HSRMeshIdData": { + "SharedString": "" + }, "HistoryId": { "UniqueId": "00000000000000000000000000000000" }, @@ -75602,6 +75689,12 @@ "HSRAssetId": { "Content": "" }, + "HSRData": { + "SharedString": "" + }, + "HSRMeshIdData": { + "SharedString": "" + }, "HistoryId": { "UniqueId": "00000000000000000000000000000000" }, diff --git a/rbx_reflection_database/CHANGELOG.md b/rbx_reflection_database/CHANGELOG.md index 769ac318e..cbdb9a31e 100644 --- a/rbx_reflection_database/CHANGELOG.md +++ b/rbx_reflection_database/CHANGELOG.md @@ -3,7 +3,9 @@ ## Unreleased Changes * Update to Roblox version 647. * `Model.WorldPivotData`'s default value is now `null`. ([#450]) +* `SharedString` properties now have default values. ([#458]) +[#458]: https://github.com/rojo-rbx/rbx-dom/pull/458 [#450]: https://github.com/rojo-rbx/rbx-dom/pull/450 ## 0.2.12+roblox-638 (2024-08-22) diff --git a/rbx_reflection_database/database.msgpack b/rbx_reflection_database/database.msgpack index 2aeee98d9d02745b3ba0d26b235f16e26e7e7a0f..f28eaf4752b91bc9d52c1ad3c936e1454b2b15b7 100644 GIT binary patch delta 1203 zcmZp;r149!+fs+LyoTks+&Qu}nl30@1xF$Fwu_!eqxTGjEFMY!F`nl}t z&G9_#@jQ&%<9V1)>Q0ZgXV%+(ZYf(PBTfyI<9SS{cP?l1-=1K@)L+FYy#2#ACRM!Z zv$xOP!PFHk>#@c$wJ6^=wKxNtYyRc4DsAUwVc*9nyvjKvGbaV4$Oz`k0d%Ohm&MH}VLbgAgevgIy%Jc+Vw)W}$EsWCJ z3#Kx&Gf5LLIgxR?Oew4C^aVSZ*tY+f!F*g`^14>h$p!j#_yZmojvKbmT+O^zkU+Ss zwq^r|iy!0k?faMuXb?C8OxyboGnbnYa0pE!NSwJngpmb^S+|EUviU68u3^PA9dD{K z-40BJi7^A~=~Z~!hTCV%V*kj5Ez@iV<}ynbB6A}sQB3b!%zm4(f4X8di}v*O z>)7|2EcXZwLQc@oB)=9Y49X6k;G6=>C{W4C9~IQMS1x5g&H~ER+S{{Nu^TaxZPIk0 gNnzWi*05(Xfl~K$g#uPd%G?GrF=zY#_3Vs00l#e4SpWb4 delta 420 zcmex(L$TqK;s#4@#{S6y8FquscNMcr-Zm^R{zFCjAU5}S> zyB;r-r0({W%h{$gZU-tesAd$}uCtveyAb|DDNvPGI^6DHi|f4;C>w;dH?E18bPq3NpHE z@7l-w0LfHNrs*0_Sv0r%A7%D4!(p=kb9*c^3lOtzk7Z`_Su)*e51aP(E6dq(z|LN{ z{ohJ9p%`qM4{)*PO=2|Iu0NOkBNNDrvfHB;unVye2(9Uf%h+#Eb}ZJO{(2+(zUj}+ wSk<=IuV6pH0GGAVNa{f{x!Vgivor1l0A^dD=l}o! diff --git a/rbx_reflector/src/defaults.rs b/rbx_reflector/src/defaults.rs index f62976023..fadf0462b 100644 --- a/rbx_reflector/src/defaults.rs +++ b/rbx_reflector/src/defaults.rs @@ -62,8 +62,8 @@ fn apply_instance_defaults(database: &mut ReflectionDatabase, instance: &Instanc let property_name = Cow::Owned(property_name.clone()); match property_value.ty() { - // We skip these types because their defaults aren't useful. - VariantType::Ref | VariantType::SharedString => continue, + // We skip the Ref type because its default value is not useful. + VariantType::Ref => continue, _ => class .default_properties From c6653c39ceb2269f1d70f2d43df7b3543fb54d4b Mon Sep 17 00:00:00 2001 From: kennethloeffler Date: Wed, 23 Oct 2024 13:55:33 -0700 Subject: [PATCH 2/2] Check SharedString default via borrow, not matching Cow::Owned --- rbx_binary/src/serializer/state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rbx_binary/src/serializer/state.rs b/rbx_binary/src/serializer/state.rs index acecadca8..504403914 100644 --- a/rbx_binary/src/serializer/state.rs +++ b/rbx_binary/src/serializer/state.rs @@ -449,7 +449,7 @@ impl<'dom, 'db, W: Write> SerializerState<'dom, 'db, W> { // There's no assurance that the default SharedString value // will actually get serialized inside of the SSTR chunk, so we // check here just to make sure. - if let Cow::Owned(Variant::SharedString(sstr)) = &default_value { + if let Variant::SharedString(sstr) = default_value.borrow() { if !self.shared_string_ids.contains_key(sstr) { self.shared_string_ids.insert(sstr.clone(), 0); self.shared_strings.push(sstr.clone());