Merge pull request #667 from manongjohn/ot_patches_20210415

OpenToonz patches thru 4/15
This commit is contained in:
manongjohn 2021-04-18 07:29:20 -04:00 committed by GitHub
commit b58762c011
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 11 deletions

View file

@ -259,6 +259,9 @@ If \b scene is in +scenes/name.tnz return name,
// if the path is codable with $scenefolder alias, replace it and return true
bool codeFilePathWithSceneFolder(TFilePath &path) const;
bool isLoading() { return m_isLoading; }
void setIsLoading(bool isLoading) { m_isLoading = isLoading; }
private:
TFilePath m_scenePath; //!< Full path to the scene file (.tnz).
@ -273,6 +276,11 @@ private:
// currently it is not match with OT version.
// TODO: Revise VersionNumber with OT version
bool m_isLoading; // Set to true while loading the scene. Currently this flag
// is used when loading PSD levels, for defining whether to
// convert a layerId in the path to the layer name. See
// TXshSimpleLevel::load().
private:
// noncopyable
ToonzScene(const ToonzScene &);

View file

@ -530,14 +530,16 @@ void ShiftTraceTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
m_aff[m_ghostIndex] = TTranslation(delta) * m_aff[m_ghostIndex];
} else if (m_gadget == ScaleGadget) {
TAffine aff = getGhostAff();
TPointD c = aff * m_center[m_ghostIndex];
TPointD a = m_oldPos - c;
TPointD b = pos - c;
TPointD c = m_center[m_ghostIndex];
TPointD a = aff.inv() * m_oldPos - c;
TPointD b = aff.inv() * pos - c;
TPointD imgC = aff * m_center[m_ghostIndex];
if (e.isShiftPressed())
m_aff[m_ghostIndex] = m_oldAff * TScale(b.x / a.x, b.y / a.y);
m_aff[m_ghostIndex] = TScale(imgC, b.x / a.x, b.y / a.y) * m_oldAff;
else {
double scale = std::max(b.x / a.x, b.y / a.y);
m_aff[m_ghostIndex] = m_oldAff * TScale(scale, scale);
m_aff[m_ghostIndex] = TScale(imgC, scale) * m_oldAff;
}
}

View file

@ -276,7 +276,8 @@ static void deleteAllUntitledScenes() {
//=============================================================================
// ToonzScene
ToonzScene::ToonzScene() : m_contentHistory(0), m_isUntitled(true) {
ToonzScene::ToonzScene()
: m_contentHistory(0), m_isUntitled(true), m_isLoading(false) {
m_childStack = new ChildStack(this);
m_properties = new TSceneProperties();
m_levelSet = new TLevelSet();
@ -348,8 +349,15 @@ bool ToonzScene::isUntitled() const {
//-----------------------------------------------------------------------------
void ToonzScene::load(const TFilePath &path, bool withProgressDialog) {
setIsLoading(true);
try {
loadNoResources(path);
loadResources(withProgressDialog);
} catch (...) {
setIsLoading(false);
throw;
}
setIsLoading(false);
}
//-----------------------------------------------------------------------------

View file

@ -1177,8 +1177,10 @@ void TXshSimpleLevel::load() {
} else {
// Not a scan + cleanup level
if (m_path.getType() == "psd" &&
this->getScene()->getVersionNumber().first < 71)
// Loading PSD files via load level command needs to convert layerID in the
// file path to layer name here. The conversion is not needed on loading
// scene as the file path loaded from the scene file is already converted.
if (m_path.getType() == "psd" && !this->getScene()->isLoading())
m_path = getLevelPathAndSetNameWithPsdLevelName(this);
TFilePath path = getScene()->decodeFilePath(m_path);