This commit is contained in:
2026-05-14 13:30:06 +08:00
parent 974946cee4
commit e43171521d
91 changed files with 10485 additions and 3254 deletions
+18 -2
View File
@@ -2,7 +2,9 @@
#include <functional>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonValue>
#include <QRect>
namespace core::library {
@@ -70,6 +72,15 @@ QJsonObject entityToJson(const core::Project::Entity& e) {
o.insert(QStringLiteral("blackholeId"), e.blackholeId);
o.insert(QStringLiteral("blackholeVisible"), e.blackholeVisible);
o.insert(QStringLiteral("blackholeResolvedBy"), e.blackholeResolvedBy);
o.insert(QStringLiteral("blackholeOverlayPath"), e.blackholeOverlayPath);
{
QJsonObject r;
r.insert(QStringLiteral("x"), e.blackholeOverlayRect.x());
r.insert(QStringLiteral("y"), e.blackholeOverlayRect.y());
r.insert(QStringLiteral("w"), e.blackholeOverlayRect.width());
r.insert(QStringLiteral("h"), e.blackholeOverlayRect.height());
o.insert(QStringLiteral("blackholeOverlayRect"), r);
}
o.insert(QStringLiteral("originWorld"), pointToJson(e.originWorld));
o.insert(QStringLiteral("depth"), e.depth);
o.insert(QStringLiteral("imagePath"), e.imagePath);
@@ -81,7 +92,6 @@ QJsonObject entityToJson(const core::Project::Entity& e) {
o.insert(QStringLiteral("parentOffsetWorld"), pointToJson(e.parentOffsetWorld));
o.insert(QStringLiteral("entityPayloadPath"), e.entityPayloadPath);
o.insert(QStringLiteral("legacyAnimSidecarPath"), e.legacyAnimSidecarPath);
o.insert(QStringLiteral("locationKeys"),
vecToJson<core::Project::Entity::KeyframeVec2>(
@@ -161,6 +171,13 @@ bool entityFromJson(const QJsonObject& o, core::Project::Entity& out) {
}
e.blackholeVisible = o.value(QStringLiteral("blackholeVisible")).toBool(true);
e.blackholeResolvedBy = o.value(QStringLiteral("blackholeResolvedBy")).toString();
e.blackholeOverlayPath = o.value(QStringLiteral("blackholeOverlayPath")).toString();
{
const QJsonObject r = o.value(QStringLiteral("blackholeOverlayRect")).toObject();
e.blackholeOverlayRect =
QRect(r.value(QStringLiteral("x")).toInt(0), r.value(QStringLiteral("y")).toInt(0),
r.value(QStringLiteral("w")).toInt(0), r.value(QStringLiteral("h")).toInt(0));
}
{
QPointF p;
if (!pointFromJson(o.value(QStringLiteral("originWorld")), p)) {
@@ -189,7 +206,6 @@ bool entityFromJson(const QJsonObject& o, core::Project::Entity& out) {
e.parentOffsetWorld = p;
}
e.entityPayloadPath = o.value(QStringLiteral("entityPayloadPath")).toString();
e.legacyAnimSidecarPath = o.value(QStringLiteral("legacyAnimSidecarPath")).toString();
auto parseKeyframesVec2 = [&](const QString& key, QVector<core::Project::Entity::KeyframeVec2>& dst) -> bool {
dst.clear();