Compare commits

...

4 commits

8 changed files with 25 additions and 2 deletions

View file

@ -12,6 +12,7 @@
#include "logger.h"
#include "panic.h"
#include <algorithm>
#include <cctype>
#include <cstddef>
#include <cstdio>
#include <memory>
@ -182,10 +183,12 @@ void Instance::OnWorkspaceRemoved(std::shared_ptr<Workspace> oldWorkspace) {
// Properties
result<Variant, MemberNotFound> Instance::GetPropertyValue(std::string name) {
name[0] = toupper(name[0]); // Ignore case of first character
return InternalGetPropertyValue(name);
}
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);
if (result.isSuccess() && sendUpdateEvent) {
InternalUpdateProperty(name);
@ -195,6 +198,7 @@ fallible<MemberNotFound, AssignToReadOnlyMember> Instance::SetPropertyValue(std:
}
result<PropertyMeta, MemberNotFound> 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);

View file

@ -90,6 +90,7 @@ std::shared_ptr<DataModel> DataModel::LoadFromFile(std::string path) {
newModel->services[className] = std::dynamic_pointer_cast<Service>(service);
}
newModel->currentFile = path;
newModel->Init();
return newModel;

View file

@ -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)

View file

@ -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");

View file

@ -162,6 +162,7 @@ static int g_print(lua_State* L) {
const char* str = lua_tostring(L, -1); // convert result into c-string
lua_pop(L, 1); // pop result
if (i > 1) buf += '\t';
buf += str;
}

View file

@ -4,7 +4,7 @@
#include "panic.h"
// GNU/Linux implementation
#if defined(_POSIX_VERSION) || defined(__linux) || defined(__linux__)
#if defined(_POSIX_VERSION) || defined(__linux) || defined(__linux__) || defined(__unix__)
#include <unistd.h>
#include <sys/types.h>

View file

@ -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.....

View file

@ -125,7 +125,7 @@ ScriptDocument::ScriptDocument(std::shared_ptr<Script> script, QWidget* parent):
QFrame* frame = new QFrame;
QVBoxLayout* frameLayout = new QVBoxLayout;
frameLayout->setMargin(0);
frameLayout->setContentsMargins({0, 0, 0, 0});
frame->setLayout(frameLayout);
scintilla = new QsciScintilla(this);