From 048511db6049e178f4c35d343429c6d7bb7d5acc Mon Sep 17 00:00:00 2001 From: Rodney Date: Feb 19 2021 15:49:11 +0000 Subject: Merge pull request #3719 from shun-iwasawa/fix_new_level_undo Fix New Level Undo --- diff --git a/toonz/sources/toonz/levelcreatepopup.cpp b/toonz/sources/toonz/levelcreatepopup.cpp index 96bbbd6..527012a 100644 --- a/toonz/sources/toonz/levelcreatepopup.cpp +++ b/toonz/sources/toonz/levelcreatepopup.cpp @@ -276,8 +276,8 @@ LevelCreatePopup::LevelCreatePopup() bool ret = true; ret = ret && connect(m_levelTypeOm, SIGNAL(currentIndexChanged(int)), SLOT(onLevelTypeChanged(int))); - ret = ret && connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkBtn())); - ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject())); + ret = ret && connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkBtn())); + ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject())); ret = ret && connect(applyBtn, SIGNAL(clicked()), this, SLOT(onApplyButton())); @@ -509,18 +509,6 @@ bool LevelCreatePopup::apply() { } } - TXshLevel *level = - scene->createNewLevel(lType, levelName, TDimension(), 0, fp); - TXshSimpleLevel *sl = dynamic_cast(level); - assert(sl); - sl->setPath(fp, true); - if (lType == TZP_XSHLEVEL || lType == OVL_XSHLEVEL) { - sl->getProperties()->setDpiPolicy(LevelProperties::DP_ImageDpi); - sl->getProperties()->setDpi(dpi); - sl->getProperties()->setImageDpi(TPointD(dpi, dpi)); - sl->getProperties()->setImageRes(TDimension(xres, yres)); - } - /*-- これからLevelを配置しようとしているセルが空いているかどうかのチェック * --*/ bool areColumnsShifted = false; @@ -553,6 +541,18 @@ bool LevelCreatePopup::apply() { new CreateLevelUndo(row, col, numFrames, step, areColumnsShifted); TUndoManager::manager()->add(undo); + TXshLevel *level = + scene->createNewLevel(lType, levelName, TDimension(), 0, fp); + TXshSimpleLevel *sl = dynamic_cast(level); + assert(sl); + sl->setPath(fp, true); + if (lType == TZP_XSHLEVEL || lType == OVL_XSHLEVEL) { + sl->getProperties()->setDpiPolicy(LevelProperties::DP_ImageDpi); + sl->getProperties()->setDpi(dpi); + sl->getProperties()->setImageDpi(TPointD(dpi, dpi)); + sl->getProperties()->setImageRes(TDimension(xres, yres)); + } + for (i = from; i <= to; i += inc) { TFrameId fid(i); TXshCell cell(sl, fid);