Merge pull request #667 from manongjohn/ot_patches_20210415
OpenToonz patches thru 4/15
This commit is contained in:
commit
b58762c011
4 changed files with 31 additions and 11 deletions
|
@ -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
|
// if the path is codable with $scenefolder alias, replace it and return true
|
||||||
bool codeFilePathWithSceneFolder(TFilePath &path) const;
|
bool codeFilePathWithSceneFolder(TFilePath &path) const;
|
||||||
|
|
||||||
|
bool isLoading() { return m_isLoading; }
|
||||||
|
void setIsLoading(bool isLoading) { m_isLoading = isLoading; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TFilePath m_scenePath; //!< Full path to the scene file (.tnz).
|
TFilePath m_scenePath; //!< Full path to the scene file (.tnz).
|
||||||
|
|
||||||
|
@ -273,6 +276,11 @@ private:
|
||||||
// currently it is not match with OT version.
|
// currently it is not match with OT version.
|
||||||
// TODO: Revise VersionNumber 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:
|
private:
|
||||||
// noncopyable
|
// noncopyable
|
||||||
ToonzScene(const ToonzScene &);
|
ToonzScene(const ToonzScene &);
|
||||||
|
|
|
@ -529,15 +529,17 @@ void ShiftTraceTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
|
||||||
m_oldPos = pos;
|
m_oldPos = pos;
|
||||||
m_aff[m_ghostIndex] = TTranslation(delta) * m_aff[m_ghostIndex];
|
m_aff[m_ghostIndex] = TTranslation(delta) * m_aff[m_ghostIndex];
|
||||||
} else if (m_gadget == ScaleGadget) {
|
} else if (m_gadget == ScaleGadget) {
|
||||||
TAffine aff = getGhostAff();
|
TAffine aff = getGhostAff();
|
||||||
TPointD c = aff * m_center[m_ghostIndex];
|
TPointD c = m_center[m_ghostIndex];
|
||||||
TPointD a = m_oldPos - c;
|
TPointD a = aff.inv() * m_oldPos - c;
|
||||||
TPointD b = pos - c;
|
TPointD b = aff.inv() * pos - c;
|
||||||
|
TPointD imgC = aff * m_center[m_ghostIndex];
|
||||||
|
|
||||||
if (e.isShiftPressed())
|
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 {
|
else {
|
||||||
double scale = std::max(b.x / a.x, b.y / a.y);
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,8 @@ static void deleteAllUntitledScenes() {
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// ToonzScene
|
// 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_childStack = new ChildStack(this);
|
||||||
m_properties = new TSceneProperties();
|
m_properties = new TSceneProperties();
|
||||||
m_levelSet = new TLevelSet();
|
m_levelSet = new TLevelSet();
|
||||||
|
@ -348,8 +349,15 @@ bool ToonzScene::isUntitled() const {
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ToonzScene::load(const TFilePath &path, bool withProgressDialog) {
|
void ToonzScene::load(const TFilePath &path, bool withProgressDialog) {
|
||||||
loadNoResources(path);
|
setIsLoading(true);
|
||||||
loadResources(withProgressDialog);
|
try {
|
||||||
|
loadNoResources(path);
|
||||||
|
loadResources(withProgressDialog);
|
||||||
|
} catch (...) {
|
||||||
|
setIsLoading(false);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1177,8 +1177,10 @@ void TXshSimpleLevel::load() {
|
||||||
} else {
|
} else {
|
||||||
// Not a scan + cleanup level
|
// Not a scan + cleanup level
|
||||||
|
|
||||||
if (m_path.getType() == "psd" &&
|
// Loading PSD files via load level command needs to convert layerID in the
|
||||||
this->getScene()->getVersionNumber().first < 71)
|
// 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);
|
m_path = getLevelPathAndSetNameWithPsdLevelName(this);
|
||||||
|
|
||||||
TFilePath path = getScene()->decodeFilePath(m_path);
|
TFilePath path = getScene()->decodeFilePath(m_path);
|
||||||
|
|
Loading…
Reference in a new issue