fix(misc): more compatibility changes
This commit is contained in:
parent
c7b9e873ee
commit
0ca65b1306
4 changed files with 21 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -182,10 +183,12 @@ void Instance::OnWorkspaceRemoved(std::shared_ptr<Workspace> oldWorkspace) {
|
||||||
// Properties
|
// Properties
|
||||||
|
|
||||||
result<Variant, MemberNotFound> Instance::GetPropertyValue(std::string name) {
|
result<Variant, MemberNotFound> Instance::GetPropertyValue(std::string name) {
|
||||||
|
name[0] = toupper(name[0]); // Ignore case of first character
|
||||||
return InternalGetPropertyValue(name);
|
return InternalGetPropertyValue(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
fallible<MemberNotFound, AssignToReadOnlyMember> Instance::SetPropertyValue(std::string name, Variant value, bool sendUpdateEvent) {
|
fallible<MemberNotFound, AssignToReadOnlyMember> Instance::SetPropertyValue(std::string name, Variant value, bool sendUpdateEvent) {
|
||||||
|
name[0] = toupper(name[0]); // Ignore case of first character
|
||||||
auto result = InternalSetPropertyValue(name, value);
|
auto result = InternalSetPropertyValue(name, value);
|
||||||
if (result.isSuccess() && sendUpdateEvent) {
|
if (result.isSuccess() && sendUpdateEvent) {
|
||||||
InternalUpdateProperty(name);
|
InternalUpdateProperty(name);
|
||||||
|
@ -195,6 +198,7 @@ fallible<MemberNotFound, AssignToReadOnlyMember> Instance::SetPropertyValue(std:
|
||||||
}
|
}
|
||||||
|
|
||||||
result<PropertyMeta, MemberNotFound> Instance::GetPropertyMeta(std::string name) {
|
result<PropertyMeta, MemberNotFound> Instance::GetPropertyMeta(std::string name) {
|
||||||
|
name[0] = toupper(name[0]); // Ignore case of first character
|
||||||
return InternalGetPropertyMeta(name);
|
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");
|
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 (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);
|
pugi::xml_node propertyNode = propertiesNode.append_child(meta.type.descriptor->name);
|
||||||
propertyNode.append_attribute("name").set_value(name);
|
propertyNode.append_attribute("name").set_value(name);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@ public:
|
||||||
CFrame cframe;
|
CFrame cframe;
|
||||||
|
|
||||||
DEF_PROP_CATEGORY(PART)
|
DEF_PROP_CATEGORY(PART)
|
||||||
|
// Special compatibility changes for this property were made in
|
||||||
|
// Instance::Serialize
|
||||||
DEF_PROP_(on_update=onUpdated) Vector3 size;
|
DEF_PROP_(on_update=onUpdated) Vector3 size;
|
||||||
|
|
||||||
DEF_PROP_CATEGORY(APPEARANCE)
|
DEF_PROP_CATEGORY(APPEARANCE)
|
||||||
|
|
|
@ -33,6 +33,9 @@ void Script::Run() {
|
||||||
// Initialize script globals
|
// Initialize script globals
|
||||||
lua_getglobal(Lt, "_G");
|
lua_getglobal(Lt, "_G");
|
||||||
|
|
||||||
|
InstanceRef(shared_from_this()).PushLuaValue(Lt);
|
||||||
|
lua_setfield(Lt, -2, "script");
|
||||||
|
|
||||||
InstanceRef(dataModel().value()).PushLuaValue(Lt);
|
InstanceRef(dataModel().value()).PushLuaValue(Lt);
|
||||||
lua_setfield(Lt, -2, "game");
|
lua_setfield(Lt, -2, "game");
|
||||||
|
|
||||||
|
|
|
@ -270,6 +270,9 @@ static CFrame XYZToZXY(glm::vec3(0, 0, 0), -glm::vec3(1, 0, 0), glm::vec3(0, 0,
|
||||||
void renderHandles() {
|
void renderHandles() {
|
||||||
if (!editorToolHandles.active) return;
|
if (!editorToolHandles.active) return;
|
||||||
|
|
||||||
|
auto assembly = PartAssembly::FromSelection();
|
||||||
|
if (assembly.bounds() == Vector3::ZERO) return;
|
||||||
|
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
glFrontFace(GL_CCW); // This is right... Probably.....
|
glFrontFace(GL_CCW); // This is right... Probably.....
|
||||||
|
|
Loading…
Add table
Reference in a new issue