From 0ca65b130636918ebfd6e16313d78f861089b522 Mon Sep 17 00:00:00 2001 From: maelstrom Date: Sun, 8 Jun 2025 03:38:32 +0200 Subject: [PATCH] fix(misc): more compatibility changes --- core/src/objects/base/instance.cpp | 13 +++++++++++++ core/src/objects/part.h | 2 ++ core/src/objects/script.cpp | 3 +++ core/src/rendering/renderer.cpp | 3 +++ 4 files changed, 21 insertions(+) diff --git a/core/src/objects/base/instance.cpp b/core/src/objects/base/instance.cpp index c6a7c82..b162b9f 100644 --- a/core/src/objects/base/instance.cpp +++ b/core/src/objects/base/instance.cpp @@ -12,6 +12,7 @@ #include "logger.h" #include "panic.h" #include +#include #include #include #include @@ -182,10 +183,12 @@ void Instance::OnWorkspaceRemoved(std::shared_ptr oldWorkspace) { // Properties result Instance::GetPropertyValue(std::string name) { + name[0] = toupper(name[0]); // Ignore case of first character return InternalGetPropertyValue(name); } fallible Instance::SetPropertyValue(std::string name, Variant value, bool sendUpdateEvent) { + name[0] = toupper(name[0]); // Ignore case of first character auto result = InternalSetPropertyValue(name, value); if (result.isSuccess() && sendUpdateEvent) { InternalUpdateProperty(name); @@ -195,6 +198,7 @@ fallible Instance::SetPropertyValue(std: } result Instance::GetPropertyMeta(std::string name) { + name[0] = toupper(name[0]); // Ignore case of first character return InternalGetPropertyMeta(name); } @@ -272,6 +276,15 @@ void Instance::Serialize(pugi::xml_node parent, RefStateSerialize state) { PropertyMeta meta = GetPropertyMeta(name).expect("Meta of declared property is missing"); if (meta.flags & (PROP_NOSAVE | PROP_READONLY)) continue; // This property should not be serialized. Skip... +#if 1 + // Special consideration for Part.Size + // It should be serialized as "size" to be compatible with rbxl files + // This is optional, as they can still be opened otherwise, but I opted + // to keep this enabled + if (IsA("Part") && name == "Size") + name = "size"; +#endif + pugi::xml_node propertyNode = propertiesNode.append_child(meta.type.descriptor->name); propertyNode.append_attribute("name").set_value(name); diff --git a/core/src/objects/part.h b/core/src/objects/part.h index 954f2eb..a6ed681 100644 --- a/core/src/objects/part.h +++ b/core/src/objects/part.h @@ -58,6 +58,8 @@ public: CFrame cframe; DEF_PROP_CATEGORY(PART) + // Special compatibility changes for this property were made in + // Instance::Serialize DEF_PROP_(on_update=onUpdated) Vector3 size; DEF_PROP_CATEGORY(APPEARANCE) diff --git a/core/src/objects/script.cpp b/core/src/objects/script.cpp index 9167fd5..b90b799 100644 --- a/core/src/objects/script.cpp +++ b/core/src/objects/script.cpp @@ -32,6 +32,9 @@ void Script::Run() { // Initialize script globals lua_getglobal(Lt, "_G"); + + InstanceRef(shared_from_this()).PushLuaValue(Lt); + lua_setfield(Lt, -2, "script"); InstanceRef(dataModel().value()).PushLuaValue(Lt); lua_setfield(Lt, -2, "game"); diff --git a/core/src/rendering/renderer.cpp b/core/src/rendering/renderer.cpp index ea64e9c..c4ec5bc 100644 --- a/core/src/rendering/renderer.cpp +++ b/core/src/rendering/renderer.cpp @@ -270,6 +270,9 @@ static CFrame XYZToZXY(glm::vec3(0, 0, 0), -glm::vec3(1, 0, 0), glm::vec3(0, 0, void renderHandles() { if (!editorToolHandles.active) return; + auto assembly = PartAssembly::FromSelection(); + if (assembly.bounds() == Vector3::ZERO) return; + glDepthMask(GL_TRUE); glCullFace(GL_BACK); glFrontFace(GL_CCW); // This is right... Probably.....