Skip to content

Commit

Permalink
Merge branch 'opentoonz:master' into Fix-update-folder-failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Abel032 authored Jan 18, 2025
2 parents 0693939 + f7a250f commit 54e2c1f
Show file tree
Hide file tree
Showing 75 changed files with 140 additions and 67 deletions.
19 changes: 13 additions & 6 deletions stuff/library/mypaint brushes/Licenses.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
Files: classic/*, experimental/*
By policy, MyPaint's brush settings are released into the public domain.
For more details, see the MyPaint licensing policy here:
https://github.com/mypaint/mypaint/wiki/Licensing-policy

See also the Creative Commons Zero 1.0 (CC0-1.0) license at Creative Commons:
https://creativecommons.org/publicdomain/zero/1.0


Files: classic/*, experimental/*
Copyright: Copyright 2011-2013 Martin Renold and the MyPaint Development Team
By policy, MyPaint's brush settings are released into the public domain.
See: https://github.com/mypaint/mypaint/wiki/Licensing-policy
License: CC0-1.0

Files: ramon/*
Expand All @@ -20,13 +26,14 @@ Files: kaerhon_v1/*
Copyright: Author: Guillaume Loussarévian
License: CC0-1.0

Files: Mojo/*
Files: mojo_v1/*
Copyright: Author: Saeger Ryman
License: CC0-1.0

Files: aotz/*
Copyright: Author: Anderson Prado (AndeOn) [https://github.com/andeon/aotz]
License: CC0-1.0

See also CC0-1.0 license at creativecommons.org
https://creativecommons.org/publicdomain/zero/1.0/
Files: slos_mpb/*
Copyright: Author: 森林OS (SenlinOS) [https://github.com/SenlinOS/MyPaintBrushes-GIMP]
License: CC0-1.0
60 changes: 0 additions & 60 deletions stuff/library/mypaint brushes/SLOS_MPB/README.txt

This file was deleted.

1 change: 0 additions & 1 deletion stuff/library/mypaint brushes/SLOS_MPB/gimp brush.txt

This file was deleted.

126 changes: 126 additions & 0 deletions toonz/sources/toonz/exportxsheetpdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,7 @@ ExportXsheetPdfPopup::ExportXsheetPdfPopup()

QPushButton* exportBtn = new QPushButton(tr("Export PDF"), this);
QPushButton* exportPngBtn = new QPushButton(tr("Export PNG"), this);
QPushButton* exportCsvBtn = new QPushButton(tr("Export CSV"), this);
QPushButton* cancelBtn = new QPushButton(tr("Cancel"), this);

m_tick1IdCombo = new QComboBox(this);
Expand Down Expand Up @@ -2133,6 +2134,7 @@ ExportXsheetPdfPopup::ExportXsheetPdfPopup()
btnLay->addStretch(1);
btnLay->addWidget(exportBtn, 0);
btnLay->addWidget(exportPngBtn, 0);
btnLay->addWidget(exportCsvBtn, 0);
btnLay->addWidget(cancelBtn, 0);
}
rightLay->addLayout(btnLay, 0);
Expand All @@ -2146,6 +2148,7 @@ ExportXsheetPdfPopup::ExportXsheetPdfPopup()

connect(exportBtn, SIGNAL(clicked()), this, SLOT(onExport()));
connect(exportPngBtn, SIGNAL(clicked()), this, SLOT(onExportPNG()));
connect(exportCsvBtn, SIGNAL(clicked()), this, SLOT(onExportCSV()));
connect(cancelBtn, SIGNAL(clicked()), this, SLOT(close()));

connect(m_durationFld, SIGNAL(editingFinished()), this,
Expand Down Expand Up @@ -2710,6 +2713,129 @@ void ExportXsheetPdfPopup::onExportPNG() {
onExportFinished(fp);
}

void ExportXsheetPdfPopup::onExportCSV() {
ToonzScene* scene = TApp::instance()->getCurrentScene()->getScene();

if (m_fileNameFld->text().isEmpty()) {
DVGui::MsgBoxInPopup(DVGui::WARNING, tr("Please specify the file name."));
return;
}

TFilePath fp(m_pathFld->getPath());
fp += m_fileNameFld->text().toStdString() + ".csv";
fp = scene->decodeFilePath(fp);

if (TSystem::doesExistFileOrLevel(fp)) {
QString question =
tr("The file %1 already exists.\nDo you want to overwrite it?")
.arg(fp.getQString());
int ret = DVGui::MsgBox(question, QObject::tr("Overwrite"),
QObject::tr("Cancel"));
if (ret == 0 || ret == 2) {
return;
}
}
if (!TFileStatus(fp.getParentDir()).doesExist()) {
QString question =
tr("A folder %1 does not exist.\nDo you want to create it?")
.arg(fp.getParentDir().getQString());
int ret = DVGui::MsgBox(question, QObject::tr("Create folder"),
QObject::tr("Cancel"));
if (ret == 0 || ret == 2) {
return;
}

if (!TSystem::touchParentDir(fp)) {
DVGui::MsgBoxInPopup(DVGui::CRITICAL,
tr("Failed to create folder %1.")
.arg(fp.getParentDir().getQString()));
return;
}
}

QFile file(fp.getQString());
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
DVGui::MsgBoxInPopup(
DVGui::CRITICAL,
tr("Failed to create file %1.").arg(fp.getQString()));
return;
}
QTextStream stream(&file);

QList<QStringList> csvColumns;
for (auto pair = m_columns.begin(); pair != m_columns.end(); pair++) {
TXshLevelColumn* column = pair->first;
QString columnName = pair->second;
QStringList csvCol;

// obtain level in this column
int r0, r1;
column->getRange(r0, r1);
TXshLevelP level = column->getCell(r0).m_level;

if (columnName.isEmpty())
columnName = QString::fromStdWString(level->getName());

// add col name at col head
csvCol.append(columnName);

TXshCell prevCell,cell;
for (int f = 0; f < m_duration; f++) {
cell = column->getCell(f);
if (prevCell == cell && f) {
csvCol.append("");
continue;
}

if (cell.m_level != level) cell.m_level = nullptr;

//add cell number
if (cell.m_level)
csvCol.append(QString::number(cell.m_frameId.getNumber()));
else// add ¡Á
csvCol.append(QString::fromUtf8("\u00D7"));

prevCell = cell;
}

csvColumns.append(csvCol);
}

QStringList rowData;

//First Row
rowData.append("\"Frame\"");
for (const QStringList& column : csvColumns) {
rowData.append("\"\"");
}
stream << rowData.join(",") << "\n";
rowData.clear();

//Second Row
rowData.append("\"\"");
for (const QStringList& column : csvColumns) {
rowData.append("\"" + column[0] + "\"");
}
stream << rowData.join(",") << "\n";
rowData.clear();

//Third Row and rest rows
for (int f = 1; f <= m_duration; ++f) {
rowData.append("\"" + QString::number(f) + "\"");

for (const QStringList& column : csvColumns) {
rowData.append("\"" + column[f] + "\"");
}

stream << rowData.join(",") << "\n";
rowData.clear();
}

file.close();

onExportFinished(fp);
}

void ExportXsheetPdfPopup::onExportFinished(const TFilePath& fp) {
close();
QString str = QObject::tr("The file %1 has been exported successfully.")
Expand Down
1 change: 1 addition & 0 deletions toonz/sources/toonz/exportxsheetpdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ class ExportXsheetPdfPopup final : public DVGui::Dialog {
protected slots:
void onExport();
void onExportPNG();
void onExportCSV();

void initTemplate();
void setInfo();
Expand Down

0 comments on commit 54e2c1f

Please sign in to comment.