Reload a project changed on disk, fingerprinted by its manifest and image sizes (12.13a)

This commit is contained in:
雷电芽衣 committed 2026-09-29 20:13:20 -04:00
1 parent aa253d9715
commit 838d5b1459
20 files changed
+1388 -8

No files matched your search

+21
View File
@@ -46,6 +46,27 @@ void EditorSession::installProject(const ProjectSnapshot &snapshot, const QStrin
notify();
}
void EditorSession::reloadProject(const ProjectSnapshot &snapshot)
{
if (!m_projectPath)
return;
const CanvasViewport kept = viewport;
const QSet<QUuid> collapsed = m_collapsedGroupIDs;
const std::optional<QUuid> active = m_activeLayerID;
const QSet<QUuid> selected = m_selectedLayerIDs;
installProject(snapshot, *m_projectPath);
viewport = kept;
QSet<QUuid> ids;
for (const ProjectLayerRecord &record : snapshot.manifest.layers)
ids.insert(record.id);
m_collapsedGroupIDs = collapsed & ids;
if (active && ids.contains(*active)) {
setActiveLayerID(active);
m_selectedLayerIDs = (selected & ids) | QSet<QUuid>{*active};
}
notify();
}
void EditorSession::setProjectPath(std::optional<QString> path)
{
m_projectPath = std::move(path);
+2
View File
@@ -3,5 +3,7 @@ public:
std::optional<ProjectSnapshot> projectSnapshot() const;
// Only a package that loaded and validated whole is installed.
void installProject(const ProjectSnapshot &snapshot, const QString &path);
// Swift's reloadProject: what the package holds now, the view kept.
void reloadProject(const ProjectSnapshot &snapshot);
void clearProject();
void createNewProject(int width, int height);
+1
View File
@@ -92,6 +92,7 @@ void ProjectWorkspace::select(QUuid id)
current().session.commitTransform();
m_selectedID = id;
current().controller.window = window;
current().controller.resumeExternalChangeCheck();
emit changed();
}