OpenToonz - An open-source full-featured 2D animation creation software
C
clang format
shun-iwasawafe2893b15cfa
diff --git a/toonz/sources/common/expressions/ttokenizer.cpp b/toonz/sources/common/expressions/ttokenizer.cppindex dc20cda74..d6b237231 100644--- a/toonz/sources/common/expressions/ttokenizer.cpp+++ b/toonz/sources/common/expressions/ttokenizer.cpp@@ -166,4 +166,4 @@ Token Tokenizer::getTokenFromPos(int pos) const {//===================================================================-} // TSyntax+} // namespace TSyntaxdiff --git a/toonz/sources/common/tparam/tspectrumparam.cpp b/toonz/sources/common/tparam/tspectrumparam.cppindex e4de9d143..f0d502ddd 100644--- a/toonz/sources/common/tparam/tspectrumparam.cpp+++ b/toonz/sources/common/tparam/tspectrumparam.cpp@@ -128,7 +128,7 @@ void TSpectrumParam::removeObserver(TParamObserver *obs) {TSpectrumParam::TSpectrumParam(std::vector<TSpectrum::ColorKey> const &keys): m_imp(new TSpectrumParamImp(this)) {- for (auto const & key : keys) {+ for (auto const &key : keys) {double v = key.first;TPixel32 pix = key.second;TDoubleParamP dp(v);diff --git a/toonz/sources/include/toonzqt/functionsegmentviewer.h b/toonz/sources/include/toonzqt/functionsegmentviewer.hindex 64ea158e9..c05ddcba8 100644--- a/toonz/sources/include/toonzqt/functionsegmentviewer.h+++ b/toonz/sources/include/toonzqt/functionsegmentviewer.h@@ -32,7 +32,7 @@ namespace DVGui {class MeasuredDoubleLineEdit;class ExpressionField;class FileField;-}+} // namespace DVGui//-----------------------------------------------------------------------------diff --git a/toonz/sources/stdfx/cloudsfx.cpp b/toonz/sources/stdfx/cloudsfx.cppindex 3474d205c..0fe2b003e 100644--- a/toonz/sources/stdfx/cloudsfx.cpp+++ b/toonz/sources/stdfx/cloudsfx.cpp@@ -57,15 +57,15 @@ public://==================================================================void CloudsFx::doCompute(TTile &tile, double frame, const TRenderSettings &ri) {- double scale = sqrt(fabs(ri.m_affine.det()));- int type = m_type->getValue();- double min = m_min->getValue(frame);- double max = m_max->getValue(frame);- double evolution = m_evol->getValue(frame);- double size = m_size->getValue(frame) / ri.m_shrinkX;- size = fabs(size);+ double scale = sqrt(fabs(ri.m_affine.det()));+ int type = m_type->getValue();+ double min = m_min->getValue(frame);+ double max = m_max->getValue(frame);+ double evolution = m_evol->getValue(frame);+ double size = m_size->getValue(frame) / ri.m_shrinkX;+ size = fabs(size);if (size < 0.01) size = 0.01;- TPointD pos = tile.m_pos;+ TPointD pos = tile.m_pos;doClouds(tile.getRaster(), m_colors, pos, evolution, size, min, max, type,scale, frame);diff --git a/toonz/sources/stdfx/stdfx.cpp b/toonz/sources/stdfx/stdfx.cppindex 5495e92de..cd8499bdb 100644--- a/toonz/sources/stdfx/stdfx.cpp+++ b/toonz/sources/stdfx/stdfx.cpp@@ -128,7 +128,7 @@ void doComputeT(TRasterPT<T> raster, TPointD posTrasf, const TAffine &aff,TPointD posAux = posTrasf;T *pix = raster->pixels(y);for (int x = 0; x < raster->getLx(); x++) {- double ang = 0.0;+ double ang = 0.0;if (posAux.x != 0 || posAux.y != 0) ang = atan2(posAux.y, posAux.x);double r = sqrt(posAux.x * posAux.x + posAux.y * posAux.y);double v = 0.5 * (1 + sin(r * freq + ang + phase));@@ -141,7 +141,7 @@ void doComputeT(TRasterPT<T> raster, TPointD posTrasf, const TAffine &aff,}raster->unlock();}-}+} // namespace//==================================================================@@ -304,13 +304,13 @@ void doComputeT(TRasterPT<T> ras, TPointD posTrasf,T *endPix = pix + ras->getLx();while (pix < endPix) {if (w_amplitude) shift = w_amplitude * sin(w_freq * posAux.y + w_phase);- double radius = posAux.x + shift;- double t = 1;+ double radius = posAux.x + shift;+ double t = 1;if (fabs(radius) < maxRadius) {t = (radius + maxRadius + cycle) * freq;t -= floor(t);} else if (radius < 0)- t = 0;+ t = 0;double polinomfactor = (-2 * t + 3) * (t * t);// pos.x += 1.0;*pix++ = spectrum.getPremultipliedValue(polinomfactor);@@ -322,7 +322,7 @@ void doComputeT(TRasterPT<T> ras, TPointD posTrasf,}ras->unlock();}-}+} // namespace//==================================================================@@ -533,7 +533,7 @@ void RadialGradientFx::doCompute(TTile &tile, double frame,if (innerperiod < period)inner = innerperiod / period;else- inner = 1 - TConsts::epsilon;+ inner = 1 - TConsts::epsilon;std::vector<TSpectrum::ColorKey> colors = {TSpectrum::ColorKey(0, m_color1->getValue(frame)),TSpectrum::ColorKey(inner, m_color1->getValue(frame)),@@ -632,7 +632,7 @@ void doComputeT(TRasterPT<T> raster, TPointD posTrasf, const TAffine &aff,}if (result > 1) result = 1;if (result < 0) result = 0;- *pix++ = blend(T::Black, pixelColor, result);+ *pix++ = blend(T::Black, pixelColor, result);posAux.x += aff.a11;posAux.y += aff.a21;}@@ -641,7 +641,7 @@ void doComputeT(TRasterPT<T> raster, TPointD posTrasf, const TAffine &aff,}raster->unlock();}-}+} // namespace//==================================================================diff --git a/toonz/sources/toonz/projectpopup.cpp b/toonz/sources/toonz/projectpopup.cppindex 2df342916..638f99945 100644--- a/toonz/sources/toonz/projectpopup.cpp+++ b/toonz/sources/toonz/projectpopup.cpp@@ -145,7 +145,7 @@ DvDirModelNode *ProjectDirModel::getNode(const QModelIndex &index) const {QModelIndex ProjectDirModel::index(int row, int column,const QModelIndex &parent) const {if (column != 0) return QModelIndex();- DvDirModelNode *parentNode = m_root;+ DvDirModelNode *parentNode = m_root;if (parent.isValid()) parentNode = getNode(parent);if (row < 0 || row >= parentNode->getChildCount()) return QModelIndex();DvDirModelNode *node = parentNode->getChild(row);@@ -322,7 +322,8 @@ ProjectPopup::ProjectPopup(bool isModal)upperLayout->addWidget(ff, i + 2, 1);}std::vector<std::tuple<QString, std::string>> cbs = {- std::make_tuple(tr("Append $scenepath to +drawings"), TProject::Drawings),+ std::make_tuple(tr("Append $scenepath to +drawings"),+ TProject::Drawings),std::make_tuple(tr("Append $scenepath to +inputs"), TProject::Inputs),std::make_tuple(tr("Append $scenepath to +extras"), TProject::Extras)};int currentRow = upperLayout->rowCount();diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cppindex b1d23aaac..b2fa9129f 100644--- a/toonz/sources/toonz/sceneviewer.cpp+++ b/toonz/sources/toonz/sceneviewer.cpp@@ -1696,7 +1696,7 @@ double SceneViewer::projectToZ(const TPointD &delta) {GLint viewport[4];double modelview[16], projection[16];glGetIntegerv(GL_VIEWPORT, viewport);- for (int i = 0; i < 16; i++)+ for (int i = 0; i < 16; i++)projection[i] = (double)m_projectionMatrix.constData()[i];glGetDoublev(GL_MODELVIEW_MATRIX, modelview);@@ -1858,8 +1858,9 @@ void SceneViewer::zoomQt(bool forward, bool reset) {if (reset || ((m_zoomScale3D < 500 || !forward) &&(m_zoomScale3D > 0.01 || forward))) {double oldZoomScale = m_zoomScale3D;- m_zoomScale3D = reset ? 1 : ImageUtils::getQuantizedZoomFactor(- m_zoomScale3D, forward);+ m_zoomScale3D =+ reset ? 1+ : ImageUtils::getQuantizedZoomFactor(m_zoomScale3D, forward);m_pan3D = -(m_zoomScale3D / oldZoomScale) * -m_pan3D;}@@ -1880,17 +1881,18 @@ void SceneViewer::zoomQt(bool forward, bool reset) {int i;for (i = 0; i < 2; i++) {- TAffine &viewAff = m_viewAff[i];+ TAffine &viewAff = m_viewAff[i];if (m_isFlippedX) viewAff = viewAff * TScale(-1, 1);if (m_isFlippedX) viewAff = viewAff * TScale(1, -1);- double scale2 = std::abs(viewAff.det());+ double scale2 = std::abs(viewAff.det());if (m_isFlippedX) viewAff = viewAff * TScale(-1, 1);if (m_isFlippedX) viewAff = viewAff * TScale(1, -1);if (reset || ((scale2 < 100000 || !forward) &&(scale2 > 0.001 * 0.05 || forward))) {double oldZoomScale = sqrt(scale2) * dpiFactor;- double zoomScale = reset ? 1 : ImageUtils::getQuantizedZoomFactor(- oldZoomScale, forward);+ double zoomScale =+ reset ? 1+ : ImageUtils::getQuantizedZoomFactor(oldZoomScale, forward);// threshold value -0.001 is intended to absorb the error of calculationif ((oldZoomScale - zoomScaleFittingWithScreen) *@@ -2162,9 +2164,9 @@ void SceneViewer::fitToCamera() {TPointD P11 = cameraAff * cameraRect.getP11();TPointD p0 = TPointD(std::min({P00.x, P01.x, P10.x, P11.x}),std::min({P00.y, P01.y, P10.y, P11.y}));- TPointD p1 = TPointD(std::max({P00.x, P01.x, P10.x, P11.x}),+ TPointD p1 = TPointD(std::max({P00.x, P01.x, P10.x, P11.x}),std::max({P00.y, P01.y, P10.y, P11.y}));- cameraRect = TRectD(p0.x, p0.y, p1.x, p1.y);+ cameraRect = TRectD(p0.x, p0.y, p1.x, p1.y);// Panif (!is3DView()) {@@ -2213,8 +2215,8 @@ void SceneViewer::resetZoom() {TPointD realCenter(m_viewAff[m_viewMode].a13, m_viewAff[m_viewMode].a23);TAffine aff =getNormalZoomScale() * TRotation(realCenter, m_rotationAngle[m_viewMode]);- aff.a13 = realCenter.x;- aff.a23 = realCenter.y;+ aff.a13 = realCenter.x;+ aff.a23 = realCenter.y;if (m_isFlippedX) aff = aff * TScale(-1, 1);if (m_isFlippedY) aff = aff * TScale(1, -1);setViewMatrix(aff, m_viewMode);@@ -2271,16 +2273,17 @@ void SceneViewer::setActualPixelSize() {} elsedpi = sl->getDpi(fid);- const double inch = Stage::inch;- TAffine tempAff = getNormalZoomScale();- if (m_isFlippedX) tempAff = tempAff * TScale(-1, 1);- if (m_isFlippedY) tempAff = tempAff * TScale(1, -1);- TPointD tempScale = dpi;+ const double inch = Stage::inch;+ TAffine tempAff = getNormalZoomScale();+ if (m_isFlippedX) tempAff = tempAff * TScale(-1, 1);+ if (m_isFlippedY) tempAff = tempAff * TScale(1, -1);+ TPointD tempScale = dpi;if (m_isFlippedX) tempScale.x = -tempScale.x;if (m_isFlippedY) tempScale.y = -tempScale.y;for (int i = 0; i < m_viewAff.size(); ++i)- setViewMatrix(dpi == TPointD(0, 0) ? tempAff : TScale(tempScale.x / inch,- tempScale.y / inch),+ setViewMatrix(dpi == TPointD(0, 0)+ ? tempAff+ : TScale(tempScale.x / inch, tempScale.y / inch),i);m_pos = QPoint(0, 0);@@ -2563,7 +2566,7 @@ void drawSpline(const TAffine &viewMatrix, const TRect &clipRect, bool camera3d,TStageObject *pegbar =objId != TStageObjectId::NoneId ? xsh->getStageObject(objId) : 0;- const TStroke *stroke = 0;+ const TStroke *stroke = 0;if (pegbar && pegbar->getSpline()) stroke = pegbar->getSpline()->getStroke();if (!stroke) return;diff --git a/toonz/sources/toonz/sceneviewer.h b/toonz/sources/toonz/sceneviewer.hindex 940462121..ec2ccb389 100644--- a/toonz/sources/toonz/sceneviewer.h+++ b/toonz/sources/toonz/sceneviewer.h@@ -99,11 +99,11 @@ class SceneViewer final : public GLWidgetForHighDpi,bool m_isMouseEntered, m_forceGlFlush;bool m_isFlippedX = false, m_isFlippedY = false;/*! FreezedStatus:-* \li NO_FREEZED freezed is not active;-* \li NORMAL_FREEZED freezed is active: show grab image;-* \li UPDATE_FREEZED freezed is active: draw last unfreezed image and grab-* view;-*/+ * \li NO_FREEZED freezed is not active;+ * \li NORMAL_FREEZED freezed is active: show grab image;+ * \li UPDATE_FREEZED freezed is active: draw last unfreezed image and grab+ * view;+ */enum FreezedStatus {NO_FREEZED = 0,NORMAL_FREEZED = 1,diff --git a/toonz/sources/toonzlib/tproject.cpp b/toonz/sources/toonzlib/tproject.cppindex aadb17bb6..54ee68311 100644--- a/toonz/sources/toonzlib/tproject.cpp+++ b/toonz/sources/toonzlib/tproject.cpp@@ -918,7 +918,7 @@ TFilePath TProjectManager::getCurrentProjectPath() {}fp = searchProjectPath(fp.getParentDir());if (!TFileStatus(fp).doesExist())- fp = projectNameToProjectPath(TProject::SandboxProjectName);+ fp = projectNameToProjectPath(TProject::SandboxProjectName);fp = getLatestVersionProjectPath(fp);string s = ::to_string(fp);if (s != (string)currentProjectPath) currentProjectPath = s;diff --git a/toonz/sources/toonzlib/txsheetexpr.cpp b/toonz/sources/toonzlib/txsheetexpr.cppindex 2d76ce1fa..8dd475ceb 100644--- a/toonz/sources/toonzlib/txsheetexpr.cpp+++ b/toonz/sources/toonzlib/txsheetexpr.cpp@@ -82,7 +82,7 @@ public:TMeasure *measure = m_param->getMeasure();if (measure) {const TUnit *unit = measure->getCurrentUnit();- if (unit) value = unit->convertTo(value);+ if (unit) value = unit->convertTo(value);}return value;}@@ -542,9 +542,8 @@ public:const QString &vertexName =QString::fromStdString(tokens[VERTEX_NAME].getText());if (SkVD *skvd = skdp->vertexDeformation(vertexName)) {- const Component *componentsEnd =- m_components +- sizeof(m_components) / sizeof(Component),+ const Component *componentsEnd = m_components + sizeof(m_components) /+ sizeof(Component),*component = std::find(m_components, componentsEnd,tokens[COMPONENT].getText());diff --git a/toonz/sources/toonzqt/functionsegmentviewer.cpp b/toonz/sources/toonzqt/functionsegmentviewer.cppindex 95e8ea42c..fb1635659 100644--- a/toonz/sources/toonzqt/functionsegmentviewer.cpp+++ b/toonz/sources/toonzqt/functionsegmentviewer.cpp@@ -116,9 +116,9 @@ SpeedInOutSegmentPage::SpeedInOutSegmentPage(FunctionSegmentViewer *parent)bool ret = connect(m_speed0xFld, SIGNAL(editingFinished()), this,SLOT(onFirstHandleXChanged()));- ret = ret && connect(m_speed0yFld, SIGNAL(editingFinished()), this,+ ret = ret && connect(m_speed0yFld, SIGNAL(editingFinished()), this,SLOT(onFirstHandleYChanged()));- ret = ret && connect(m_firstSpeedFld, SIGNAL(editingFinished()), this,+ ret = ret && connect(m_firstSpeedFld, SIGNAL(editingFinished()), this,SLOT(onFirstSpeedChanged()));ret = ret && connect(m_speed1xFld, SIGNAL(editingFinished()), this,@@ -556,11 +556,11 @@ void FunctionExpressionSegmentPage::init(int segmentLength) {/*--- すでにあるカーブをExpressionに切り替えた場合 ---*/if (kIndex >= 0) {- TDoubleKeyframe keyFrame = curve->getKeyframe(kIndex);- double value = curve->getValue(keyFrame.m_frame);- const TUnit *unit = 0;+ TDoubleKeyframe keyFrame = curve->getKeyframe(kIndex);+ double value = curve->getValue(keyFrame.m_frame);+ const TUnit *unit = 0;if (curve->getMeasure()) unit = curve->getMeasure()->getCurrentUnit();- if (unit) value = unit->convertTo(value);+ if (unit) value = unit->convertTo(value);m_expressionFld->setExpression(QString::number(value).toStdString());/*--- unitがある場合だけUnitを表示 ---*/if (unit)@@ -630,7 +630,7 @@ m_unitFld->setText("");//-----------------------------------------------------------------------------/*! return false if a circular reference is occured-*/+ */bool FunctionExpressionSegmentPage::getGuiValues(std::string &expressionText,std::string &unitName) {expressionText = m_expressionFld->getExpression();@@ -703,20 +703,20 @@ FileSegmentPage::FileSegmentPage(FunctionSegmentViewer *parent)void FileSegmentPage::refresh() {TDoubleKeyframe kf;TDoubleParam *curve = getCurve();- if (curve) kf = curve->getKeyframeAt(getR0());+ if (curve) kf = curve->getKeyframeAt(getR0());if (curve && kf.m_isKeyframe) {TFilePath path;int fieldIndex = 0;std::string unitName = "";if (kf.m_type == TDoubleKeyframe::File) {- path = kf.m_fileParams.m_path;- fieldIndex = kf.m_fileParams.m_fieldIndex;+ path = kf.m_fileParams.m_path;+ fieldIndex = kf.m_fileParams.m_fieldIndex;if (fieldIndex < 0) fieldIndex = 0;- unitName = kf.m_unitName;+ unitName = kf.m_unitName;if (unitName == "") {TMeasure *measure = curve->getMeasure();if (measure) {- const TUnit *unit = measure->getCurrentUnit();+ const TUnit *unit = measure->getCurrentUnit();if (unit) unitName = ::to_string(unit->getDefaultExtension());}}@@ -734,7 +734,7 @@ void FileSegmentPage::init(int segmentLength) {TMeasure *measure = curve->getMeasure();std::string unitName = "";if (measure) {- const TUnit *unit = measure->getCurrentUnit();+ const TUnit *unit = measure->getCurrentUnit();if (unit) unitName = ::to_string(unit->getDefaultExtension());}m_measureFld->setText(QString::fromStdString(unitName));@@ -929,8 +929,7 @@ FunctionSegmentViewer::FunctionSegmentViewer(QWidget *parent,m_parametersPanel = new QStackedWidget;m_parametersPanel->setObjectName("FunctionParametersPanel");- for (auto const & page : m_pages)- m_parametersPanel->addWidget(page);+ for (auto const &page : m_pages) m_parametersPanel->addWidget(page);m_parametersPanel->setCurrentIndex(0);// buttons@@ -1035,17 +1034,17 @@ FunctionSegmentViewer::FunctionSegmentViewer(QWidget *parent,bool ret = true;ret = ret && connect(m_typeCombo, SIGNAL(currentIndexChanged(int)),m_parametersPanel, SLOT(setCurrentIndex(int)));- ret = ret && connect(m_typeCombo, SIGNAL(activated(int)), this,+ ret = ret && connect(m_typeCombo, SIGNAL(activated(int)), this,SLOT(onSegmentTypeChanged(int)));- ret = ret && connect(applyButton, SIGNAL(clicked()), this,+ ret = ret && connect(applyButton, SIGNAL(clicked()), this,SLOT(onApplyButtonPressed()));- ret = ret && connect(m_prevCurveButton, SIGNAL(clicked()), this,+ ret = ret && connect(m_prevCurveButton, SIGNAL(clicked()), this,SLOT(onPrevCurveButtonPressed()));- ret = ret && connect(m_nextCurveButton, SIGNAL(clicked()), this,+ ret = ret && connect(m_nextCurveButton, SIGNAL(clicked()), this,SLOT(onNextCurveButtonPressed()));- ret = ret && connect(m_prevLinkButton, SIGNAL(clicked()), this,+ ret = ret && connect(m_prevLinkButton, SIGNAL(clicked()), this,SLOT(onPrevLinkButtonPressed()));- ret = ret && connect(m_nextLinkButton, SIGNAL(clicked()), this,+ ret = ret && connect(m_nextLinkButton, SIGNAL(clicked()), this,SLOT(onNextLinkButtonPressed()));assert(ret);@@ -1097,7 +1096,7 @@ void FunctionSegmentViewer::setSegmentByFrame(TDoubleParam *curve, int frame) {if (k1 >= 1)segmentIndex = k1 - 1;else {- int k0 = m_curve->getPrevKeyframe(frame);+ int k0 = m_curve->getPrevKeyframe(frame);if (k0 >= 0) segmentIndex = k0;}} else {@@ -1269,9 +1268,9 @@ void FunctionSegmentViewer::onCurveChanged() {void FunctionSegmentViewer::onStepFieldChanged(const QString &text) {if (!segmentIsValid()) return;- int step = 1;+ int step = 1;if (text != "") step = text.toInt();- if (step < 1) step = 1;+ if (step < 1) step = 1;KeyframeSetter setter(m_curve, m_segmentIndex);setter.setStep(step);}@@ -1376,8 +1375,8 @@ void FunctionSegmentViewer::onApplyButtonPressed() {/*--- from -* toに合わせてキーフレームを作成しようと試みる。すでに有る場合はスキップ* ---*/- if (fromFrame < 0) fromFrame = 0;- if (toFrame < 0) toFrame = 0;+ if (fromFrame < 0) fromFrame = 0;+ if (toFrame < 0) toFrame = 0;if (fromFrame >= toFrame) fromFrame = toFrame + 1;if (!m_curve->isKeyframe(fromFrame))@@ -1523,7 +1522,7 @@ bool FunctionSegmentViewer::anyWidgetHasFocus() {}/*! in order to avoid FunctionViewer to get focus while editing the expression-*/+ */bool FunctionSegmentViewer::isExpressionPageActive() {return (m_typeCombo->currentIndex() == 5);}