Update rbx-dom (#1023)

This commit is contained in:
Micah
2025-04-02 11:32:27 -07:00
committed by GitHub
parent 0d6ff8ef8a
commit 833320de64
30 changed files with 8815 additions and 2249 deletions

View File

@@ -2,8 +2,8 @@ use std::borrow::Borrow;
use anyhow::{bail, format_err};
use rbx_dom_weak::types::{
Attributes, CFrame, Color3, Content, Enum, Font, MaterialColors, Matrix3, Tags, Variant,
VariantType, Vector2, Vector3,
Attributes, CFrame, Color3, Content, ContentId, Enum, Font, MaterialColors, Matrix3, Tags,
Variant, VariantType, Vector2, Vector3,
};
use rbx_reflection::{DataType, PropertyDescriptor};
use serde::{Deserialize, Serialize};
@@ -116,6 +116,9 @@ impl AmbiguousValue {
(VariantType::Content, AmbiguousValue::String(value)) => {
Ok(Content::from(value).into())
}
(VariantType::ContentId, AmbiguousValue::String(value)) => {
Ok(ContentId::from(value).into())
}
(VariantType::Vector2, AmbiguousValue::Array2(value)) => {
Ok(Vector2::new(value[0] as f32, value[1] as f32).into())
@@ -275,10 +278,20 @@ mod test {
Variant::String("Hello!".into()),
);
// String literals can also turn into Content
// String literals can also turn into ContentId
assert_eq!(
resolve("Sky", "MoonTextureId", "\"rbxassetid://12345\""),
Variant::Content("rbxassetid://12345".into()),
Variant::ContentId("rbxassetid://12345".into()),
);
// String literals can turn into Content!
assert_eq!(
resolve(
"MeshPart",
"MeshContent",
"\"rbxasset://totally-a-real-uri.tiff\""
),
Variant::Content("rbxasset://totally-a-real-uri.tiff".into())
);
// What about BinaryString values? For forward-compatibility reasons, we