Skip to content

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

C

Remove framenumber offset logic

manongjohna6ca461a210a
diff --git a/toonz/sources/toonz/ocaio.cpp b/toonz/sources/toonz/ocaio.cpp
index f317624b1..7f294e37b 100644
--- a/toonz/sources/toonz/ocaio.cpp
+++ b/toonz/sources/toonz/ocaio.cpp
@@ -54,8 +54,8 @@ void OCAData::write(QJsonObject &json) const {
json["frameRate"] = m_framerate;
json["width"] = m_width;
json["height"] = m_height;
- json["startTime"] = m_startTime + m_stOff;
- json["endTime"] = m_endTime + m_stOff;
+ json["startTime"] = m_startTime;
+ json["endTime"] = m_endTime;
json["colorDepth"] = m_raEXR ? "U16" : "U8";
// Background color
@@ -261,7 +261,7 @@ bool OCAData::buildLayer(QJsonObject &json, const QList<int> &rows,
jsonPosition.append(m_height / 2);
int len = frameLen(column, rows, i);
- frame["frameNumber"] = i + m_stOff;
+ frame["frameNumber"] = i;
frame["position"] = jsonPosition;
frame["opacity"] = 1.0; // OT uses Transparency Fx node
frame["duration"] = len;
@@ -323,14 +323,13 @@ void OCAData::setProgressDialog(DVGui::ProgressDialog *dialog) {
}
void OCAData::build(ToonzScene *scene, TXsheet *xsheet, QString name,
- QString path, int startOffset, bool useEXR,
- bool vectorAsSVG, bool exportReferences) {
+ QString path, bool useEXR, bool vectorAsSVG,
+ bool exportReferences) {
m_name = name;
m_path = path;
m_subId = 0;
m_raEXR = useEXR;
m_veSVG = vectorAsSVG;
- m_stOff = startOffset;
// if the current xsheet is top xsheet in the scene and the output
// frame range is specified, set the "to" frame value as duration
@@ -404,9 +403,6 @@ void ExportOCACommand::execute() {
static QCheckBox *exrImageFormat = nullptr;
static QCheckBox *rasVectors = nullptr;
static QCheckBox *doKeyframing = nullptr;
- static QHBoxLayout *startingOffsetLay = nullptr;
- static QLabel *startingOffsetLab = nullptr;
- static QSpinBox *startingOffsetSpin = nullptr;
static QCheckBox *exportReferences = nullptr;
static DVGui::ProgressDialog *progressDialog = nullptr;
@@ -418,10 +414,6 @@ void ExportOCACommand::execute() {
rasVectors = new QCheckBox(tr("Rasterize Vectors"));
exportReferences = new QCheckBox(tr("Export Reference Layers"));
- startingOffsetLay = new QHBoxLayout();
- startingOffsetLab = new QLabel(tr("Frame Offset: "));
- startingOffsetSpin = new QSpinBox();
-
exrImageFormat->setToolTip(
tr("Checked: Images are saved as EXR\nUnchecked: Images are "
"saved as PNG"));
@@ -432,26 +424,14 @@ void ExportOCACommand::execute() {
tr("Checked: Layers with Preview Visible OFF are also "
"exported\nUnchecked: Only layers with Preview Visible ON are "
"exported"));
- startingOffsetLab->setToolTip(tr("Starting Frame Offset"));
- startingOffsetSpin->setToolTip(tr("Starting Frame Offset"));
rasVectors->setChecked(true);
- startingOffsetSpin->setValue(1);
- startingOffsetSpin->setMinimum(0);
- startingOffsetSpin->setMaximum(1000000);
- startingOffsetLab->adjustSize();
- startingOffsetLay->setMargin(0);
- startingOffsetLay->setSpacing(0);
- startingOffsetLay->addWidget(startingOffsetLab, 0, Qt::AlignRight);
- startingOffsetLay->addWidget(startingOffsetSpin);
-
QGridLayout *customLay = new QGridLayout();
customLay->setMargin(5);
customLay->setSpacing(5);
customLay->addWidget(exrImageFormat, 0, 0);
customLay->addWidget(rasVectors, 1, 0);
customLay->addWidget(exportReferences, 2, 0);
- customLay->addLayout(startingOffsetLay, 0, 1);
customWidget->setLayout(customLay);
progressDialog = new DVGui::ProgressDialog("", tr("Hide"), 0, 0);
@@ -474,7 +454,6 @@ void ExportOCACommand::execute() {
fp = savePopup->getPath();
if (fp.isEmpty()) return;
- int frameOffset = startingOffsetSpin->value();
bool exrImageFmt = exrImageFormat->isChecked();
bool rasterVecs = rasVectors->isChecked();
bool exportRefs = exportReferences->isChecked();
@@ -509,7 +488,7 @@ void ExportOCACommand::execute() {
OCAData ocaData;
ocaData.setProgressDialog(progressDialog);
ocaData.build(scene, xsheet, QString::fromStdString(fp.getName()), ocafolder,
- frameOffset, exrImageFmt, !rasterVecs, exportRefs);
+ exrImageFmt, !rasterVecs, exportRefs);
if (ocaData.isEmpty()) {
progressDialog->close();
DVGui::error(QObject::tr("No columns can be exported."));
@@ -835,9 +814,6 @@ void OCAIo::OCAInputData::importOcaLayer(const QJsonObject &jsonLayer,
column->setCamstandVisible(jsonLayer["visible"].toBool());
column->setColorFilterId(jsonLayer["label"].toInt());
- int frameOffset = 0;
- if (m_startTime < 1) frameOffset = -m_startTime + 1;
-
int lastFrame = 0;
for (auto frame : jsonLayer["frames"].toArray()) {
TXshCell cell;
@@ -854,10 +830,6 @@ void OCAIo::OCAInputData::importOcaLayer(const QJsonObject &jsonLayer,
int row = frame.toObject()["frameNumber"].toInt();
- // -1 converts framenumber to index, frameOffset moves the frame range
- // above 0...
- row = row - 1 + frameOffset;
-
int duration = frame.toObject()["duration"].toInt();
lastFrame += duration;
diff --git a/toonz/sources/toonz/ocaio.h b/toonz/sources/toonz/ocaio.h
index e5b7ee1d5..43e34853f 100644
--- a/toonz/sources/toonz/ocaio.h
+++ b/toonz/sources/toonz/ocaio.h
@@ -45,7 +45,6 @@ protected:
int m_subId;
QMap<QString, OCAAsset> m_assets;
bool m_raEXR, m_veSVG;
- int m_stOff;
DVGui::ProgressDialog *m_progressDialog;
@@ -65,8 +64,7 @@ public:
void setProgressDialog(DVGui::ProgressDialog *dialog);
void build(ToonzScene *scene, TXsheet *xsheet, QString name, QString path,
- int startOffset, bool useEXR, bool vectorAsSVG,
- bool exportReferences);
+ bool useEXR, bool vectorAsSVG, bool exportReferences);
bool isEmpty() { return m_layers.isEmpty(); }
};