修复动画问题

This commit is contained in:
2026-04-08 15:01:17 +08:00
parent a79c31a056
commit e116a9ec79
3 changed files with 58 additions and 0 deletions

View File

@@ -1348,6 +1348,26 @@ bool ProjectWorkspace::setEntityImageFrame(const QString& id, int frame, const Q
return true;
}
bool ProjectWorkspace::setEntityImageFramePath(const QString& id, int frame, const QString& relativePath) {
if (m_projectDir.isEmpty() || id.isEmpty() || frame < 0) {
return false;
}
const QString rel = relativePath.trimmed();
if (rel.isEmpty()) {
return false;
}
auto ents = m_project.entities();
bool found = false;
for (auto& e : ents) {
if (e.id != id) continue;
found = true;
upsertFrame(e.imageFrames, frame, rel);
break;
}
if (!found) return false;
return applyEntities(ents, true, QStringLiteral("插入关键帧(图像)"));
}
namespace {
bool removeLocationKeyAtFrame(QVector<Project::Entity::KeyframeVec2>& keys, int frame) {

View File

@@ -91,6 +91,8 @@ public:
bool setEntityDepthScaleKey(const QString& id, int frame, double value01);
bool setEntityUserScaleKey(const QString& id, int frame, double userScale);
bool setEntityImageFrame(const QString& id, int frame, const QImage& image, QString* outRelPath = nullptr);
// 仅更新 imageFrames 中某帧的图像路径不读图、不写盘用于高性能地“切断”Hold 区间
bool setEntityImageFramePath(const QString& id, int frame, const QString& relativePath);
bool removeEntityLocationKey(const QString& id, int frame);
bool removeEntityDepthScaleKey(const QString& id, int frame);
bool removeEntityUserScaleKey(const QString& id, int frame);