resize scene instead of changing dpi

This commit is contained in:
shun_iwasawa 2016-08-19 15:09:48 +09:00
parent 98ad89fbd3
commit 217e7193db
2 changed files with 13 additions and 10 deletions

View file

@ -1867,20 +1867,23 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
if (!areAlmostEqual(dpi.x, Stage::standardDpi) || if (!areAlmostEqual(dpi.x, Stage::standardDpi) ||
!areAlmostEqual(dpi.y, Stage::standardDpi)) { !areAlmostEqual(dpi.y, Stage::standardDpi)) {
QString question = QObject::tr( QString question = QObject::tr(
"The camera dpi is incompatible with pixels only mode. What would " "This scene is incompatible with pixels only mode of the current "
"you like to do?"); "OpenToonz version.\nWhat would you like to do?");
QString turnOffPixelAnswer = QObject::tr("Turn off pixels only mode"); QString turnOffPixelAnswer = QObject::tr("Turn off pixels only mode");
QString changeDpiAnswer = QObject::tr("Change the camera dpi"); QString resizeSceneAnswer =
int ret = DVGui::MsgBox(question, turnOffPixelAnswer, changeDpiAnswer, 0); QObject::tr("Keep pixels only mode on and resize the scene");
int ret =
DVGui::MsgBox(question, turnOffPixelAnswer, resizeSceneAnswer, 0);
if (ret == 0) { if (ret == 0) {
} // do nothing } // do nothing
else if (ret == 1) { // Turn off pixels only mode else if (ret == 1) { // Turn off pixels only mode
Preferences::instance()->setPixelsOnly(false);
app->getCurrentScene()->notifyPixelUnitSelected(false); app->getCurrentScene()->notifyPixelUnitSelected(false);
} else { // ret = 2 : Change the camera dpi } else { // ret = 2 : Resize the scene
TDimension camRes = scene->getCurrentCamera()->getRes(); TDimensionD camSize = scene->getCurrentCamera()->getSize();
TDimensionD camSize(camRes.lx / Stage::standardDpi, TDimension camRes(camSize.lx * Stage::standardDpi,
camRes.ly / Stage::standardDpi); camSize.ly * Stage::standardDpi);
scene->getCurrentCamera()->setSize(camSize); scene->getCurrentCamera()->setRes(camRes);
app->getCurrentScene()->setDirtyFlag(true); app->getCurrentScene()->setDirtyFlag(true);
app->getCurrentXsheet()->notifyXsheetChanged(); app->getCurrentXsheet()->notifyXsheetChanged();
} }

View file

@ -31,7 +31,7 @@
using namespace DVGui; using namespace DVGui;
QString DialogTitle = QObject::tr("OpenToonz 1.0"); QString DialogTitle = QObject::tr("OpenToonz 1.1");
//============================================================================= //=============================================================================
namespace { namespace {