Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Level settings now support pixels

Jeremy Bullockd0657441de88
diff --git a/toonz/sources/tnztools/tooloptions.cpp b/toonz/sources/tnztools/tooloptions.cpp
index 08bd8a302..34eede0b8 100644
--- a/toonz/sources/tnztools/tooloptions.cpp
+++ b/toonz/sources/tnztools/tooloptions.cpp
@@ -1800,11 +1800,11 @@ RulerToolOptionsBox::RulerToolOptionsBox(QWidget *parent,
if (Preferences::instance()->getUnits() == "pixel")
{
- m_Xfld->setMeasure("camera.lx");
- m_Yfld->setMeasure("camera.lx");
- m_Wfld->setMeasure("camera.lx");
- m_Hfld->setMeasure("camera.lx");
- m_Lfld->setMeasure("camera.lx");
+ m_Xfld->setMeasure("length.x");
+ m_Yfld->setMeasure("length.y");
+ m_Wfld->setMeasure("length.x");
+ m_Hfld->setMeasure("length.y");
+ m_Lfld->setMeasure("length.x");
}
m_Xfld->setObjectName("RulerToolOptionValues");
diff --git a/toonz/sources/toonz/levelcreatepopup.cpp b/toonz/sources/toonz/levelcreatepopup.cpp
index 254e2b7a5..d6249ea52 100644
--- a/toonz/sources/toonz/levelcreatepopup.cpp
+++ b/toonz/sources/toonz/levelcreatepopup.cpp
@@ -206,8 +206,16 @@ LevelCreatePopup::LevelCreatePopup()
m_levelTypeOm->addItem(RasterLevel);
m_levelTypeOm->addItem(ScanLevel);
- m_widthFld->setMeasure("level.lx");
- m_heightFld->setMeasure("level.ly");
+ if (Preferences::instance()->getUnits() == "pixel")
+ {
+ m_widthFld->setMeasure("camera.lx");
+ m_heightFld->setMeasure("camera.ly");
+ }
+ else
+ {
+ m_widthFld->setMeasure("level.lx");
+ m_heightFld->setMeasure("level.ly");
+ }
m_widthFld->setRange(0.1, (std::numeric_limits<double>::max)());
m_heightFld->setRange(0.1, (std::numeric_limits<double>::max)());
m_dpiFld->setRange(0.1, (std::numeric_limits<double>::max)());
diff --git a/toonz/sources/toonz/levelsettingspopup.cpp b/toonz/sources/toonz/levelsettingspopup.cpp
index 8b39165d6..603e4ec3f 100644
--- a/toonz/sources/toonz/levelsettingspopup.cpp
+++ b/toonz/sources/toonz/levelsettingspopup.cpp
@@ -158,6 +158,12 @@ LevelSettingsPopup::LevelSettingsPopup()
m_widthFld->setMeasure("camera.lx");
m_heightFld->setMeasure("camera.ly");
+ if (Preferences::instance()->getCameraUnits() == "pixel")
+ {
+ m_widthFld->setDecimals(0);
+ m_heightFld->setDecimals(0);
+ }
+
m_doPremultiply->setChecked(false);
m_doAntialias->setChecked(false);
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 0b765e09b..fd2c4c313 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -1138,12 +1138,25 @@ PreferencesPopup::PreferencesPopup()
}
}
- m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelWidth->setMeasure("level.lx");
- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
- m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelHeight->setMeasure("level.ly");
- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
+
+ if (Preferences::instance()->getUnits() == "pixel")
+ {
+ m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());
+ m_defLevelWidth->setMeasure("camera.lx");
+ m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
+ m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());
+ m_defLevelHeight->setMeasure("camera.ly");
+ m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
+ }
+ else
+ {
+ m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());
+ m_defLevelWidth->setMeasure("level.lx");
+ m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
+ m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());
+ m_defLevelHeight->setMeasure("level.ly");
+ m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
+ }
m_defLevelDpi->setRange(0.1, (std::numeric_limits<double>::max)());
m_defLevelDpi->setValue(m_pref->getDefLevelDpi());
QStringList autocreationTypes;