Skip to content

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

C

set stage::inch to 120

Jeremy Bullock20a966a90830
diff --git a/toonz/sources/common/tunit/tunit.cpp b/toonz/sources/common/tunit/tunit.cpp
index 46efe326a..de79b5c85 100644
--- a/toonz/sources/common/tunit/tunit.cpp
+++ b/toonz/sources/common/tunit/tunit.cpp
@@ -347,7 +347,7 @@ TMeasureManager::TMeasureManager() {
m->add(cameraYFld.clone());
add(m);
- const double stage_inch = 53.33333; //Stage::inch
+ const double stage_inch = 120; //Stage::inch used to be 53.33333
TUnit fxLength(L"fxLength"),
fxInch(L"in", new TSimpleUnitConverter(1 / stage_inch)),
diff --git a/toonz/sources/include/toonz/stage.h b/toonz/sources/include/toonz/stage.h
index b25ad606a..af6f99e1d 100644
--- a/toonz/sources/include/toonz/stage.h
+++ b/toonz/sources/include/toonz/stage.h
@@ -43,6 +43,7 @@ namespace Stage {
//=============================================================================
DVVAR extern const double inch;
+DVVAR extern const double vectorDpi;
class Visitor;
struct VisitArgs;
diff --git a/toonz/sources/include/toonz/tcamera.h b/toonz/sources/include/toonz/tcamera.h
index 1e8f45056..abb7cfdc3 100644
--- a/toonz/sources/include/toonz/tcamera.h
+++ b/toonz/sources/include/toonz/tcamera.h
@@ -39,7 +39,7 @@ class DVAPI TCamera {
public:
/*!
Constructs TCamera with default value, size (12,9) and resolution (768,576).
- Constructs TCamera with default value, size (35.9955, 20.2544) and resolution (1920,1080).
+ Constructs TCamera with default value, size (16, 9) and resolution (1920,1080).
- 05/31/16
*/
TCamera();
diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp
index b0beba889..75326dc1e 100644
--- a/toonz/sources/toonz/iocommand.cpp
+++ b/toonz/sources/toonz/iocommand.cpp
@@ -1257,7 +1257,7 @@ bool IoCmd::saveSceneIfNeeded(QString msg) {
void IoCmd::newScene() {
RenderingSuspender suspender;
TApp *app = TApp::instance();
- double cameraDpi = 53.3333;
+ double cameraDpi = 120; //used to be 64
if (!saveSceneIfNeeded(QApplication::tr("New Scene"))) return;
IconGenerator::instance()->clearRequests();
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index fc8b3eff2..30087f5d4 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -216,14 +216,15 @@ Preferences::LevelFormat PreferencesPopup::FormatProperties::levelFormat()
void PreferencesPopup::onPixelsOnlyChanged(int index) {
bool enabled = index == Qt::Checked;
if (enabled) {
- m_pref->setDefLevelDpi(53.3333);
+
+ m_pref->setDefLevelDpi(120);
m_pref->setPixelsOnly(true);
TCamera* camera;
camera = TApp::instance()->getCurrentScene()->getScene()->getCurrentCamera();
TDimension camRes = camera->getRes();
TDimensionD camSize;
- camSize.lx = camRes.lx / 53.3333;
- camSize.ly = camRes.ly / 53.3333;
+ camSize.lx = camRes.lx / 120;
+ camSize.ly = camRes.ly / 120;
camera->setSize(camSize);
m_pref->storeOldUnits();
if (m_unitOm->currentIndex() != 4)
@@ -883,10 +884,7 @@ PreferencesPopup::PreferencesPopup()
new CheckBox(tr("All imported images will use the same DPI"), this);
m_unitOm = new QComboBox(this);
m_cameraUnitOm = new QComboBox(this);
- if (m_pref->getPixelsOnly()){
- m_unitOm->setDisabled(true);
- m_cameraUnitOm->setDisabled(true);
- }
+
// Choose between standard and Studio Ghibli rooms
QComboBox *roomChoice = new QComboBox(this);
@@ -1065,8 +1063,13 @@ PreferencesPopup::PreferencesPopup()
}
styleSheetType->addItems(styleSheetList);
styleSheetType->setCurrentIndex(currentIndex);
- //m_pixelsOnlyCB->setChecked(m_pref->getPixelsOnly());
- m_pixelsOnlyCB->setChecked(true);
+ bool po = m_pref->getPixelsOnly();
+ m_pixelsOnlyCB->setChecked(po);
+ //m_pixelsOnlyCB->setChecked(true);
+ if (po){
+ m_unitOm->setDisabled(true);
+ m_cameraUnitOm->setDisabled(true);
+ }
QStringList type;
type << tr("cm") << tr("mm") << tr("inch") << tr("field") << tr("pixel");
m_unitOm->addItems(type);
diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp
index 83ce957d8..ecaaaa3f7 100644
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@ -208,7 +208,8 @@ bool Preferences::LevelFormat::matches(const TFilePath &fp) const {
//**********************************************************************************
Preferences::Preferences()
- : m_units("mm")
+ : m_pixelsOnly(false)
+ , m_units("mm")
, m_cameraUnits("inch")
, m_currentRoomChoice("Default")
, m_scanLevelType("tif")
@@ -373,9 +374,14 @@ Preferences::Preferences()
setUndoMemorySize(m_undoMemorySize);
m_blankColor = TPixel32(r, g, b);
- getValue(*m_settings, "pixelsOnly", m_pixelsOnly);
+
//for Pixels only
+
+ getValue(*m_settings, "pixelsOnly", m_pixelsOnly); //doesn't work for some reason.
+ QString pos = m_settings->value("pixelsOnly").toString();
+ if (pos == "true") m_pixelsOnly = true;
+
QString units;
units = m_settings->value("oldUnits", m_units).toString();
m_oldUnits = units;
diff --git a/toonz/sources/toonzlib/stage.cpp b/toonz/sources/toonzlib/stage.cpp
index edcc9911a..ce3f670a7 100644
--- a/toonz/sources/toonzlib/stage.cpp
+++ b/toonz/sources/toonzlib/stage.cpp
@@ -69,7 +69,8 @@ typedef std::vector<Player> PlayerSet;
thickness of
images .pli.
*/
-const double Stage::inch = 53.33333;
+const double Stage::inch = 120; //used to be 53.33333
+const double Stage::vectorDpi = 53.3333;
namespace {
void updateOnionSkinSize(const PlayerSet &players) {
diff --git a/toonz/sources/toonzlib/tcamera.cpp b/toonz/sources/toonzlib/tcamera.cpp
index 495ecab73..dbc35cde8 100644
--- a/toonz/sources/toonzlib/tcamera.cpp
+++ b/toonz/sources/toonzlib/tcamera.cpp
@@ -10,7 +10,7 @@
TCamera::TCamera()
//: m_size(12, 9), m_res(768, 576), m_xPrevalence(true)
- : m_size(35.9955, 20.2544),
+ : m_size(16, 9),
m_res(1920, 1080),
m_xPrevalence(true) {}
diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp
index 354620b1b..7ccd82eb7 100644
--- a/toonz/sources/toonzlib/toonzscene.cpp
+++ b/toonz/sources/toonzlib/toonzscene.cpp
@@ -1176,7 +1176,7 @@ TXshLevel *ToonzScene::loadLevel(const TFilePath &actualPath,
// We must check whether the image actually has a dpi.
const TPointD &imageDpi = xl->getImageDpi();
- if (imageDpi == TPointD()) {
+ if (imageDpi == TPointD() || Preferences::instance()->getUnits() == "pixel") {
// Change to "Custom Dpi" policy and use camera dpi
TStageObjectId cameraId =
getXsheet()->getStageObjectTree()->getCurrentCameraId();
diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp
index c46a7a876..e91f67b29 100644
--- a/toonz/sources/toonzlib/txshsimplelevel.cpp
+++ b/toonz/sources/toonzlib/txshsimplelevel.cpp
@@ -382,7 +382,7 @@ void TXshSimpleLevel::setPath(const TFilePath &fp, bool keepFrames) {
} catch (...) {
}
}
-
+
if (getType() != PLI_XSHLEVEL) {
if (!m_frames.empty()) {
std::string imageId = getImageId(getFirstFid());
@@ -396,8 +396,8 @@ void TXshSimpleLevel::setPath(const TFilePath &fp, bool keepFrames) {
imageDpi.x = imageInfo->m_dpix;
imageDpi.y = imageInfo->m_dpiy;
if (Preferences::instance()->getUnits() == "pixel") {
- imageDpi.x = 53.3333;
- imageDpi.y = 53.3333;
+ imageDpi.x = Stage::inch;
+ imageDpi.y = Stage::inch;
}
m_properties->setImageDpi(imageDpi);
m_properties->setImageRes(imageRes);
@@ -1179,9 +1179,10 @@ void TXshSimpleLevel::load() {
imageRes.ly = imageInfo->m_ly;
imageDpi.x = imageInfo->m_dpix;
imageDpi.y = imageInfo->m_dpiy;
+ std::string un = Preferences::instance()->getUnits().toStdString();
if (Preferences::instance()->getUnits() == "pixel") {
- imageDpi.x = 53.3333;
- imageDpi.y = 53.3333;
+ imageDpi.x = Stage::inch;
+ imageDpi.y = Stage::inch;
}
m_properties->setImageDpi(imageDpi);
m_properties->setImageRes(imageRes);
@@ -1291,8 +1292,8 @@ void TXshSimpleLevel::load(const std::vector<TFrameId> &fIds) {
imageDpi.x = imageInfo->m_dpix;
imageDpi.y = imageInfo->m_dpiy;
if (Preferences::instance()->getUnits() == "pixel") {
- imageDpi.x = 53.3333;
- imageDpi.y = 53.3333;
+ imageDpi.x = Stage::inch;
+ imageDpi.y = Stage::inch;
}
m_properties->setImageDpi(imageDpi);
m_properties->setImageRes(imageRes);