diff --git a/README.md b/README.md index d126157..3ea6787 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ [日本語](./doc/README_ja.md) +[![](https://ci.appveyor.com/api/projects/status/oa5l5pc964h8fv49/branch/master?svg=true)](https://ci.appveyor.com/project/opentoonz/opentoonz) +[![](https://travis-ci.org/opentoonz/opentoonz.svg?branch=master)](https://travis-ci.org/opentoonz/opentoonz) + ## What is OpenToonz? OpenToonz is a 2D animation software published by diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..e76b02a --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,42 @@ +version: 1.0.3.{build} +pull_requests: + do_not_increment_build_number: true +skip_tags: true +image: Visual Studio 2013 +configuration: +- Debug +- Release +platform: x64 +clone_depth: 1 +install: +- cmd: >- + cd thirdparty + + copy /Y LibJPEG\jpeg-9\jconfig.vc LibJPEG\jpeg-9\jconfig.h + + copy /Y tiff-4.0.3\libtiff\tif_config.vc.h tiff-4.0.3\libtiff\tif_config.h + + copy /Y tiff-4.0.3\libtiff\tiffconf.vc.h tiff-4.0.3\libtiff\tiffconf.h + + copy /Y libpng-1.6.21\scripts\pnglibconf.h.prebuilt libpng-1.6.21\pnglibconf.h + + + cd ../toonz + + mkdir %PLATFORM% && cd %PLATFORM% + + cmake ..\sources -G "Visual Studio 12 Win64" -DQT_PATH="C:\Qt\5.6\msvc2013_64" -DBOOST_ROOT="C:\Libraries\boost_1_60_0" +build: + project: $(APPVEYOR_BUILD_FOLDER)\toonz\$(PLATFORM)\ALL_BUILD.vcxproj + parallel: true + verbosity: minimal +after_build: +- cmd: >- + C:\Qt\5.6\msvc2013_64\bin\windeployqt.exe %CONFIGURATION%\OpenToonz_1.0.exe + + copy /Y ..\..\thirdparty\glut\3.7.6\lib\glut64.dll %CONFIGURATION% + + copy /Y ..\..\thirdparty\glew\glew-1.9.0\bin\64bit\glew32.dll %CONFIGURATION% +artifacts: +- path: toonz\$(PLATFORM)\$(CONFIGURATION) + name: OpenToonz_1.0 \ No newline at end of file diff --git a/doc/README_ja.md b/doc/README_ja.md index a7a9b79..8c6835d 100644 --- a/doc/README_ja.md +++ b/doc/README_ja.md @@ -1,4 +1,9 @@ -# OpenToonz ([English](../README.md)) +# OpenToonz + +[English](../README.md) + +[![](https://ci.appveyor.com/api/projects/status/oa5l5pc964h8fv49/branch/master?svg=true)](https://ci.appveyor.com/project/opentoonz/opentoonz) +[![](https://travis-ci.org/opentoonz/opentoonz.svg?branch=master)](https://travis-ci.org/opentoonz/opentoonz) ## これは何? diff --git a/plugins/blur/CMakeLists.txt b/plugins/blur/CMakeLists.txt index aa987e8..5d1bb20 100644 --- a/plugins/blur/CMakeLists.txt +++ b/plugins/blur/CMakeLists.txt @@ -4,10 +4,12 @@ set(PLUGINSDK_UTILS_PATH ../) set(HEADERS ${PLUGINSDK_ROOT}/toonz_plugin.h - ${PLUGINSDK_ROOT}/toonz_hostif.h) + ${PLUGINSDK_ROOT}/toonz_hostif.h +) set(SOURCES - blur.cpp) + blur.cpp +) if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") @@ -17,6 +19,7 @@ add_library(blur SHARED ${HEADERS} ${SOURCES}) set_target_properties(blur PROPERTIES PREFIX "" - SUFFIX ".plugin") + SUFFIX ".plugin" +) include_directories(${PLUGINSDK_ROOT} ${PLUGINSDK_UTILS_PATH}) diff --git a/plugins/geom/CMakeLists.txt b/plugins/geom/CMakeLists.txt index 0fc639e..43a2028 100644 --- a/plugins/geom/CMakeLists.txt +++ b/plugins/geom/CMakeLists.txt @@ -5,10 +5,12 @@ set(PLUGINSDK_UTILS_PATH ../) set(HEADERS ${PLUGINSDK_ROOT}/toonz_plugin.h - ${PLUGINSDK_ROOT}/toonz_hostif.h) + ${PLUGINSDK_ROOT}/toonz_hostif.h +) set(SOURCES - geom.cpp) + geom.cpp +) if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") @@ -18,6 +20,7 @@ add_library(geom SHARED ${HEADERS} ${SOURCES}) set_target_properties(geom PROPERTIES PREFIX "" - SUFFIX ".plugin") + SUFFIX ".plugin" +) include_directories(${PLUGINSDK_ROOT} ${PLUGINSDK_UTILS_PATH}) diff --git a/plugins/multiplugin/CMakeLists.txt b/plugins/multiplugin/CMakeLists.txt index 455985c..93e2640 100644 --- a/plugins/multiplugin/CMakeLists.txt +++ b/plugins/multiplugin/CMakeLists.txt @@ -4,10 +4,12 @@ set(PLUGINSDK_UTILS_PATH ../) set(HEADERS ${PLUGINSDK_ROOT}/toonz_plugin.h - ${PLUGINSDK_ROOT}/toonz_hostif.h) + ${PLUGINSDK_ROOT}/toonz_hostif.h +) set(SOURCES - multi.cpp) + multi.cpp +) if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") @@ -17,6 +19,7 @@ add_library(multi SHARED ${HEADERS} ${SOURCES}) set_target_properties(multi PROPERTIES PREFIX "" - SUFFIX ".plugin") + SUFFIX ".plugin" +) include_directories(${PLUGINSDK_ROOT} ${PLUGINSDK_UTILS_PATH}) diff --git a/toonz/sources/CMakeLists.txt b/toonz/sources/CMakeLists.txt index 3e2316b..af8ea55 100644 --- a/toonz/sources/CMakeLists.txt +++ b/toonz/sources/CMakeLists.txt @@ -145,7 +145,8 @@ find_package(Qt5 REQUIRED Widgets PrintSupport LinguistTools - Multimedia) + Multimedia +) if(WIN32) include_directories( @@ -200,15 +201,18 @@ if(WIN32) set(GL_LIB opengl32.lib) set(Z_LIB optimized ${SDKROOT}/zlib-1.2.8/lib/zlib-1.2.8_${MSVC_LIB_VERSION}${PLATFORM2}.lib - debug ${SDKROOT}/zlib-1.2.8/lib/zlib-1.2.8_${MSVC_LIB_VERSION}${PLATFORM2}d.lib) + debug ${SDKROOT}/zlib-1.2.8/lib/zlib-1.2.8_${MSVC_LIB_VERSION}${PLATFORM2}d.lib + ) set(JPEG_LIB ${SDKROOT}/LibJPEG/jpeg-9/lib/LibJPEG-9_${MSVC_LIB_VERSION}${PLATFORM2}.lib) set(TIFF_INCLUDE_DIR ${SDKROOT}/tiff-4.0.3/libtiff) set(TIFF_LIB optimized ${SDKROOT}/tiff-4.0.3/lib/LibTIFF-4.0.3_${MSVC_LIB_VERSION}${PLATFORM2}.lib - debug ${SDKROOT}/tiff-4.0.3/lib/LibTIFF-4.0.3_${MSVC_LIB_VERSION}${PLATFORM2}d.lib) + debug ${SDKROOT}/tiff-4.0.3/lib/LibTIFF-4.0.3_${MSVC_LIB_VERSION}${PLATFORM2}d.lib + ) set(PNG_LIB optimized ${SDKROOT}/libpng-1.6.21/lib/libpng16_${MSVC_LIB_VERSION}${PLATFORM2}.lib - debug ${SDKROOT}/libpng-1.6.21/lib/libpng16_${MSVC_LIB_VERSION}${PLATFORM2}d.lib) + debug ${SDKROOT}/libpng-1.6.21/lib/libpng16_${MSVC_LIB_VERSION}${PLATFORM2}d.lib + ) set(GLEW_LIB ${SDKROOT}/glew/glew-1.9.0/lib/glew${PLATFORM}.lib) set(LZ4_LIB ${SDKROOT}/Lz4/Lz4_131/lz4_${PLATFORM}.lib) set(SUPERLU_LIB ${SDKROOT}/superlu/SuperLU_${MSVC_LIB_VERSION}_${PLATFORM}.lib) @@ -336,9 +340,11 @@ set(CXX_WARNINGS) if(CMAKE_COMPILER_IS_GNUCC) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEF -Wundef) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_DECLARATIONS -Wmissing-declarations) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_WRITE_STRINGS -Wwrite-strings) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEF -Wundef) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_DECLARATIONS -Wmissing-declarations) endif() @@ -419,14 +425,16 @@ function(add_translation module) set(name "${CMAKE_SOURCE_DIR}/translations/${lang}/${module}.ts") list(APPEND translation ${name}) set_source_files_properties(${name} PROPERTIES - OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/loc/${lang}") + OUTPUT_LOCATION "${CMAKE_BINARY_DIR}/loc/${lang}" + ) endforeach() qt5_create_translation(message ${translation} ${ARGN}) add_custom_target("translation_${module}" DEPENDS ${message}) set_target_properties("translation_${module}" PROPERTIES - EXCLUDE_FROM_DEFAULT_BUILD TRUE) + EXCLUDE_FROM_DEFAULT_BUILD TRUE + ) endfunction() set(CMAKE_C_FLAGS "${C_WARNINGS} ${CMAKE_C_FLAGS}") @@ -464,5 +472,6 @@ if(APPLE) add_custom_command(TARGET executable POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH} - $) + $ + ) endif() diff --git a/toonz/sources/colorfx/CMakeLists.txt b/toonz/sources/colorfx/CMakeLists.txt index e73f0fb..1ce0525 100644 --- a/toonz/sources/colorfx/CMakeLists.txt +++ b/toonz/sources/colorfx/CMakeLists.txt @@ -4,7 +4,8 @@ set(HEADERS rasterstyles.h regionstyles.h strokestyles.h - zigzagstyles.h) + zigzagstyles.h +) set(SOURCES colorfx.cpp @@ -12,7 +13,8 @@ set(SOURCES rasterstyles.cpp regionstyles.cpp strokestyles.cpp - zigzagstyles.cpp) + zigzagstyles.cpp +) add_translation(colorfx ${HEADERS} ${SOURCES}) diff --git a/toonz/sources/colorfx/regionstyles.cpp b/toonz/sources/colorfx/regionstyles.cpp index e4b904c..9a9d472 100644 --- a/toonz/sources/colorfx/regionstyles.cpp +++ b/toonz/sources/colorfx/regionstyles.cpp @@ -661,7 +661,7 @@ double ShadowStyle2::getParamValue(TColorStyle::double_tag, int index) const { //----------------------------------------------------------------------------- -int nbDiffVerts(const std::vector &pv) { +static int nbDiffVerts(const std::vector &pv) { std::vector lpv; bool isMissing[4] = {true, true, true, true}; if (pv.size() == 0) return 0; diff --git a/toonz/sources/common/expressions/tgrammar.cpp b/toonz/sources/common/expressions/tgrammar.cpp index da99a20..9a21c8a 100644 --- a/toonz/sources/common/expressions/tgrammar.cpp +++ b/toonz/sources/common/expressions/tgrammar.cpp @@ -23,9 +23,9 @@ #include "tgrammar.h" -const double PI = 4 * atan(1.0); -const double toDeg(double rad) { return rad * 180.0 / PI; } -const double toRad(double deg) { return deg / 180.0 * PI; } +static const double PI = 4 * atan(1.0); +static const double toDeg(double rad) { return rad * 180.0 / PI; } +static const double toRad(double deg) { return deg / 180.0 * PI; } namespace TSyntax { @@ -125,7 +125,7 @@ public: template class Op1Node final : public CalculatorNode { protected: - std::auto_ptr m_a; + std::unique_ptr m_a; public: Op1Node(Calculator *calc, CalculatorNode *a) : CalculatorNode(calc), m_a(a) {} @@ -143,7 +143,7 @@ public: template class Op2Node final : public CalculatorNode { protected: - std::auto_ptr m_a, m_b; + std::unique_ptr m_a, m_b; public: Op2Node(Calculator *calc, CalculatorNode *a, CalculatorNode *b) @@ -164,7 +164,7 @@ public: template class Op3Node final : public CalculatorNode { protected: - std::auto_ptr m_a, m_b, m_c; + std::unique_ptr m_a, m_b, m_c; public: Op3Node(Calculator *calc, CalculatorNode *a, CalculatorNode *b, @@ -184,7 +184,7 @@ public: //------------------------------------------------------------------- class ChsNode final : public CalculatorNode { - std::auto_ptr m_a; + std::unique_ptr m_a; public: ChsNode(Calculator *calc, CalculatorNode *a) : CalculatorNode(calc), m_a(a) {} @@ -196,7 +196,7 @@ public: //------------------------------------------------------------------- class QuestionNode final : public CalculatorNode { - std::auto_ptr m_a, m_b, m_c; + std::unique_ptr m_a, m_b, m_c; public: QuestionNode(Calculator *calc, CalculatorNode *a, CalculatorNode *b, @@ -215,7 +215,7 @@ public: //------------------------------------------------------------------- class NotNode final : public CalculatorNode { - std::auto_ptr m_a; + std::unique_ptr m_a; public: NotNode(Calculator *calc, CalculatorNode *a) : CalculatorNode(calc), m_a(a) {} @@ -228,7 +228,7 @@ public: //------------------------------------------------------------------- class CycleNode final : public CalculatorNode { - std::auto_ptr m_a; + std::unique_ptr m_a; public: CycleNode(Calculator *calc, CalculatorNode *a) @@ -268,13 +268,15 @@ public: //------------------------------------------------------------------- class RandomNode final : public CalculatorNode { - std::auto_ptr m_seed, m_min, m_max, m_arg; + std::unique_ptr m_seed, m_min, m_max, m_arg; public: RandomNode(Calculator *calc) - : CalculatorNode(calc), m_seed(0), m_min(0), m_max(0) { - m_arg.reset(new VariableNode(calc, CalculatorNode::FRAME)); - } + : CalculatorNode(calc) + , m_seed() + , m_min() + , m_max() + , m_arg(new VariableNode(calc, CalculatorNode::FRAME)) {} void setSeed(CalculatorNode *arg) { assert(m_seed.get() == 0); diff --git a/toonz/sources/common/psdlib/psd.cpp b/toonz/sources/common/psdlib/psd.cpp index 9ec24de..aceb37b 100644 --- a/toonz/sources/common/psdlib/psd.cpp +++ b/toonz/sources/common/psdlib/psd.cpp @@ -41,7 +41,7 @@ void readKey(FILE *f, struct dictentry *parent, TPSDLayerInfo *li); void readLayer16(FILE *f, struct dictentry *parent, TPSDLayerInfo *li); //----end forward declarations -char swapByte(unsigned char src) { +static char swapByte(unsigned char src) { unsigned char out = 0; for (int i = 0; i < 8; ++i) { out = out << 1; diff --git a/toonz/sources/common/tapptools/tcli.cpp b/toonz/sources/common/tapptools/tcli.cpp index 22dab09..652a9f8 100644 --- a/toonz/sources/common/tapptools/tcli.cpp +++ b/toonz/sources/common/tapptools/tcli.cpp @@ -744,7 +744,7 @@ void RangeQualifier::fetch(int index, int &argc, char *argv[]) { } } -std::ostream &operator<<(std::ostream &out, const RangeQualifier &range) { +static std::ostream &operator<<(std::ostream &out, const RangeQualifier &range) { return out << "[" << range.getFrom() << ", " << range.getTo() << "]"; } diff --git a/toonz/sources/common/tapptools/tcolorutils.cpp b/toonz/sources/common/tapptools/tcolorutils.cpp index 6b3e0e7..71ed04c 100644 --- a/toonz/sources/common/tapptools/tcolorutils.cpp +++ b/toonz/sources/common/tapptools/tcolorutils.cpp @@ -456,7 +456,7 @@ assert(areAlmostEqual(a*v*v*v+b*v*v+c*v+d, 0.0)); //------------------------------------------------------------------------------ -void clusterize(ClusterContainer &clusters, int clustersCount) { +static void clusterize(ClusterContainer &clusters, int clustersCount) { unsigned int clustersSize = clusters.size(); assert(clustersSize >= 1); @@ -737,8 +737,8 @@ void Cluster::getMeanAxis(KEYER_FLOAT axis[3]) { //#define METODO_USATO_SU_TOONZ46 -void buildPaletteForBlendedImages(std::set &palette, - const TRaster32P &raster, int maxColorCount) { +static void buildPaletteForBlendedImages(std::set &palette, + const TRaster32P &raster, int maxColorCount) { int lx = raster->getLx(); int ly = raster->getLy(); diff --git a/toonz/sources/common/tcolor/tpixel.cpp b/toonz/sources/common/tcolor/tpixel.cpp index 30a97de..00a64fc 100644 --- a/toonz/sources/common/tcolor/tpixel.cpp +++ b/toonz/sources/common/tcolor/tpixel.cpp @@ -47,17 +47,17 @@ const TPixelGR8 TPixelGR8::Black(0); const TPixelGR16 TPixelGR16::White(maxChannelValue); const TPixelGR16 TPixelGR16::Black(0); -std::ostream &operator<<(std::ostream &out, const TPixel32 &pixel) { +static std::ostream &operator<<(std::ostream &out, const TPixel32 &pixel) { return out << "PixRGBM32(" << (int)pixel.r << ", " << (int)pixel.g << ", " << (int)pixel.b << ", " << (int)pixel.m << ")"; } -std::ostream &operator<<(std::ostream &out, const TPixel64 &pixel) { +static std::ostream &operator<<(std::ostream &out, const TPixel64 &pixel) { return out << "PixRGBM64(" << pixel.r << ", " << pixel.g << ", " << pixel.b << ", " << pixel.m << ")"; } -std::ostream &operator<<(std::ostream &out, const TPixelD &pixel) { +static std::ostream &operator<<(std::ostream &out, const TPixelD &pixel) { return out << "PixD(" << pixel.r << ", " << pixel.g << ", " << pixel.b << ", " << pixel.m << ")"; } diff --git a/toonz/sources/common/tcontenthistory.cpp b/toonz/sources/common/tcontenthistory.cpp index 6eada27..8f157fb 100644 --- a/toonz/sources/common/tcontenthistory.cpp +++ b/toonz/sources/common/tcontenthistory.cpp @@ -83,7 +83,7 @@ inline QString getStr(const TFrameId &id) { const QString Fmt = "dd MMM yy hh:mm"; -QString getLine(int counter, const QDateTime &date, +static QString getLine(int counter, const QDateTime &date, const set &frames) { static QString user; static QString machine; @@ -127,7 +127,7 @@ QString getLine(int counter, const QDateTime &date, //-------------------------------------------------------------------- -int getCurrentCount(const QString &str) { +static int getCurrentCount(const QString &str) { if (str == "") return 0; int from = str.lastIndexOf('#') + 1; diff --git a/toonz/sources/common/tiio/bmp/filebmp.c b/toonz/sources/common/tiio/bmp/filebmp.c index dcffcb8..e9ea2ab 100644 --- a/toonz/sources/common/tiio/bmp/filebmp.c +++ b/toonz/sources/common/tiio/bmp/filebmp.c @@ -93,25 +93,7 @@ /*---------------------------------------------------------------------------*/ /*-- Prototypes -------------------------------------------------------------*/ -int load_bmp_header(FILE *fp, BMP_HEADER **pHd); -int write_bmp_header(FILE *fp, BMP_HEADER *hd); -void release_bmp_header(BMP_HEADER *hd); - -int write_bmp_palette(FILE *fp, int nc, UCHAR *b, UCHAR *g, UCHAR *r); - -int make_bmp_palette(int colors, int grey, UCHAR *r, UCHAR *g, UCHAR *b); - -BMP_SUBTYPE bmp_get_colorstyle(IMAGE *img); - -int error_checking_bmp(BMP_HEADER *hd); - -int read_bmp_line(FILE *fp, void *line, UINT w, UINT h, UCHAR **map, - BMP_SUBTYPE type); - -int write_bmp_line(FILE *fp, void *line_buffer, UINT w, UINT row, UCHAR *map, - BMP_SUBTYPE type); - -int skip_bmp_lines(FILE *fp, UINT w, UINT rows, int whence, BMP_SUBTYPE type); +static BMP_SUBTYPE bmp_get_colorstyle(IMAGE *img); /*---------------------------------------------------------------------------*/ /*-- Local Prototypes -------------------------------------------------------*/ @@ -1633,7 +1615,7 @@ int write_bmp_palette(FILE *fp, int nc, UCHAR *b, UCHAR *g, UCHAR *r) #ifndef __LIBSIMAGE__ /*---------------------------------------------------------------------------*/ -int img_write_bmp(const MYSTRING fname, IMAGE *img) +static int img_write_bmp(const MYSTRING fname, IMAGE *img) /*---------------------------------------------------------------------------*/ { int (*write_function)(FILE * fp, UCHAR * pic, UINT w, UINT h, UCHAR * map); diff --git a/toonz/sources/common/tiio/tiio_jpg.cpp b/toonz/sources/common/tiio/tiio_jpg.cpp index 991d5ff..c4991bf 100644 --- a/toonz/sources/common/tiio/tiio_jpg.cpp +++ b/toonz/sources/common/tiio/tiio_jpg.cpp @@ -29,9 +29,11 @@ const std::string Tiio::JpgWriterProperties::QUALITY("Quality"); //========================================================= -extern "C" void tnz_error_exit(j_common_ptr cinfo) { +extern "C" { +static void tnz_error_exit(j_common_ptr cinfo) { // throw "merda"; } +} #ifdef CICCIO JMETHOD(void, error_exit, (j_common_ptr cinfo)); diff --git a/toonz/sources/common/timage_io/timage_io.cpp b/toonz/sources/common/timage_io/timage_io.cpp index 4d8c849..6134817 100644 --- a/toonz/sources/common/timage_io/timage_io.cpp +++ b/toonz/sources/common/timage_io/timage_io.cpp @@ -527,7 +527,7 @@ void TImageWriter::setProperties(const TPropertyGroup *g) { //----------------------------------------------------------- -void convertForWriting(TRasterP &ras, const TRasterP &rin, int bpp) { +static void convertForWriting(TRasterP &ras, const TRasterP &rin, int bpp) { switch (bpp) { case 1: case 8: diff --git a/toonz/sources/common/tmeshimage/tmeshimage.cpp b/toonz/sources/common/tmeshimage/tmeshimage.cpp index 2efc173..a5cd662 100644 --- a/toonz/sources/common/tmeshimage/tmeshimage.cpp +++ b/toonz/sources/common/tmeshimage/tmeshimage.cpp @@ -34,7 +34,7 @@ static TTextureMeshP cloneMesh_(const TTextureMeshP &other) { return TTextureMeshP(new TTextureMesh(*other)); } -void static_check() { +static void static_check() { /* input iterator */ static_assert( std::is_same 0) bSpeedTrunc.x = 0; diff --git a/toonz/sources/common/tparam/ttonecurveparam.cpp b/toonz/sources/common/tparam/ttonecurveparam.cpp index 24d95d3..b2a91c2 100644 --- a/toonz/sources/common/tparam/ttonecurveparam.cpp +++ b/toonz/sources/common/tparam/ttonecurveparam.cpp @@ -50,7 +50,7 @@ TToneCurveParam::TToneCurveParam() : TParam() { //--------------------------------------------------------- -TParamSetP getClonedParamSet(TParamSetP srcParamSet) { +static TParamSetP getClonedParamSet(TParamSetP srcParamSet) { TParamSetP dstParamSet = new TParamSet(srcParamSet->getName()); int i; for (i = 0; i < srcParamSet->getParamCount(); i++) { diff --git a/toonz/sources/common/trop/quickput.cpp b/toonz/sources/common/trop/quickput.cpp index e90c306..92b3db6 100644 --- a/toonz/sources/common/trop/quickput.cpp +++ b/toonz/sources/common/trop/quickput.cpp @@ -3,6 +3,7 @@ #include "trop.h" #include "loop_macros.h" #include "tpixelutils.h" +#include "quickputP.h" #ifndef TNZCORE_LIGHT #include "tpalette.h" diff --git a/toonz/sources/common/trop/quickputP.h b/toonz/sources/common/trop/quickputP.h index a0ce3e0..54d4414 100644 --- a/toonz/sources/common/trop/quickputP.h +++ b/toonz/sources/common/trop/quickputP.h @@ -11,6 +11,11 @@ void quickPut(const TRasterP &dn, const TRasterP &up, const TAffine &aff, bool doPremultiply = false, bool whiteTransp = false, bool firstColumn = false, bool doRasterDarkenBlendedView = false); +void quickPut(const TRasterP &dn, const TRasterP &up, const TAffine &aff, + TRop::ResampleFilterType filterType, const TPixel32 &colorScale, + bool doPremultiply, bool whiteTransp, bool firstColumn, + bool doRasterDarkenBlendedView); + void quickResample(const TRasterP &dn, const TRasterP &up, const TAffine &aff, TRop::ResampleFilterType filterType); diff --git a/toonz/sources/common/trop/tconvert.cpp b/toonz/sources/common/trop/tconvert.cpp index 83fe96e..413ae34 100644 --- a/toonz/sources/common/trop/tconvert.cpp +++ b/toonz/sources/common/trop/tconvert.cpp @@ -11,7 +11,7 @@ // Conversion functions //****************************************************************** -void do_convert(const TRaster64P &dst, const TRaster32P &src) { +static void do_convert(const TRaster64P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); for (int y = 0; y < src->getLy(); y++) { @@ -29,7 +29,7 @@ void do_convert(const TRaster64P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterGR8P &dst, const TRaster32P &src) { +static void do_convert(const TRasterGR8P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); @@ -45,7 +45,7 @@ void do_convert(const TRasterGR8P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterGR16P &dst, const TRaster32P &src) { +static void do_convert(const TRasterGR16P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); @@ -62,7 +62,7 @@ void do_convert(const TRasterGR16P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterGR16P &dst, const TRaster64P &src) { +static void do_convert(const TRasterGR16P &dst, const TRaster64P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); for (int y = 0; y < src->getLy(); y++) { @@ -79,7 +79,7 @@ void do_convert(const TRasterGR16P &dst, const TRaster64P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRaster32P &dst, const TRasterGR8P &src) { +static void do_convert(const TRaster32P &dst, const TRasterGR8P &src) { assert(dst->getSize() == src->getSize()); int lx = src->getLx(); for (int y = 0; y < src->getLy(); y++) { @@ -150,7 +150,7 @@ inline void ditherConvert(TRaster64P inRas, TRaster32P outRas) { // Obsolete conversion functions //****************************************************************** -void do_convert(const TRasterCM32P &dst, const TRasterGR8P &src) { +static void do_convert(const TRasterCM32P &dst, const TRasterGR8P &src) { assert(dst->getSize() == src->getSize()); TPixelCM32 bg = TPixelCM32(0, 0, TPixelCM32::getMaxTone()); @@ -169,7 +169,7 @@ void do_convert(const TRasterCM32P &dst, const TRasterGR8P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterCM32P &dst, const TRaster32P &src) { +static void do_convert(const TRasterCM32P &dst, const TRaster32P &src) { assert(dst->getSize() == src->getSize()); TPixelCM32 bg = TPixelCM32(0, 0, TPixelCM32::getMaxTone()); @@ -220,7 +220,7 @@ void do_convert(const TRasterCM32P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRasterYUV422P &dst, const TRaster32P &src) { +static void do_convert(const TRasterYUV422P &dst, const TRaster32P &src) { assert(src->getLx() & 0); long y1, y2, u, v, u1, u2, v1, v2; TPixel32 *pix = (TPixel32 *)src->pixels(); @@ -271,7 +271,7 @@ void do_convert(const TRasterYUV422P &dst, const TRaster32P &src) { //----------------------------------------------------------------------------- -void do_convert(const TRaster32P &dst, const TRasterYUV422P &src) { +static void do_convert(const TRaster32P &dst, const TRasterYUV422P &src) { int long r, g, b, y1, y2, u, v; TPixel32 *buf = dst->pixels(); const UCHAR *in = src->getRawData(); diff --git a/toonz/sources/common/trop/tdespeckle.cpp b/toonz/sources/common/trop/tdespeckle.cpp index d7d41ba..26c3704 100644 --- a/toonz/sources/common/trop/tdespeckle.cpp +++ b/toonz/sources/common/trop/tdespeckle.cpp @@ -444,8 +444,8 @@ void doDespeckleGR(const TRasterPT &ras, int sizeThreshold) { //---------------------------------------------------- -void doDespeckleCM32(const TRasterPT &ras, int sizeThreshold, - bool check) { +static void doDespeckleCM32(const TRasterPT &ras, int sizeThreshold, + bool check) { TRasterCM32P rasCM(ras); rasCM->lock(); diff --git a/toonz/sources/common/trop/tover.cpp b/toonz/sources/common/trop/tover.cpp index d03825b..aa67fe1 100644 --- a/toonz/sources/common/trop/tover.cpp +++ b/toonz/sources/common/trop/tover.cpp @@ -250,7 +250,7 @@ void do_over(TRasterGR8P rout, const TRaster32P &rup) { //----------------------------------------------------------------------------- -void do_over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color) { +static void do_over(TRaster32P rout, const TRasterGR8P &rup, const TPixel32 &color) { assert(rout->getSize() == rup->getSize()); for (int y = rout->getLy(); --y >= 0;) { TPixel32 *out_pix = rout->pixels(y); diff --git a/toonz/sources/common/trop/tropcm.cpp b/toonz/sources/common/trop/tropcm.cpp index 1e1a803..fc7ac2d 100644 --- a/toonz/sources/common/trop/tropcm.cpp +++ b/toonz/sources/common/trop/tropcm.cpp @@ -212,8 +212,8 @@ paints[i] = TPixelFloat(paints2[i]); //----------------------------------------------------------------------------------------------- -void do_convert(const TTile &dst, const TTile &src, const TPaletteP palette, - bool transparencyCheck, bool applyFx) { +static void do_convert(const TTile &dst, const TTile &src, const TPaletteP palette, + bool transparencyCheck, bool applyFx) { // assert(palette); // assert(_rasOut && _rasIn); // assert(rasOut->getSize() == rasIn->getSize()); diff --git a/toonz/sources/common/tsound/tsound_sdl.cpp b/toonz/sources/common/tsound/tsound_sdl.cpp index 898c218..9756b3f 100644 --- a/toonz/sources/common/tsound/tsound_sdl.cpp +++ b/toonz/sources/common/tsound/tsound_sdl.cpp @@ -107,7 +107,7 @@ public: extern "C" { -void sdl_fill_audio(void *udata, Uint8 *stream, int len) { +static void sdl_fill_audio(void *udata, Uint8 *stream, int len) { TSoundOutputDeviceImp *_this = (TSoundOutputDeviceImp *)udata; MyData *myData = _this->m_data; diff --git a/toonz/sources/common/tstream/tpersistset.cpp b/toonz/sources/common/tstream/tpersistset.cpp index 9dd97db..dde3aea 100644 --- a/toonz/sources/common/tstream/tpersistset.cpp +++ b/toonz/sources/common/tstream/tpersistset.cpp @@ -26,7 +26,7 @@ TPersistSet::~TPersistSet() { //------------------------------------------------------------------ -void TPersistSet::insert(std::auto_ptr object) { +void TPersistSet::insert(std::unique_ptr object) { struct locals { inline static bool sameType(TPersist *a, TPersist *b) { return (typeid(*a) == typeid(*b)); diff --git a/toonz/sources/common/tstream/tstream.cpp b/toonz/sources/common/tstream/tstream.cpp index 7b4ab80..7540dad 100644 --- a/toonz/sources/common/tstream/tstream.cpp +++ b/toonz/sources/common/tstream/tstream.cpp @@ -225,7 +225,7 @@ TOStream::TOStream(const TFilePath &fp, bool compressed) : m_imp(new Imp) { m_imp->m_compressed = true; m_imp->m_chanOwner = false; } else { - std::auto_ptr os(new Tofstream(fp)); + std::unique_ptr os(new Tofstream(fp)); m_imp->m_os = os->isOpen() ? os.release() : 0; m_imp->m_chanOwner = true; } @@ -818,7 +818,7 @@ TIStream::TIStream(const TFilePath &fp) : m_imp(new Imp) { { bool swapForEndianess = false; - auto_ptr is(m_imp->m_is); + unique_ptr is(m_imp->m_is); m_imp->m_is = 0; char magicBuffer[4]; diff --git a/toonz/sources/common/tunit/tunit.cpp b/toonz/sources/common/tunit/tunit.cpp index 22d8b99..2d38202 100644 --- a/toonz/sources/common/tunit/tunit.cpp +++ b/toonz/sources/common/tunit/tunit.cpp @@ -24,7 +24,7 @@ double VerticalCameraFldUnitConverter::m_factor = 1; namespace UnitParameters { -std::pair dummyCurrentDpiGetter() { +static std::pair dummyCurrentDpiGetter() { return std::make_pair(72, 72); } diff --git a/toonz/sources/common/tvectorimage/cornerdetector.cpp b/toonz/sources/common/tvectorimage/cornerdetector.cpp index a735bd8..6552369 100644 --- a/toonz/sources/common/tvectorimage/cornerdetector.cpp +++ b/toonz/sources/common/tvectorimage/cornerdetector.cpp @@ -1,6 +1,7 @@ #include "tgeometry.h" +#include "cornerdetector.h" //====================================================================== @@ -39,8 +40,8 @@ public: }; //! Definisce l'operatore meno tra due AlgorithmPointI -AlgorithmPointI operator-(const AlgorithmPointI &op1, - const AlgorithmPointI &op2) { +static AlgorithmPointI operator-(const AlgorithmPointI &op1, + const AlgorithmPointI &op2) { return AlgorithmPointI(op1.operator-(op2), 0); } @@ -75,7 +76,7 @@ point_container gPoints; \param points Vettore di T3DPoints */ -bool interpolate(const std::vector &points) { +static bool interpolate(const std::vector &points) { unsigned int curr, next; TPointI currStep, xStep, yStep, guideLine; @@ -193,7 +194,7 @@ inline bool isAdmissibleCorner(int currIndex, int precIndex, int nextIndex) { //---------------------------------------------------------------------- //! Trova i possibili angoli tra i punti di gPoints -void findCornerCandidates() { +static void findCornerCandidates() { unsigned int curr, prec, next; curr = gMaxDist; @@ -229,7 +230,7 @@ void findCornerCandidates() { //---------------------------------------------------------------------- //! Trova gli angoli tra i punti di gPoints -void findCorners(int neighborLimit, std::vector &cornerIndexes) { +static void findCorners(int neighborLimit, std::vector &cornerIndexes) { unsigned int curr, prec, next; curr = gMaxDist; diff --git a/toonz/sources/common/tvectorimage/cornerdetector.h b/toonz/sources/common/tvectorimage/cornerdetector.h new file mode 100644 index 0000000..6b23879 --- /dev/null +++ b/toonz/sources/common/tvectorimage/cornerdetector.h @@ -0,0 +1,10 @@ +#pragma once + +#ifndef CORNERDETECTOR_H +#define CORNERDETECTOR_H + +void detectCorners(const std::vector &inputPoints, int minSampleNum, + int minDist, int maxDist, double maxAngle, + std::vector &cornerIndexes); + +#endif // CORNERDETECTOR_H diff --git a/toonz/sources/common/tvectorimage/outlineApproximation.cpp b/toonz/sources/common/tvectorimage/outlineApproximation.cpp index ee85208..2915c41 100644 --- a/toonz/sources/common/tvectorimage/outlineApproximation.cpp +++ b/toonz/sources/common/tvectorimage/outlineApproximation.cpp @@ -537,8 +537,8 @@ void drawQuadratic(const TQuadratic &quad, double pixelSize) { //----------------------------------------------------------------------------- -void makeOutline(const TStroke *stroke, int startQuad, int endQuad, - outlineBoundary &ob, double error2) { +static void makeOutline(const TStroke *stroke, int startQuad, int endQuad, + outlineBoundary &ob, double error2) { // std::ofstream cout("c:\\temp\\outline.txt"); assert(stroke); @@ -628,7 +628,7 @@ void makeOutline(const TStroke *stroke, int startQuad, int endQuad, //----------------------------------------------------------------------------- -void drawOutline(const outlineBoundary &ob, double pixelSize) { +static void drawOutline(const outlineBoundary &ob, double pixelSize) { for (UINT i = 0; i < ob.size(); ++i) { drawQuadratic(*ob[i].first, pixelSize); drawQuadratic(*ob[i].second, pixelSize); diff --git a/toonz/sources/common/tvectorimage/tcomputeregions.cpp b/toonz/sources/common/tvectorimage/tcomputeregions.cpp index 39679d9..ceced07 100644 --- a/toonz/sources/common/tvectorimage/tcomputeregions.cpp +++ b/toonz/sources/common/tvectorimage/tcomputeregions.cpp @@ -14,6 +14,7 @@ #include "tdebugmessage.h" #include "tthreadmessage.h" #include "tl2lautocloser.h" +#include "tcomputeregions.h" #include #include "tcurveutil.h" @@ -46,7 +47,7 @@ inline TThickPoint myRound(const TThickPoint &p) { return TThickPoint(myRound(p.x), myRound(p.y), p.thick); } -void roundStroke(TStroke *s) { +static void roundStroke(TStroke *s) { int size = s->getControlPointCount(); for (int j = 0; j < (int)s->getControlPointCount(); j++) { @@ -411,13 +412,13 @@ void addIntersection(IntersectionData &intData, const vector &s, //----------------------------------------------------------------------------- -bool sortBBox(const TStroke *s1, const TStroke *s2) { +static bool sortBBox(const TStroke *s1, const TStroke *s2) { return s1->getBBox().x0 < s2->getBBox().x0; } //----------------------------------------------------------------------------- -void cleanIntersectionMarks(const VIList &interList) { +static void cleanIntersectionMarks(const VIList &interList) { Intersection *p; IntersectedStroke *q; for (p = interList.first(); p; p = p->next()) @@ -435,7 +436,7 @@ void cleanIntersectionMarks(const VIList &interList) { //----------------------------------------------------------------------------- -void cleanNextIntersection(const VIList &interList, TStroke *s) { +static void cleanNextIntersection(const VIList &interList, TStroke *s) { Intersection *p; IntersectedStroke *q; @@ -903,7 +904,7 @@ void TVectorImage::Imp::eraseIntersection(int index) { } //----------------------------------------------------------------------------- -void findNearestIntersection(VIList &interList) { +static void findNearestIntersection(VIList &interList) { Intersection *p1; IntersectedStroke *p2; @@ -1026,7 +1027,7 @@ void markDeadIntersections(VIList &intList, Intersection *p) { // se cross val era 0, cerco di spostarmi un po' su w per vedere come sono // orientate le tangenti agli stroke... -double nearCrossVal(TStroke *s0, double w0, TStroke *s1, double w1) { +static double nearCrossVal(TStroke *s0, double w0, TStroke *s1, double w1) { double ltot0 = s0->getLength(); double ltot1 = s1->getLength(); double dl = std::min(ltot1, ltot0) / 1000; @@ -1066,7 +1067,7 @@ inline void insertBranch(Intersection &in, IntersectedStroke &item, //----------------------------------------------------------------------------- -double getAngle(const TPointD &p0, const TPointD &p1) { +static double getAngle(const TPointD &p0, const TPointD &p1) { double angle1 = atan2(p0.x, p0.y) * M_180_PI; double angle2 = atan2(p1.x, p1.y) * M_180_PI; @@ -1079,8 +1080,8 @@ double getAngle(const TPointD &p0, const TPointD &p1) { //----------------------------------------------------------------------------- // nel caso l'angolo tra due stroke in un certo w sia nullo, // si va un po' avanti per vedere come sono orientate.... -double getNearAngle(const TStroke *s1, double w1, bool out1, const TStroke *s2, - double w2, bool out2) { +static double getNearAngle(const TStroke *s1, double w1, bool out1, const TStroke *s2, + double w2, bool out2) { bool verse1 = (out1 && w1 < 1) || (!out1 && w1 == 0); bool verse2 = (out2 && w2 < 1) || (!out2 && w2 == 0); double ltot1 = s1->getLength(); @@ -1105,10 +1106,10 @@ double getNearAngle(const TStroke *s1, double w1, bool out1, const TStroke *s2, //----------------------------------------------------------------------------- -bool makeEdgeIntersection(Intersection &interList, IntersectedStroke &item1, - IntersectedStroke &item2, const TPointD &p1a, - const TPointD &p1b, const TPointD &p2a, - const TPointD &p2b) { +static bool makeEdgeIntersection(Intersection &interList, IntersectedStroke &item1, + IntersectedStroke &item2, const TPointD &p1a, + const TPointD &p1b, const TPointD &p2a, + const TPointD &p2b) { double angle1 = getAngle(p1a, p1b); double angle2 = getAngle(p1a, p2a); double angle3 = getAngle(p1a, p2b); @@ -1215,9 +1216,9 @@ bool makeEdgeIntersection(Intersection &interList, IntersectedStroke &item1, //----------------------------------------------------------------------------- -bool makeIntersection(IntersectionData &intData, const vector &s, - int ii, int jj, DoublePair inter, int strokeSize, - Intersection &interList) { +static bool makeIntersection(IntersectionData &intData, const vector &s, + int ii, int jj, DoublePair inter, int strokeSize, + Intersection &interList) { IntersectedStroke item1, item2; interList.m_intersection = s[ii]->m_s->getPoint(inter.first); @@ -1336,9 +1337,9 @@ areAlmostEqual(q->getP2(), p->getP0(), 1e-2)) */ //----------------------------------------------------------------------------- -bool addAutocloseIntersection(IntersectionData &intData, vector &s, - int ii, int jj, double w0, double w1, - int strokeSize, bool isVectorized) { +static bool addAutocloseIntersection(IntersectionData &intData, vector &s, + int ii, int jj, double w0, double w1, + int strokeSize, bool isVectorized) { assert(s[ii]->m_groupId == s[jj]->m_groupId); Intersection *rp = intData.m_intList.last(); @@ -1418,8 +1419,8 @@ bool addAutocloseIntersection(IntersectionData &intData, vector &s, // double g_autocloseTolerance = c_newAutocloseTolerance; -bool isCloseEnoughP2P(double facMin, double facMax, TStroke *s1, double w0, - TStroke *s2, double w1) { +static bool isCloseEnoughP2P(double facMin, double facMax, TStroke *s1, double w0, + TStroke *s2, double w1) { double autoDistMin, autoDistMax; TThickPoint p0 = s1->getThickPoint(w0); @@ -1495,9 +1496,9 @@ return false; */ //----------------------------------------------------------------------------- -double getCurlW(TStroke *s, bool isBegin) // trova il punto di split su una - // stroke, in prossimita di un - // ricciolo; +static double getCurlW(TStroke *s, bool isBegin) // trova il punto di split su una + // stroke, in prossimita di un + // ricciolo; // un ricciolo c'e' se la curva ha un min o max relativo su x seguito da uno su // y, o viceversa. { @@ -1570,8 +1571,8 @@ return -1; #endif //----------------------------------------------------------------------------- -bool isCloseEnoughP2L(double facMin, double facMax, TStroke *s1, double w1, - TStroke *s2, double &w) { +static bool isCloseEnoughP2L(double facMin, double facMax, TStroke *s1, double w1, + TStroke *s2, double &w) { if (s1->isSelfLoop()) return false; TThickPoint p0 = s1->getThickPoint(w1); @@ -1880,10 +1881,10 @@ void getClosingPoints(const TRectD &rect, double fac, const TVectorImageP &vi, //------------------------------------------------------------------------------------------------------- -void autoclose(double factor, vector &s, int ii, int jj, - IntersectionData &IntData, int strokeSize, - TL2LAutocloser &l2lautocloser, vector *intersections, - bool isVectorized) { +static void autoclose(double factor, vector &s, int ii, int jj, + IntersectionData &IntData, int strokeSize, + TL2LAutocloser &l2lautocloser, vector *intersections, + bool isVectorized) { vector> segments; getClosingSegments(l2lautocloser, 0, factor, s[ii]->m_s, s[jj]->m_s, intersections, segments); @@ -1938,9 +1939,9 @@ TPointD inline getTangent(const IntersectedStroke &item) { //----------------------------------------------------------------------------- -void addBranch(IntersectionData &intData, VIList &strokeList, - const vector &s, int ii, double w, int strokeSize, - bool gettingOut) { +static void addBranch(IntersectionData &intData, VIList &strokeList, + const vector &s, int ii, double w, int strokeSize, + bool gettingOut) { IntersectedStroke *p1, *p2; TPointD tanRef, lastTan; @@ -2055,9 +2056,9 @@ return; //----------------------------------------------------------------------------- -void addBranches(IntersectionData &intData, Intersection &intersection, - const vector &s, int ii, int jj, - DoublePair intersectionPair, int strokeSize) { +static void addBranches(IntersectionData &intData, Intersection &intersection, + const vector &s, int ii, int jj, + DoublePair intersectionPair, int strokeSize) { bool foundS1 = false, foundS2 = false; IntersectedStroke *p; @@ -2127,9 +2128,9 @@ IntersectedStroke app; //----------------------------------------------------------------------------- -void addIntersections(IntersectionData &intData, const vector &s, - int ii, int jj, vector &intersections, - int strokeSize, bool isVectorized) { +static void addIntersections(IntersectionData &intData, const vector &s, + int ii, int jj, vector &intersections, + int strokeSize, bool isVectorized) { for (int k = 0; k < (int)intersections.size(); k++) { if (ii >= strokeSize && (areAlmostEqual(intersections[k].first, 0.0) || areAlmostEqual(intersections[k].first, 1.0))) @@ -2446,8 +2447,8 @@ if (tdistance2(p01, p11)< 2*0.06*0.06) //----------------------------------------------------------------------------- // Trova una possibile regione data una lista di punti di intersezione -TRegion *findRegion(VIList &intList, Intersection *p1, - IntersectedStroke *p2, bool minimizeEdges) { +static TRegion *findRegion(VIList &intList, Intersection *p1, + IntersectedStroke *p2, bool minimizeEdges) { TRegion *r = new TRegion(); int currStyle = 0; @@ -2662,7 +2663,7 @@ void computeRegionFeature(const TRegion &r, TRegionFeatureFormula &formula) { //---------------------------------------------------------------------------------- -bool isValidArea(const TRegion &r) { +static bool isValidArea(const TRegion &r) { TRegionClockWiseFormula formula; computeRegionFeature(r, formula); return formula.isClockwise(); @@ -2759,7 +2760,7 @@ void transferColors(const list &oldList, const list &newList, bool isStrokeChanged, bool isFlipped, bool overwriteColor); //----------------------------------------------------------------------------- -void printStrokes1(vector &v, int size) { +static void printStrokes1(vector &v, int size) { UINT i = 0; ofstream of("C:\\temp\\strokes.txt"); diff --git a/toonz/sources/common/tvectorimage/tcomputeregions.h b/toonz/sources/common/tvectorimage/tcomputeregions.h new file mode 100644 index 0000000..17100df --- /dev/null +++ b/toonz/sources/common/tvectorimage/tcomputeregions.h @@ -0,0 +1,9 @@ + +#pragma once + +#ifndef T_COMPUTEREGIONS_H +#define T_COMPUTEREGIONS_H + +void invalidateRegionPropAndBBox(TRegion *reg); + +#endif // T_COMPUTEREGIONS_H diff --git a/toonz/sources/common/tvectorimage/tregion.cpp b/toonz/sources/common/tvectorimage/tregion.cpp index 3adcf98..42592e5 100644 --- a/toonz/sources/common/tvectorimage/tregion.cpp +++ b/toonz/sources/common/tvectorimage/tregion.cpp @@ -34,7 +34,7 @@ void foo() //============================================================================= -bool compareEdge(const TEdge &a, const TEdge &b) { return a.m_s == b.m_s; } +static bool compareEdge(const TEdge &a, const TEdge &b) { return a.m_s == b.m_s; } //----------------------------------------------------------------------------- @@ -527,7 +527,7 @@ void TRegion::draw(const TVectorRenderData &rd) //----------------------------------------------------------------------------- -void checkPolyline(const std::vector &p) { +static void checkPolyline(const std::vector &p) { int ret; if (p.size() < 3) return; diff --git a/toonz/sources/common/tvectorimage/tstroke.cpp b/toonz/sources/common/tvectorimage/tstroke.cpp index 8f149d5..fb03365 100644 --- a/toonz/sources/common/tvectorimage/tstroke.cpp +++ b/toonz/sources/common/tvectorimage/tstroke.cpp @@ -8,6 +8,7 @@ #include "tbezier.h" #include "tzerofinder.h" #include "tcurveutil.h" +#include "cornerdetector.h" #include @@ -32,10 +33,6 @@ typedef std::vector QuadStrokeChunkArray; static int numSaved = 0; -void detectCorners(const std::vector &points, int minSampleNum, - int minDist, int maxDist, double maxAngle, - std::vector &corners); - namespace { //--------------------------------------------------------------------------- diff --git a/toonz/sources/common/tvectorimage/tsweepboundary.cpp b/toonz/sources/common/tvectorimage/tsweepboundary.cpp index 3589de9..0d4ce93 100644 --- a/toonz/sources/common/tvectorimage/tsweepboundary.cpp +++ b/toonz/sources/common/tvectorimage/tsweepboundary.cpp @@ -64,7 +64,7 @@ typedef enum Direction { outward = 1, deletedInward = 2, deletedOutward = 3 -}; +} Direction; /* class CompareOutlines { @@ -174,10 +174,10 @@ typedef list QuadraticList; //--------------------------------------------------------------------------- -void splitCircularArcIntoQuadraticCurves(const TPointD &Center, - const TPointD &Pstart, - const TPointD &Pend, - vector &quadArray) { +static void splitCircularArcIntoQuadraticCurves(const TPointD &Center, + const TPointD &Pstart, + const TPointD &Pend, + vector &quadArray) { // It splits a circular anticlockwise arc into a sequence of quadratic bezier // curves // Every quadratic curve can approximate an arc no longer than 45 degrees (or @@ -365,7 +365,7 @@ inline void drawPointCross(const TPointD &point, double R, double G, double B) { //------------------------------------------------------------------- -TStroke *getOutStroke(LinkedQuadraticList &inputBoundaries) { +static TStroke *getOutStroke(LinkedQuadraticList &inputBoundaries) { vector aux; LinkedQuadraticList::iterator it = inputBoundaries.begin(); @@ -427,8 +427,8 @@ inline bool getOutputOutlines(LinkedQuadraticList &inputBoundaries, //------------------------------------------------------------------- -bool computeBoundaryStroke(const TStroke &_stroke, - vector &sweepStrokes) { +static bool computeBoundaryStroke(const TStroke &_stroke, + vector &sweepStrokes) { // if(!outlines.empty()) return false; TStroke *oriStroke = const_cast(&_stroke); diff --git a/toonz/sources/common/tvectorimage/tvectorimage.cpp b/toonz/sources/common/tvectorimage/tvectorimage.cpp index aec0074..d8a5877 100644 --- a/toonz/sources/common/tvectorimage/tvectorimage.cpp +++ b/toonz/sources/common/tvectorimage/tvectorimage.cpp @@ -14,6 +14,7 @@ #include "tpaletteutil.h" #include "tthreadmessage.h" #include "tsimplecolorstyles.h" +#include "tcomputeregions.h" #include @@ -246,7 +247,7 @@ TRectD TVectorImage::addStroke(const std::vector &points) //----------------------------------------------------------------------------- -bool isRegionWithStroke(TRegion *region, TStroke *s) { +static bool isRegionWithStroke(TRegion *region, TStroke *s) { for (UINT i = 0; i < region->getEdgeCount(); i++) if (region->getEdge(i)->m_s == s) return true; return false; @@ -254,7 +255,7 @@ bool isRegionWithStroke(TRegion *region, TStroke *s) { //----------------------------------------------------------------------------- -void deleteSubRegionWithStroke(TRegion *region, TStroke *s) { +static void deleteSubRegionWithStroke(TRegion *region, TStroke *s) { for (int i = 0; i < (int)region->getSubregionCount(); i++) { deleteSubRegionWithStroke(region->getSubregion(i), s); if (isRegionWithStroke(region->getSubregion(i), s)) { @@ -629,7 +630,7 @@ TRaster32P TVectorImage::render(bool onlyStrokes) { TRect bBox = convert(getBBox()); if (bBox.isEmpty()) return (TRaster32P)0; - std::auto_ptr offlineGlContext(new TOfflineGL(bBox.getSize())); + std::unique_ptr offlineGlContext(new TOfflineGL(bBox.getSize())); offlineGlContext->clear(TPixel32(0, 0, 0, 0)); offlineGlContext->makeCurrent(); TVectorRenderData rd(TTranslation(-convert(bBox.getP00())), @@ -1044,7 +1045,6 @@ bool TVectorImage::Imp::areWholeGroups(const std::vector &indexes) const { //----------------------------------------------------------------------------- //------------------------------------------------------------------- -void invalidateRegionPropAndBBox(TRegion *reg); void TVectorImage::Imp::notifyChangedStrokes( const std::vector &strokeIndexArray, @@ -1938,9 +1938,9 @@ assert(m_strokes[strokeIndex-wSize+1]->m_edgeList.empty());*/ //----------------------------------------------------------------------------- -void computeEdgeList(TStroke *newS, const std::list &edgeList1, - bool join1AtBegin, const std::list &edgeList2, - bool join2AtBegin, std::list &edgeList) { +static void computeEdgeList(TStroke *newS, const std::list &edgeList1, + bool join1AtBegin, const std::list &edgeList2, + bool join2AtBegin, std::list &edgeList) { std::list::const_iterator it; if (!edgeList1.empty()) { diff --git a/toonz/sources/common/tvectorimage/tvectorimageP.h b/toonz/sources/common/tvectorimage/tvectorimageP.h index 19ce718..5a14c15 100644 --- a/toonz/sources/common/tvectorimage/tvectorimageP.h +++ b/toonz/sources/common/tvectorimage/tvectorimageP.h @@ -264,7 +264,14 @@ private: Imp &operator=(const Imp &); }; +// Functions + void addRegion(std::vector ®ionArray, TRegion *region); + +void transferColors(const std::list &oldList, + const std::list &newList, bool isStrokeChanged, + bool isFlipped, bool overwriteColor); + //============================================================================= #endif diff --git a/toonz/sources/common/tvrender/tcolorstyles.cpp b/toonz/sources/common/tvrender/tcolorstyles.cpp index 6c1813f..3b18ce5 100644 --- a/toonz/sources/common/tvrender/tcolorstyles.cpp +++ b/toonz/sources/common/tvrender/tcolorstyles.cpp @@ -451,8 +451,8 @@ void TColorStyle::declare(TColorStyle *style) { //=================================================================== -double computeAverageThickness(const TStroke *s, double &minThickness, - double &maxThickness) { +static double computeAverageThickness(const TStroke *s, double &minThickness, + double &maxThickness) { int count = s->getControlPointCount(); minThickness = 1000; diff --git a/toonz/sources/common/tvrender/tflash.cpp b/toonz/sources/common/tvrender/tflash.cpp index 009e09a..3205751 100644 --- a/toonz/sources/common/tvrender/tflash.cpp +++ b/toonz/sources/common/tvrender/tflash.cpp @@ -32,13 +32,13 @@ TNZ_LITTLE_ENDIAN undefined !! int Tw = 0; -bool areTwEqual(double x, double y) { +static bool areTwEqual(double x, double y) { assert(Tw != 0); return (int)(Tw * x) == (int)(Tw * y); } -bool areTwEqual(TPointD p0, TPointD p1) { +static bool areTwEqual(TPointD p0, TPointD p1) { assert(Tw != 0); return areTwEqual(p0.x, p1.x) && areTwEqual(p0.y, p1.y); @@ -184,7 +184,7 @@ public: TImageP m_img; }; -double computeAverageThickness(const TStroke *s) { +static double computeAverageThickness(const TStroke *s) { int count = s->getControlPointCount(); double resThick = 0; int i; @@ -198,8 +198,8 @@ double computeAverageThickness(const TStroke *s) { return resThick / (s->getControlPointCount() - 4); } -void putquads(const TStroke *s, double w0, double w1, - std::vector &quads) { +static void putquads(const TStroke *s, double w0, double w1, + std::vector &quads) { int chunkIndex0, chunkIndex1, i; double dummy; bool ret; @@ -216,9 +216,9 @@ void putquads(const TStroke *s, double w0, double w1, //------------------------------------------------------------------- -void computeOutlineBoundary(std::vector &outlines, - std::list &polylinesArray, - const TPixel &color) { +static void computeOutlineBoundary(std::vector &outlines, + std::list &polylinesArray, + const TPixel &color) { UINT size = polylinesArray.size(); std::vector> quads; @@ -273,7 +273,7 @@ bool PolyStyle::operator==(const PolyStyle &p) const { //------------------------------------------------------------------- -bool affineMinorThen(const TAffine &m0, const TAffine &m1) { +static bool affineMinorThen(const TAffine &m0, const TAffine &m1) { if (m0.a11 == m1.a11) { if (m0.a12 == m1.a12) { if (m0.a13 == m1.a13) { @@ -323,8 +323,8 @@ bool PolyStyle::operator<(const PolyStyle &p) const { //------------------------------------------------------------------- -void computeQuadChain(const TEdge &e, std::vector &quadArray, - std::vector &toBeDeleted) { +static void computeQuadChain(const TEdge &e, std::vector &quadArray, + std::vector &toBeDeleted) { int chunk_b, chunk_e, chunk = -1; double t_b, t_e, w0, w1; TThickQuadratic *q_b = 0, *q_e = 0; diff --git a/toonz/sources/common/tvrender/tglregions.cpp b/toonz/sources/common/tvrender/tglregions.cpp index 8bf6004..e489878 100644 --- a/toonz/sources/common/tvrender/tglregions.cpp +++ b/toonz/sources/common/tvrender/tglregions.cpp @@ -436,7 +436,7 @@ void tglDraw(const TVectorRenderData &rd, const TStroke *s, bool pushAttribs) { //------------------------------------------------------------------------------------ -void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { +static void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { bool visible = false; int colorCount = 0; if (!r) return; @@ -462,7 +462,7 @@ void tglDoDraw(const TVectorRenderData &rd, TRegion *r) { //------------------------------------------------------------------------------------ -void tglDoDraw(const TVectorRenderData &rd, const TStroke *s) { +static void tglDoDraw(const TVectorRenderData &rd, const TStroke *s) { bool visible = false; int colorCount = 0; diff --git a/toonz/sources/common/tvrender/tinbetween.cpp b/toonz/sources/common/tvrender/tinbetween.cpp index a8faa5b..68b8551 100644 --- a/toonz/sources/common/tvrender/tinbetween.cpp +++ b/toonz/sources/common/tvrender/tinbetween.cpp @@ -18,7 +18,7 @@ //#include "tdebugmessage.h" //-------------------------------------------------------------------------------------- -double average(std::vector &values, double range = 2.5) { +static double average(std::vector &values, double range = 2.5) { UINT size = values.size(); if (size == 0) return std::numeric_limits::signaling_NaN(); @@ -56,8 +56,8 @@ double average(std::vector &values, double range = 2.5) { //-------------------------------------------------------------------------------------- -double weightedAverage(std::vector &values, - std::vector &weights, double range = 2.5) { +static double weightedAverage(std::vector &values, + std::vector &weights, double range = 2.5) { UINT size = values.size(); if (size == 0) return std::numeric_limits::signaling_NaN(); @@ -162,8 +162,8 @@ n^r <= 2^(s-1) < (2^s)-1 //-------------------------------------------------------------------------------------- -void eraseSmallAngles(std::vector> &corners, - double angle) { +static void eraseSmallAngles(std::vector> &corners, + double angle) { std::vector>::iterator it = corners.begin(); while (it != corners.end()) { @@ -180,9 +180,9 @@ void eraseSmallAngles(std::vector> &corners, // of the corners) // max is tha maximum angle greater or equal to minDegree -void detectCorners(const TStroke *stroke, double minDegree, - std::vector> &corners, double &min, - double &max) { +static void detectCorners(const TStroke *stroke, double minDegree, + std::vector> &corners, double &min, + double &max) { const double minSin = fabs(sin(minDegree * M_PI_180)); double angle, vectorialProduct, metaCornerLen, partialLen; @@ -330,7 +330,7 @@ void detectCorners(const TStroke *stroke, double minDegree, //-------------------------------------------------------------------------------------- -double variance(std::vector &values) { +static double variance(std::vector &values) { UINT size = values.size(); if (size == 0) return std::numeric_limits::signaling_NaN(); @@ -352,13 +352,13 @@ double variance(std::vector &values) { //-------------------------------------------------------------------------------------- -void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, - std::pair *partialAngles1, - UINT partialAngles1Size, - const std::vector> &angles2, - UINT r, - std::list> &partialSolution, - double &bestValue, std::vector &bestVector) { +static void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, + std::pair *partialAngles1, + UINT partialAngles1Size, + const std::vector> &angles2, + UINT r, + std::list> &partialSolution, + double &bestValue, std::vector &bestVector) { //------------------------------------------------------------------- if (r == partialAngles1Size) { UINT j; @@ -499,10 +499,10 @@ TDebugMessage::flush(); //-------------------------------------------------------------------------------------- -void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, - std::vector> &angles1, - const std::vector> &angles2, - double &bestValue, std::vector &bestVector) { +static void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, + std::vector> &angles1, + const std::vector> &angles2, + double &bestValue, std::vector &bestVector) { assert(angles1.size() > angles2.size()); std::list> partialSolution; @@ -513,10 +513,10 @@ void findBestSolution(const TStroke *stroke1, const TStroke *stroke2, //-------------------------------------------------------------------------------------- -void trivialSolution(const TStroke *stroke1, const TStroke *stroke2, - const std::vector> &angles1, - const std::vector> &angles2, - std::vector &solution) { +static void trivialSolution(const TStroke *stroke1, const TStroke *stroke2, + const std::vector> &angles1, + const std::vector> &angles2, + std::vector &solution) { assert(angles1.size() > angles2.size()); UINT j; @@ -578,7 +578,7 @@ void trivialSolution(const TStroke *stroke1, const TStroke *stroke2, //-------------------------------------------------------------------------------------- -TStroke *extract(const TStroke *source, UINT firstQuad, UINT lastQuad) { +static TStroke *extract(const TStroke *source, UINT firstQuad, UINT lastQuad) { UINT quadCount = source->getChunkCount(); if (firstQuad >= quadCount) { assert(!"bad quadric index"); @@ -607,8 +607,8 @@ TStroke *extract(const TStroke *source, UINT firstQuad, UINT lastQuad) { //-------------------------------------------------------------------------------------- -void sample(const TStroke *stroke, int samplingSize, - std::vector &sampledPoint) { +static void sample(const TStroke *stroke, int samplingSize, + std::vector &sampledPoint) { double samplingFrequency = 1.0 / (double)samplingSize; sampledPoint.resize(samplingSize); diff --git a/toonz/sources/common/tvrender/tofflinegl.cpp b/toonz/sources/common/tvrender/tofflinegl.cpp index eaab4d9..000e6df 100644 --- a/toonz/sources/common/tvrender/tofflinegl.cpp +++ b/toonz/sources/common/tvrender/tofflinegl.cpp @@ -485,7 +485,7 @@ Bool ret = glXMakeCurrent(m_dpy, int getLy() const { return m_raster->getLy(); } }; -std::shared_ptr defaultOfflineGLGenerator( +static std::shared_ptr defaultOfflineGLGenerator( const TDimension &dim, std::shared_ptr shared) { return std::make_shared(dim, shared); } diff --git a/toonz/sources/common/tvrender/tpalette.cpp b/toonz/sources/common/tvrender/tpalette.cpp index 16a6a70..e301908 100644 --- a/toonz/sources/common/tvrender/tpalette.cpp +++ b/toonz/sources/common/tvrender/tpalette.cpp @@ -261,7 +261,7 @@ int TPalette::addStyle(const TPixel32 &color) { //------------------------------------------------------------------- void TPalette::setStyle(int styleId, TColorStyle *style) { - std::auto_ptr styleOwner(style); + std::unique_ptr styleOwner(style); int styleCount = getStyleCount(); diff --git a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp index 42b794c..bbff67c 100644 --- a/toonz/sources/common/tvrender/tsimplecolorstyles.cpp +++ b/toonz/sources/common/tvrender/tsimplecolorstyles.cpp @@ -40,7 +40,7 @@ TFilePath TVectorImagePatternStrokeStyle::m_rootDir = TFilePath(); //----------------------------------------------------------------------------- #ifndef NDEBUG -void checkGlError() { +static void checkGlError() { GLenum err = glGetError(); assert(err != GL_INVALID_ENUM); assert(err != GL_INVALID_VALUE); diff --git a/toonz/sources/common/tvrender/ttessellator.cpp b/toonz/sources/common/tvrender/ttessellator.cpp index eed5285..9dcafa7 100644 --- a/toonz/sources/common/tvrender/ttessellator.cpp +++ b/toonz/sources/common/tvrender/ttessellator.cpp @@ -53,20 +53,23 @@ TglTessellator::GLTess::~GLTess() { gluDeleteTess(m_tess); } namespace { -extern "C" void CALLBACK tessellateTexture(const GLdouble *tex) { +extern "C" { +static void CALLBACK tessellateTexture(const GLdouble *tex) { double u = tex[0] * 0.01; double v = tex[1] * 0.01; glTexCoord2d(u, v); glVertex2dv(tex); } +} //------------------------------------------------------------------- TThread::Mutex CombineDataGuard; -std::list Combine_data; +static std::list Combine_data; -extern "C" void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4], +extern "C" { +static void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4], GLfloat w[4], GLdouble **dataOut) { GLdouble *newCoords = new GLdouble[3]; @@ -76,6 +79,7 @@ extern "C" void CALLBACK myCombine(GLdouble coords[3], GLdouble *d[4], Combine_data.push_back(newCoords); *dataOut = newCoords; } +} //=================================================================== diff --git a/toonz/sources/common/twain/ttwain.h b/toonz/sources/common/twain/ttwain.h index ff166df..5779a4d 100644 --- a/toonz/sources/common/twain/ttwain.h +++ b/toonz/sources/common/twain/ttwain.h @@ -75,7 +75,7 @@ typedef int TTWAIN_ONDONE_CB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, typedef void TTWAIN_ONERROR_CB(void *usrData, void *alwaysZero); int TTWAIN_IsAvailable(void); -void TWAIN_RegisterApp( +void TTWAIN_RegisterApp( int majorNum, int minorNum, /* app. revision*/ int nLanguage, /* (human) language (use TWLG_xxx from TWAIN.H) */ int nCountry, /* country (use TWCY_xxx from TWAIN.H) */ diff --git a/toonz/sources/common/twain/twain.h b/toonz/sources/common/twain/twain.h index 4ffd804..b2c712c 100644 --- a/toonz/sources/common/twain/twain.h +++ b/toonz/sources/common/twain/twain.h @@ -1484,16 +1484,18 @@ typedef struct { /* misplaced */ #define DAT_ICCPROFILE \ - 0x0401 /* TW_MEMORY Added 1.91 This Data Argument is misplaced but \ \ \ + 0x0401 /* TW_MEMORY Added 1.91 This Data Argument is misplaced but \ \ \ \ belongs to the DG_IMAGE Data Group */ #define DAT_IMAGEMEMFILEXFER \ 0x0402 /* TW_IMAGEMEMXFER Added 1.91 This Data Argument is misplaced but \ \ \ \ \ \ + \ \ \ \ belongs to the DG_IMAGE Data Group */ #define DAT_ENTRYPOINT \ 0x0403 /* TW_ENTRYPOINT Added 2.0 This Data Argument is misplaced but \ \ \ \ + \ \ \ belongs to the DG_CONTROL Data Group */ /**************************************************************************** diff --git a/toonz/sources/image/CMakeLists.txt b/toonz/sources/image/CMakeLists.txt index 656ec0f..d0a19c2 100644 --- a/toonz/sources/image/CMakeLists.txt +++ b/toonz/sources/image/CMakeLists.txt @@ -20,7 +20,12 @@ set(HEADERS ../include/tnzimage.h mov/tiio_mov_proxy.h 3gp/tiio_3gp_proxy.h - mesh/tiio_mesh.h) + ffmpeg/tiio_gif.h + ffmpeg/tiio_webm.h + ffmpeg/tiio_mp4.h + ffmpeg/tiio_ffmpeg.h + mesh/tiio_mesh.h +) set(SOURCES tiio.cpp @@ -46,31 +51,42 @@ set(SOURCES tzl/tiio_tzl.cpp mov/tiio_mov_proxy.cpp 3gp/tiio_3gp_proxy.cpp - mesh/tiio_mesh.cpp) + ffmpeg/tiio_gif.cpp + ffmpeg/tiio_webm.cpp + ffmpeg/tiio_mp4.cpp + ffmpeg/tiio_ffmpeg.cpp + mesh/tiio_mesh.cpp +) if(WIN32) set(HEADERS ${HEADERS} avi/tiio_avi.h mov/tiio_mov.h - 3gp/tiio_3gp.h) + 3gp/tiio_3gp.h + ) set(SOURCES ${SOURCES} avi/tiio_avi.cpp mov/tiio_movW.cpp - 3gp/tiio_3gpW.cpp) + 3gp/tiio_3gpW.cpp + ) else() set(HEADERS ${HEADERS} mov/tiio_movM.h - 3gp/tiio_3gpM.h) + 3gp/tiio_3gpM.h + ) set(SOURCES ${SOURCES} mov/tiio_movM.cpp - 3gp/tiio_3gpM.cpp) + 3gp/tiio_3gpM.cpp + ) elseif(UNIX) set(HEADERS ${HEADERS} 3gp/tiio_3gp_proxy.h - mov/tiio_mov_proxy.h) + mov/tiio_mov_proxy.h + ) set(SOURCES ${SOURCES} mov/tiio_mov_proxy.cpp - 3gp/tiio_3gp_proxy.cpp) + 3gp/tiio_3gp_proxy.cpp + ) endif() add_library(image SHARED ${HEADERS} ${SOURCES}) @@ -106,26 +122,26 @@ if(WIN32) endif() endif() -if(PLATFORM EQUAL 32) - _find_toonz_library(TNZLIBS "tnzcore;tnzbase") -else() - _find_toonz_library(TNZLIBS "tnzcore;tnzbase;toonzlib") -endif() + +_find_toonz_library(TNZLIBS "tnzcore;tnzbase;toonzlib") + if(WIN32) set(EXTRA_LIBS ${TNZLIBS} - vfw32.lib) + vfw32.lib + ) elseif(APPLE) if(PLATFORM EQUAL 32) find_library(CORE_SERVICES_LIB CoreServices) set(OSX_10_6_SDK_PATH "") if(NOT OSX_10_6_SDK_PATH) - message(FATAL_ERROR "Set variable 'OSX_10_6_SDK_PATH'") + message(FATAL_ERROR "Set variable 'OSX_10_6_SDK_PATH'") endif() find_library(QD_LIB - NAMES QD - PATHS OSX10_6_SDK_PATH) + NAMES QD + PATHS OSX10_6_SDK_PATH + ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -F ${OSX_10_6_SDK_PATH}") endif() set(EXTRA_LIBS @@ -133,11 +149,13 @@ elseif(APPLE) ${QT_LIB} ${CARBON_LIB} ${CORE_SERVICES_LIB} - ${QD_LIB}) + ${QD_LIB} + ) else() # Generic Unix set(EXTRA_LIBS - ${TNZLIBS}) + ${TNZLIBS} + ) endif() -target_link_libraries(image Qt5::Core Qt5::Network ${Z_LIB} ${GLUT_LIB} ${GL_LIB} ${JPEG_LIB} ${TIFF_LIB} ${PNG_LIB} ${EXTRA_LIBS}) +target_link_libraries(image Qt5::Core Qt5::Gui Qt5::Network ${Z_LIB} ${GLUT_LIB} ${GL_LIB} ${JPEG_LIB} ${TIFF_LIB} ${PNG_LIB} ${EXTRA_LIBS}) diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp new file mode 100644 index 0000000..33ac88b --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp @@ -0,0 +1,418 @@ +#include "tiio_ffmpeg.h" +#include "../toonz/tapp.h" +#include "tsystem.h" +#include "tsound.h" + +#include +#include +#include +#include "toonz/preferences.h" +#include "toonz/toonzfolders.h" + +Ffmpeg::Ffmpeg() { + m_ffmpegPath = Preferences::instance()->getFfmpegPath(); + m_ffmpegTimeout = Preferences::instance()->getFfmpegTimeout() * 1000; + std::string strPath = m_ffmpegPath.toStdString(); + m_intermediateFormat = "png"; +} +Ffmpeg::~Ffmpeg() {} + +bool Ffmpeg::checkFfmpeg() { + // check the user defined path in preferences first + QString path = Preferences::instance()->getFfmpegPath() + "/ffmpeg"; +#if defined(_WIN32) + path = path + ".exe"; +#endif + if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true; + + // check the OpenToonz root directory next + path = QDir::currentPath() + "/ffmpeg"; +#if defined(_WIN32) + path = path + ".exe"; +#endif + if (TSystem::doesExistFileOrLevel(TFilePath(path))) { + Preferences::instance()->setFfmpegPath(QDir::currentPath().toStdString()); + return true; + } + + // give up + return false; +} + +bool Ffmpeg::checkFfprobe() { + // check the user defined path in preferences first + QString path = Preferences::instance()->getFfmpegPath() + "/ffprobe"; +#if defined(_WIN32) + path = path + ".exe"; +#endif + if (TSystem::doesExistFileOrLevel(TFilePath(path))) return true; + + // check the OpenToonz root directory next + path = QDir::currentPath() + "/ffprobe"; +#if defined(_WIN32) + path = path + ".exe"; +#endif + if (TSystem::doesExistFileOrLevel(TFilePath(path))) { + Preferences::instance()->setFfmpegPath(QDir::currentPath().toStdString()); + return true; + } + + // give up + return false; +} + +bool Ffmpeg::checkFormat(std::string format) { + QString path = Preferences::instance()->getFfmpegPath() + "/ffmpeg"; +#if defined(_WIN32) + path = path + ".exe"; +#endif + QStringList args; + args << "-formats"; + QProcess ffmpeg; + ffmpeg.start(path, args); + ffmpeg.waitForFinished(); + QString results = ffmpeg.readAllStandardError(); + results += ffmpeg.readAllStandardOutput(); + ffmpeg.close(); + std::string strResults = results.toStdString(); + std::string::size_type n; + n = strResults.find(format); + if (n != std::string::npos) return true; + else return false; +} + + + +TFilePath Ffmpeg::getFfmpegCache() { + QString cacheRoot = ToonzFolder::getCacheRootFolder().getQString(); + if (!TSystem::doesExistFileOrLevel(TFilePath(cacheRoot + "/ffmpeg"))) { + TSystem::mkDir(TFilePath(cacheRoot + "/ffmpeg")); + } + std::string ffmpegPath = + TFilePath(cacheRoot + "/ffmpeg").getQString().toStdString(); + return TFilePath(cacheRoot + "/ffmpeg"); +} + +void Ffmpeg::setFrameRate(double fps) { m_frameRate = fps; } + +void Ffmpeg::setPath(TFilePath path) { m_path = path; } + +void Ffmpeg::createIntermediateImage(const TImageP &img, int frameIndex) { + QString tempPath = m_path.getQString() + "tempOut" + + QString::number(frameIndex) + "." + m_intermediateFormat; + std::string saveStatus = ""; + TRasterImageP tempImage(img); + TRasterImage *image = (TRasterImage *)tempImage->cloneImage(); + + m_lx = image->getRaster()->getLx(); + m_ly = image->getRaster()->getLy(); + m_bpp = image->getRaster()->getPixelSize(); + int totalBytes = m_lx * m_ly * m_bpp; + image->getRaster()->yMirror(); + + // lock raster to get data + image->getRaster()->lock(); + void *buffin = image->getRaster()->getRawData(); + assert(buffin); + void *buffer = malloc(totalBytes); + memcpy(buffer, buffin, totalBytes); + + image->getRaster()->unlock(); + + // create QImage save format + QByteArray ba = m_intermediateFormat.toUpper().toLatin1(); + const char *format = ba.data(); + + QImage *qi = new QImage((uint8_t *)buffer, m_lx, m_ly, QImage::Format_ARGB32); + qi->save(tempPath, format, -1); + free(buffer); + m_cleanUpList.push_back(tempPath); + m_frameCount++; + delete qi; + delete image; +} + +void Ffmpeg::runFfmpeg(QStringList preIArgs, QStringList postIArgs, + bool includesInPath, bool includesOutPath, + bool overWriteFiles) { + QString tempName = "tempOut%d." + m_intermediateFormat; + tempName = m_path.getQString() + tempName; + + QStringList args; + args = args + preIArgs; + if (!includesInPath) { // NOTE: if including the in path, it needs to be in + // the preIArgs argument. + args << "-i"; + args << tempName; + } + if (m_hasSoundTrack) args = args + m_audioArgs; + args = args + postIArgs; + if (overWriteFiles && !includesOutPath) { // if includesOutPath is true, you + // need to include the overwrite in + // your postIArgs. + args << "-y"; + } + if (!includesOutPath) { + args << m_path.getQString(); + } + + // write the file + QProcess ffmpeg; + ffmpeg.start(m_ffmpegPath + "/ffmpeg", args); + ffmpeg.waitForFinished(m_ffmpegTimeout); + QString results = ffmpeg.readAllStandardError(); + results += ffmpeg.readAllStandardOutput(); + int exitCode = ffmpeg.exitCode(); + ffmpeg.close(); + std::string strResults = results.toStdString(); +} + +QString Ffmpeg::runFfprobe(QStringList args) { + QProcess ffmpeg; + ffmpeg.start(m_ffmpegPath + "/ffprobe", args); + ffmpeg.waitForFinished(m_ffmpegTimeout); + QString results = ffmpeg.readAllStandardError(); + results += ffmpeg.readAllStandardOutput(); + int exitCode = ffmpeg.exitCode(); + ffmpeg.close(); + std::string strResults = results.toStdString(); + return results; +} + +void Ffmpeg::saveSoundTrack(TSoundTrack *st) { + m_sampleRate = st->getSampleRate(); + m_channelCount = st->getChannelCount(); + m_bitsPerSample = st->getBitPerSample(); + // LONG count = st->getSampleCount(); + int bufSize = st->getSampleCount() * st->getSampleSize(); + const UCHAR *buffer = st->getRawData(); + + m_audioPath = m_path.getQString() + "tempOut.raw"; + m_audioFormat = "s" + QString::number(m_bitsPerSample); + if (m_bitsPerSample > 8) m_audioFormat = m_audioFormat + "le"; + std::string strPath = m_audioPath.toStdString(); + + QByteArray data; + data.insert(0, (char *)buffer, bufSize); + + QFile file(m_audioPath); + file.open(QIODevice::WriteOnly); + file.write(data); + file.close(); + m_hasSoundTrack = true; + + m_audioArgs << "-f"; + m_audioArgs << m_audioFormat; + m_audioArgs << "-ar"; + m_audioArgs << QString::number(m_sampleRate); + m_audioArgs << "-ac"; + m_audioArgs << QString::number(m_channelCount); + m_audioArgs << "-i"; + m_audioArgs << m_audioPath; + + // add file to framesWritten for cleanup + m_cleanUpList.push_back(m_audioPath); +} + +bool Ffmpeg::checkFilesExist() { + QString ffmpegCachePath = getFfmpegCache().getQString(); + QString tempPath = ffmpegCachePath + "//" + + QString::fromStdString(m_path.getName()) + + QString::fromStdString(m_path.getType()) + "In0001." + + m_intermediateFormat; + if (TSystem::doesExistFileOrLevel(TFilePath(tempPath))) { + return true; + } else + return false; +} + +ffmpegFileInfo Ffmpeg::getInfo() { + QString ffmpegCachePath = getFfmpegCache().getQString(); + QString tempPath = ffmpegCachePath + "//" + + QString::fromStdString(m_path.getName()) + + QString::fromStdString(m_path.getType()) + ".txt"; + if (QFile::exists(tempPath)) { + QFile infoText(tempPath); + infoText.open(QIODevice::ReadOnly); + QByteArray ba = infoText.readAll(); + infoText.close(); + QString text = QString::fromStdString(ba.toStdString()); + m_lx = text.split(" ")[0].toInt(); + m_ly = text.split(" ")[1].toInt(); + m_frameRate = text.split(" ")[2].toDouble(); + m_frameCount = text.split(" ")[3].toInt(); + } else { + QFile infoText(tempPath); + getSize(); + getFrameRate(); + getFrameCount(); + infoText.open(QIODevice::WriteOnly); + std::string infoToWrite = + std::to_string(m_lx) + " " + std::to_string(m_ly) + " " + + std::to_string(m_frameRate) + " " + std::to_string(m_frameCount); + int infoLength = infoToWrite.length(); + infoText.write(infoToWrite.c_str(), infoLength); + infoText.close(); + } + ffmpegFileInfo info; + info.m_lx = m_lx; + info.m_ly = m_ly; + info.m_frameRate = m_frameRate; + info.m_frameCount = m_frameCount; + return info; +} +TRasterImageP Ffmpeg::getImage(int frameIndex) { + QString ffmpegCachePath = getFfmpegCache().getQString(); + QString tempPath = ffmpegCachePath + "//" + + QString::fromStdString(m_path.getName()) + + QString::fromStdString(m_path.getType()); + std::string tmpPath = tempPath.toStdString(); + // QString tempPath= m_path.getQString(); + QString number = QString("%1").arg(frameIndex, 4, 10, QChar('0')); + QString tempName = "In" + number + ".png"; + tempName = tempPath + tempName; + + // for debugging + std::string strPath = tempName.toStdString(); + if (TSystem::doesExistFileOrLevel(TFilePath(tempName))) { + QImage *temp = new QImage(tempName, "PNG"); + if (temp) { + QImage tempToo = temp->convertToFormat(QImage::Format_ARGB32); + delete temp; + const UCHAR *bits = tempToo.bits(); + + TRasterPT ret; + ret.create(m_lx, m_ly); + ret->lock(); + memcpy(ret->getRawData(), bits, m_lx * m_ly * 4); + ret->unlock(); + ret->yMirror(); + return TRasterImageP(ret); + } + } else + return TRasterImageP(); +} + +double Ffmpeg::getFrameRate() { + if (m_frameCount > 0) { + QStringList fpsArgs; + fpsArgs << "-v"; + fpsArgs << "error"; + fpsArgs << "-select_streams"; + fpsArgs << "v:0"; + fpsArgs << "-show_entries"; + fpsArgs << "stream=avg_frame_rate"; + fpsArgs << "-of"; + fpsArgs << "default=noprint_wrappers=1:nokey=1"; + fpsArgs << m_path.getQString(); + QString fpsResults = runFfprobe(fpsArgs); + + int fpsNum = fpsResults.split("/")[0].toInt(); + int fpsDen = fpsResults.split("/")[1].toInt(); + if (fpsDen > 0) { + m_frameRate = fpsNum / fpsDen; + } + } + return m_frameRate; +} + +TDimension Ffmpeg::getSize() { + QStringList sizeArgs; + sizeArgs << "-v"; + sizeArgs << "error"; + sizeArgs << "-of"; + sizeArgs << "flat=s=_"; + sizeArgs << "-select_streams"; + sizeArgs << "v:0"; + sizeArgs << "-show_entries"; + sizeArgs << "stream=height,width"; + sizeArgs << m_path.getQString(); + + QString sizeResults = runFfprobe(sizeArgs); + QStringList split = sizeResults.split("\n"); + m_lx = split[0].split("=")[1].toInt(); + m_ly = split[1].split("=")[1].toInt(); + return TDimension(m_lx, m_ly); +} + +int Ffmpeg::getFrameCount() { + QStringList frameCountArgs; + frameCountArgs << "-v"; + frameCountArgs << "error"; + frameCountArgs << "-count_frames"; + frameCountArgs << "-select_streams"; + frameCountArgs << "v:0"; + frameCountArgs << "-show_entries"; + frameCountArgs << "stream=nb_read_frames"; + frameCountArgs << "-of"; + frameCountArgs << "default=nokey=1:noprint_wrappers=1"; + frameCountArgs << m_path.getQString(); + + QString frameResults = runFfprobe(frameCountArgs); + m_frameCount = frameResults.toInt(); + return m_frameCount; +} + +void Ffmpeg::getFramesFromMovie(int frame) { + QString ffmpegCachePath = getFfmpegCache().getQString(); + QString tempPath = ffmpegCachePath + "//" + + QString::fromStdString(m_path.getName()) + + QString::fromStdString(m_path.getType()); + std::string tmpPath = tempPath.toStdString(); + QString tempName = "In%04d." + m_intermediateFormat; + tempName = tempPath + tempName; + QString tempStart; + if (frame == -1) { + tempStart = "In0001." + m_intermediateFormat; + tempStart = tempPath + tempStart; + } else { + QString number = QString("%1").arg(frame, 4, 10, QChar('0')); + tempStart = tempPath + "In" + number + "." + m_intermediateFormat; + } + QString tempBase = tempPath + "In"; + QString addToDelete; + if (!TSystem::doesExistFileOrLevel(TFilePath(tempStart))) { + // for debugging + std::string strPath = tempName.toStdString(); + + QStringList preIFrameArgs; + QStringList postIFrameArgs; + // frameArgs << "-accurate_seek"; + // frameArgs << "-ss"; + // frameArgs << "0" + QString::number(frameIndex / m_info->m_frameRate); + preIFrameArgs << "-i"; + preIFrameArgs << m_path.getQString(); + postIFrameArgs << "-y"; + postIFrameArgs << "-f"; + postIFrameArgs << "image2"; + + postIFrameArgs << tempName; + + runFfmpeg(preIFrameArgs, postIFrameArgs, true, true, true); + + for (int i = 1; i <= m_frameCount; i++) { + QString number = QString("%1").arg(i, 4, 10, QChar('0')); + addToDelete = tempBase + number + "." + m_intermediateFormat; + std::string delPath = addToDelete.toStdString(); + // addToCleanUp(addToDelete); + } + } +} + +void Ffmpeg::addToCleanUp(QString path) { + if (TSystem::doesExistFileOrLevel(TFilePath(path))) { + m_cleanUpList.push_back(path); + } +} + +void Ffmpeg::cleanUpFiles() { + for (QString path : m_cleanUpList) { + if (TSystem::doesExistFileOrLevel(TFilePath(path))) { + TSystem::deleteFile(TFilePath(path)); + } + } +} + +void Ffmpeg::disablePrecompute() { + Preferences::instance()->setPrecompute(false); +} \ No newline at end of file diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.h b/toonz/sources/image/ffmpeg/tiio_ffmpeg.h new file mode 100644 index 0000000..24aa93f --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.h @@ -0,0 +1,57 @@ +#pragma once + +#ifndef TTIO_FFMPEG_INCLUDED +#define TTIO_FFMPEG_INCLUDED + +#include "tproperty.h" +#include "tlevel_io.h" +#include "trasterimage.h" +#include +#include + +struct ffmpegFileInfo { + int m_lx, m_ly, m_frameCount; + double m_frameRate; +}; + +class Ffmpeg { +public: + Ffmpeg(); + ~Ffmpeg(); + void createIntermediateImage(const TImageP &image, int frameIndex); + void runFfmpeg(QStringList preIArgs, QStringList postIArgs, + bool includesInPath, bool includesOutPath, + bool overWriteFiles); + void runFfmpeg(QStringList preIArgs, QStringList postIArgs, TFilePath path); + QString runFfprobe(QStringList args); + void cleanUpFiles(); + void addToCleanUp(QString); + void setFrameRate(double fps); + void setPath(TFilePath path); + void saveSoundTrack(TSoundTrack *st); + bool checkFilesExist(); + static bool checkFfmpeg(); + static bool checkFfprobe(); + static bool checkFormat(std::string format); + double getFrameRate(); + TDimension getSize(); + int getFrameCount(); + void getFramesFromMovie(int frame = -1); + TRasterImageP getImage(int frameIndex); + TFilePath getFfmpegCache(); + ffmpegFileInfo getInfo(); + void disablePrecompute(); + +private: + QString m_intermediateFormat, m_ffmpegPath, m_audioPath, m_audioFormat; + int m_frameCount = 0, m_lx, m_ly, m_bpp, m_bitsPerSample, m_channelCount, + m_ffmpegTimeout = 30000; + double m_frameRate = 24.0; + bool m_ffmpegExists = false, m_ffprobeExists = false, m_hasSoundTrack = false; + TFilePath m_path; + QVector m_cleanUpList; + QStringList m_audioArgs; + TUINT32 m_sampleRate; +}; + +#endif diff --git a/toonz/sources/image/ffmpeg/tiio_gif.cpp b/toonz/sources/image/ffmpeg/tiio_gif.cpp new file mode 100644 index 0000000..1db30cb --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_gif.cpp @@ -0,0 +1,251 @@ + +#include "tsystem.h" +#include "tiio_gif.h" +#include "trasterimage.h" +#include "timageinfo.h" +#include + +//=========================================================== +// +// TImageWriterGif +// +//=========================================================== + +class TImageWriterGif : public TImageWriter { +public: + int m_frameIndex; + + TImageWriterGif(const TFilePath &path, int frameIndex, TLevelWriterGif *lwg) + : TImageWriter(path), m_frameIndex(frameIndex), m_lwg(lwg) { + m_lwg->addRef(); + } + ~TImageWriterGif() { m_lwg->release(); } + + bool is64bitOutputSupported() override { return false; } + void save(const TImageP &img) override { m_lwg->save(img, m_frameIndex); } + +private: + TLevelWriterGif *m_lwg; +}; + +//=========================================================== +// +// TLevelWriterGif; +// +//=========================================================== + +TLevelWriterGif::TLevelWriterGif(const TFilePath &path, TPropertyGroup *winfo) + : TLevelWriter(path, winfo) { + if (!m_properties) m_properties = new Tiio::GifWriterProperties(); + std::string scale = m_properties->getProperty("Scale") + ->getValueAsString(); + m_scale = QString::fromStdString(scale).toInt(); + TBoolProperty *looping = + (TBoolProperty *)m_properties->getProperty("Looping"); + m_looping = looping->getValue(); + TBoolProperty *palette = + (TBoolProperty *)m_properties->getProperty("Generate Palette"); + m_palette = palette->getValue(); + ffmpegWriter = new Ffmpeg(); + ffmpegWriter->setPath(m_path); + // m_frameCount = 0; + if (TSystem::doesExistFileOrLevel(m_path)) TSystem::deleteFile(m_path); +} + +//----------------------------------------------------------- + +TLevelWriterGif::~TLevelWriterGif() { + QStringList preIArgs; + QStringList postIArgs; + QStringList palettePreIArgs; + QStringList palettePostIArgs; + + int outLx = m_lx; + int outLy = m_ly; + + // set scaling + outLx = m_lx * m_scale / 100; + outLy = m_ly * m_scale / 100; + //ffmpeg doesn't like resolutions that aren't divisible by 2. + if (outLx % 2 != 0) outLx++; + if (outLy % 2 != 0) outLy++; + + QString palette; + QString filters = "scale=" + QString::number(outLx) + ":-1:flags=lanczos"; + QString paletteFilters = filters + " [x]; [x][1:v] paletteuse"; + if (m_palette) { + palette = m_path.getQString() + "palette.png"; + palettePreIArgs << "-v"; + palettePreIArgs << "warning"; + + palettePostIArgs << "-vf"; + palettePostIArgs << filters + ",palettegen"; + palettePostIArgs << palette; + + // write the palette + ffmpegWriter->runFfmpeg(palettePreIArgs, palettePostIArgs, false, true, + true); + ffmpegWriter->addToCleanUp(palette); + } + + preIArgs << "-v"; + preIArgs << "warning"; + preIArgs << "-r"; + preIArgs << QString::number(m_frameRate); + if (m_palette) { + postIArgs << "-i"; + postIArgs << palette; + postIArgs << "-lavfi"; + postIArgs << paletteFilters; + } + else { + postIArgs << "-lavfi"; + postIArgs << filters; + } + + if (!m_looping) { + postIArgs << "-loop"; + postIArgs << "-1"; + } + + std::string outPath = m_path.getQString().toStdString(); + + ffmpegWriter->runFfmpeg(preIArgs, postIArgs, false, false, true); + ffmpegWriter->cleanUpFiles(); +} + +//----------------------------------------------------------- + +TImageWriterP TLevelWriterGif::getFrameWriter(TFrameId fid) { + // if (IOError != 0) + // throw TImageException(m_path, buildGifExceptionString(IOError)); + if (fid.getLetter() != 0) return TImageWriterP(0); + int index = fid.getNumber(); + TImageWriterGif *iwg = new TImageWriterGif(m_path, index, this); + return TImageWriterP(iwg); +} + +//----------------------------------------------------------- +void TLevelWriterGif::setFrameRate(double fps) { + // m_fps = fps; + m_frameRate = fps; + ffmpegWriter->setFrameRate(fps); +} + +void TLevelWriterGif::saveSoundTrack(TSoundTrack *st) { return; } + +//----------------------------------------------------------- + +void TLevelWriterGif::save(const TImageP &img, int frameIndex) { + TRasterImageP image(img); + m_lx = image->getRaster()->getLx(); + m_ly = image->getRaster()->getLy(); + ffmpegWriter->createIntermediateImage(img, frameIndex); +} + +//=========================================================== +// +// TImageReaderGif +// +//=========================================================== + +class TImageReaderGif final : public TImageReader { +public: + int m_frameIndex; + + TImageReaderGif(const TFilePath &path, int index, TLevelReaderGif *lra) + : TImageReader(path), m_lra(lra), m_frameIndex(index) { + m_lra->addRef(); + } + ~TImageReaderGif() { m_lra->release(); } + + TImageP load() override { return m_lra->load(m_frameIndex); } + TDimension getSize() const { return m_lra->getSize(); } + TRect getBBox() const { return TRect(); } + +private: + TLevelReaderGif *m_lra; + + // not implemented + TImageReaderGif(const TImageReaderGif &); + TImageReaderGif &operator=(const TImageReaderGif &src); +}; + +//=========================================================== +// +// TLevelReaderGif +// +//=========================================================== + +TLevelReaderGif::TLevelReaderGif(const TFilePath &path) + : TLevelReader(path) + +{ + ffmpegReader = new Ffmpeg(); + ffmpegReader->setPath(m_path); + ffmpegReader->disablePrecompute(); + ffmpegFileInfo tempInfo = ffmpegReader->getInfo(); + double fps = tempInfo.m_frameRate; + m_frameCount = tempInfo.m_frameCount; + m_size = TDimension(tempInfo.m_lx, tempInfo.m_ly); + m_lx = m_size.lx; + m_ly = m_size.ly; + + ffmpegReader->getFramesFromMovie(); + + // set values + m_info = new TImageInfo(); + m_info->m_frameRate = fps; + m_info->m_lx = m_lx; + m_info->m_ly = m_ly; + m_info->m_bitsPerSample = 8; + m_info->m_samplePerPixel = 4; +} +//----------------------------------------------------------- + +TLevelReaderGif::~TLevelReaderGif() { + // ffmpegReader->cleanUpFiles(); +} + +//----------------------------------------------------------- + +TLevelP TLevelReaderGif::loadInfo() { + if (m_frameCount == -1) return TLevelP(); + TLevelP level; + for (int i = 1; i <= m_frameCount; i++) level->setFrame(i, TImageP()); + return level; +} + +//----------------------------------------------------------- + +TImageReaderP TLevelReaderGif::getFrameReader(TFrameId fid) { + // if (IOError != 0) + // throw TImageException(m_path, buildAVIExceptionString(IOError)); + if (fid.getLetter() != 0) return TImageReaderP(0); + int index = fid.getNumber(); + + TImageReaderGif *irm = new TImageReaderGif(m_path, index, this); + return TImageReaderP(irm); +} + +//------------------------------------------------------------------------------ + +TDimension TLevelReaderGif::getSize() { return m_size; } + +//------------------------------------------------ + +TImageP TLevelReaderGif::load(int frameIndex) { + return ffmpegReader->getImage(frameIndex); +} + +Tiio::GifWriterProperties::GifWriterProperties() + : m_scale("Scale", 1, 100, 100) + , m_looping("Looping", true) + , m_palette("Generate Palette", true) { + bind(m_scale); + bind(m_looping); + bind(m_palette); +} + +// Tiio::Reader* Tiio::makeGifReader(){ return nullptr; } +// Tiio::Writer* Tiio::makeGifWriter(){ return nullptr; } \ No newline at end of file diff --git a/toonz/sources/image/ffmpeg/tiio_gif.h b/toonz/sources/image/ffmpeg/tiio_gif.h new file mode 100644 index 0000000..844cf84 --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_gif.h @@ -0,0 +1,90 @@ +#pragma once + +#ifndef TTIO_GIF_INCLUDED +#define TTIO_GIF_INCLUDED + +#include "tproperty.h" +#include "tlevel_io.h" +#include "tiio_ffmpeg.h" +//#include "tthreadmessage.h" + +//=========================================================== +// +// TLevelWriterGif +// +//=========================================================== + +class TLevelWriterGif : public TLevelWriter { +public: + TLevelWriterGif(const TFilePath &path, TPropertyGroup *winfo); + ~TLevelWriterGif(); + // FfmpegBridge* ffmpeg; + void setFrameRate(double fps); + + TImageWriterP getFrameWriter(TFrameId fid) override; + void save(const TImageP &image, int frameIndex); + + void saveSoundTrack(TSoundTrack *st); + + static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) { + return new TLevelWriterGif(path, winfo); + } + +private: + Ffmpeg *ffmpegWriter; + int m_frameCount, m_lx, m_ly; + // double m_fps; + int m_scale; + bool m_looping = false; + bool m_palette = false; +}; + +//=========================================================== +// +// TLevelReaderGif +// +//=========================================================== + +class TLevelReaderGif final : public TLevelReader { +public: + TLevelReaderGif(const TFilePath &path); + ~TLevelReaderGif(); + TImageReaderP getFrameReader(TFrameId fid) override; + + static TLevelReader *create(const TFilePath &f) { + return new TLevelReaderGif(f); + } + + TLevelP loadInfo() override; + TImageP load(int frameIndex); + TDimension getSize(); + // TThread::Mutex m_mutex; + // void *m_decompressedBuffer; +private: + Ffmpeg *ffmpegReader; + TDimension m_size; + int m_frameCount, m_lx, m_ly; +}; + +//=========================================================================== + +namespace Tiio { + +//=========================================================================== + +class GifWriterProperties : public TPropertyGroup { +public: + TIntProperty m_scale; + TBoolProperty m_looping; + TBoolProperty m_palette; + GifWriterProperties(); +}; + +//=========================================================================== + +// Tiio::Reader *makeGifReader(); +// Tiio::Writer *makeGifWriter(); + +} // namespace + +#endif diff --git a/toonz/sources/image/ffmpeg/tiio_mp4.cpp b/toonz/sources/image/ffmpeg/tiio_mp4.cpp new file mode 100644 index 0000000..7c136a4 --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_mp4.cpp @@ -0,0 +1,220 @@ + +#include "tsystem.h" +#include "tiio_mp4.h" +#include "trasterimage.h" +#include "timageinfo.h" +#include "tsound.h" +#include + +//=========================================================== +// +// TImageWriterMp4 +// +//=========================================================== + +class TImageWriterMp4 : public TImageWriter { +public: + int m_frameIndex; + + TImageWriterMp4(const TFilePath &path, int frameIndex, TLevelWriterMp4 *lwg) + : TImageWriter(path), m_frameIndex(frameIndex), m_lwg(lwg) { + m_lwg->addRef(); + } + ~TImageWriterMp4() { m_lwg->release(); } + + bool is64bitOutputSupported() override { return false; } + void save(const TImageP &img) override { m_lwg->save(img, m_frameIndex); } + +private: + TLevelWriterMp4 *m_lwg; +}; + +//=========================================================== +// +// TLevelWriterMp4; +// +//=========================================================== + +TLevelWriterMp4::TLevelWriterMp4(const TFilePath &path, TPropertyGroup *winfo) + : TLevelWriter(path, winfo) { + if (!m_properties) m_properties = new Tiio::Mp4WriterProperties(); + std::string scale = m_properties->getProperty("Scale")->getValueAsString(); + m_scale = QString::fromStdString(scale).toInt(); + std::string quality = m_properties->getProperty("Quality")->getValueAsString(); + m_vidQuality = QString::fromStdString(quality).toInt(); + ffmpegWriter = new Ffmpeg(); + ffmpegWriter->setPath(m_path); + if (TSystem::doesExistFileOrLevel(m_path)) TSystem::deleteFile(m_path); +} + +//----------------------------------------------------------- + +TLevelWriterMp4::~TLevelWriterMp4() { + // QProcess createMp4; + QStringList preIArgs; + QStringList postIArgs; + + int outLx = m_lx; + int outLy = m_ly; + + // set scaling + if (m_scale != 0) { + outLx = m_lx * m_scale / 100; + outLy = m_ly * m_scale / 100; + } + //ffmpeg doesn't like resolutions that aren't divisible by 2. + if (outLx % 2 != 0) outLx++; + if (outLy % 2 != 0) outLy++; + + // calculate quality (bitrate) + int pixelCount = m_lx * m_ly; + int bitRate = pixelCount / 150; // crude but gets decent values + double quality = m_vidQuality / 100.0; + double tempRate = (double)bitRate * quality; + int finalBitrate = (int)tempRate; + int crf = 51 - (m_vidQuality * 51 / 100); + + preIArgs << "-framerate"; + preIArgs << QString::number(m_frameRate); + + postIArgs << "-pix_fmt"; + postIArgs << "yuv420p"; + postIArgs << "-s"; + postIArgs << QString::number(outLx) + "x" + QString::number(outLy); + postIArgs << "-b"; + postIArgs << QString::number(finalBitrate) + "k"; + + ffmpegWriter->runFfmpeg(preIArgs, postIArgs, false, false, true); + ffmpegWriter->cleanUpFiles(); +} + +//----------------------------------------------------------- + +TImageWriterP TLevelWriterMp4::getFrameWriter(TFrameId fid) { + // if (IOError != 0) + // throw TImageException(m_path, buildMp4ExceptionString(IOError)); + if (fid.getLetter() != 0) return TImageWriterP(0); + int index = fid.getNumber(); + TImageWriterMp4 *iwg = new TImageWriterMp4(m_path, index, this); + return TImageWriterP(iwg); +} + +//----------------------------------------------------------- +void TLevelWriterMp4::setFrameRate(double fps) { + m_frameRate = fps; + ffmpegWriter->setFrameRate(fps); +} + +void TLevelWriterMp4::saveSoundTrack(TSoundTrack *st) { + ffmpegWriter->saveSoundTrack(st); +} + +//----------------------------------------------------------- + +void TLevelWriterMp4::save(const TImageP &img, int frameIndex) { + TRasterImageP image(img); + m_lx = image->getRaster()->getLx(); + m_ly = image->getRaster()->getLy(); + ffmpegWriter->createIntermediateImage(img, frameIndex); +} + +//=========================================================== +// +// TImageReaderMp4 +// +//=========================================================== + +class TImageReaderMp4 final : public TImageReader { +public: + int m_frameIndex; + + TImageReaderMp4(const TFilePath &path, int index, TLevelReaderMp4 *lra) + : TImageReader(path), m_lra(lra), m_frameIndex(index) { + m_lra->addRef(); + } + ~TImageReaderMp4() { m_lra->release(); } + + TImageP load() override { return m_lra->load(m_frameIndex); } + TDimension getSize() const { return m_lra->getSize(); } + TRect getBBox() const { return TRect(); } + +private: + TLevelReaderMp4 *m_lra; + + // not implemented + TImageReaderMp4(const TImageReaderMp4 &); + TImageReaderMp4 &operator=(const TImageReaderMp4 &src); +}; + +//=========================================================== +// +// TLevelReaderMp4 +// +//=========================================================== + +TLevelReaderMp4::TLevelReaderMp4(const TFilePath &path) : TLevelReader(path) { + ffmpegReader = new Ffmpeg(); + ffmpegReader->setPath(m_path); + ffmpegReader->disablePrecompute(); + ffmpegFileInfo tempInfo = ffmpegReader->getInfo(); + double fps = tempInfo.m_frameRate; + m_frameCount = tempInfo.m_frameCount; + m_size = TDimension(tempInfo.m_lx, tempInfo.m_ly); + m_lx = m_size.lx; + m_ly = m_size.ly; + + ffmpegReader->getFramesFromMovie(); + + // set values + m_info = new TImageInfo(); + m_info->m_frameRate = fps; + m_info->m_lx = m_lx; + m_info->m_ly = m_ly; + m_info->m_bitsPerSample = 8; + m_info->m_samplePerPixel = 4; +} +//----------------------------------------------------------- + +TLevelReaderMp4::~TLevelReaderMp4() { + // ffmpegReader->cleanUpFiles(); +} + +//----------------------------------------------------------- + +TLevelP TLevelReaderMp4::loadInfo() { + if (m_frameCount == -1) return TLevelP(); + TLevelP level; + for (int i = 1; i <= m_frameCount; i++) level->setFrame(i, TImageP()); + return level; +} + +//----------------------------------------------------------- + +TImageReaderP TLevelReaderMp4::getFrameReader(TFrameId fid) { + // if (IOError != 0) + // throw TImageException(m_path, buildAVIExceptionString(IOError)); + if (fid.getLetter() != 0) return TImageReaderP(0); + int index = fid.getNumber(); + + TImageReaderMp4 *irm = new TImageReaderMp4(m_path, index, this); + return TImageReaderP(irm); +} + +//------------------------------------------------------------------------------ + +TDimension TLevelReaderMp4::getSize() { return m_size; } + +//------------------------------------------------ + +TImageP TLevelReaderMp4::load(int frameIndex) { + return ffmpegReader->getImage(frameIndex); +} + +Tiio::Mp4WriterProperties::Mp4WriterProperties() + : m_vidQuality("Quality", 1, 100, 90), m_scale("Scale", 1, 100, 100) { + bind(m_vidQuality); + bind(m_scale); +} + +// Tiio::Reader* Tiio::makeMp4Reader(){ return nullptr; } +// Tiio::Writer* Tiio::makeMp4Writer(){ return nullptr; } \ No newline at end of file diff --git a/toonz/sources/image/ffmpeg/tiio_mp4.h b/toonz/sources/image/ffmpeg/tiio_mp4.h new file mode 100644 index 0000000..97b4f75 --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_mp4.h @@ -0,0 +1,88 @@ +#pragma once + +#ifndef TTIO_MP4_INCLUDED +#define TTIO_MP4_INCLUDED + +#include "tproperty.h" +#include "tlevel_io.h" +#include "tiio_ffmpeg.h" + +//=========================================================== +// +// TLevelWriterMp4 +// +//=========================================================== + +class TLevelWriterMp4 : public TLevelWriter { +public: + TLevelWriterMp4(const TFilePath &path, TPropertyGroup *winfo); + ~TLevelWriterMp4(); + void setFrameRate(double fps); + + TImageWriterP getFrameWriter(TFrameId fid) override; + void save(const TImageP &image, int frameIndex); + + void saveSoundTrack(TSoundTrack *st); + + static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) { + return new TLevelWriterMp4(path, winfo); + } + +private: + Ffmpeg *ffmpegWriter; + int m_lx, m_ly; + int m_scale; + int m_vidQuality; + // void *m_buffer; +}; + +//=========================================================== +// +// TLevelReaderMp4 +// +//=========================================================== + +class TLevelReaderMp4 final : public TLevelReader { +public: + TLevelReaderMp4(const TFilePath &path); + ~TLevelReaderMp4(); + TImageReaderP getFrameReader(TFrameId fid) override; + + static TLevelReader *create(const TFilePath &f) { + return new TLevelReaderMp4(f); + } + + TLevelP loadInfo() override; + TImageP load(int frameIndex); + TDimension getSize(); + // TThread::Mutex m_mutex; + // void *m_decompressedBuffer; +private: + Ffmpeg *ffmpegReader; + TDimension m_size; + int m_frameCount, m_lx, m_ly; +}; + +//=========================================================================== + +namespace Tiio { + +//=========================================================================== + +class Mp4WriterProperties : public TPropertyGroup { +public: + // TEnumProperty m_pixelSize; + // TBoolProperty m_matte; + TIntProperty m_vidQuality; + TIntProperty m_scale; + Mp4WriterProperties(); +}; + +//=========================================================================== + +// Tiio::Reader *makeMp4Reader(); +// Tiio::Writer *makeMp4Writer(); + +} // namespace + +#endif diff --git a/toonz/sources/image/ffmpeg/tiio_webm.cpp b/toonz/sources/image/ffmpeg/tiio_webm.cpp new file mode 100644 index 0000000..cd157e2 --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_webm.cpp @@ -0,0 +1,224 @@ + +#include "tiio_webm.h" +#include "tsystem.h" +#include "trasterimage.h" +#include "tsound.h" +#include "timageinfo.h" +#include + +//=========================================================== +// +// TImageWriterWebm +// +//=========================================================== + +class TImageWriterWebm : public TImageWriter { +public: + int m_frameIndex; + + TImageWriterWebm(const TFilePath &path, int frameIndex, TLevelWriterWebm *lwg) + : TImageWriter(path), m_frameIndex(frameIndex), m_lwg(lwg) { + m_lwg->addRef(); + } + ~TImageWriterWebm() { m_lwg->release(); } + + bool is64bitOutputSupported() override { return false; } + void save(const TImageP &img) override { m_lwg->save(img, m_frameIndex); } + +private: + TLevelWriterWebm *m_lwg; +}; + +//=========================================================== +// +// TLevelWriterWebm; +// +//=========================================================== + +TLevelWriterWebm::TLevelWriterWebm(const TFilePath &path, TPropertyGroup *winfo) + : TLevelWriter(path, winfo) { + if (!m_properties) m_properties = new Tiio::WebmWriterProperties(); + std::string scale = m_properties->getProperty("Scale")->getValueAsString(); + m_scale = QString::fromStdString(scale).toInt(); + std::string quality = m_properties->getProperty("Quality")->getValueAsString(); + m_vidQuality = QString::fromStdString(quality).toInt(); + ffmpegWriter = new Ffmpeg(); + ffmpegWriter->setPath(m_path); + if (TSystem::doesExistFileOrLevel(m_path)) TSystem::deleteFile(m_path); +} + +//----------------------------------------------------------- + +TLevelWriterWebm::~TLevelWriterWebm() { + // QProcess createWebm; + QStringList preIArgs; + QStringList postIArgs; + + int outLx = m_lx; + int outLy = m_ly; + + // set scaling + if (m_scale != 0) { + outLx = m_lx * m_scale / 100; + outLy = m_ly * m_scale / 100; + } + //ffmpeg doesn't like resolutions that aren't divisible by 2. + if (outLx % 2 != 0) outLx++; + if (outLy % 2 != 0) outLy++; + + // calculate quality (bitrate) + int pixelCount = m_lx * m_ly; + int bitRate = pixelCount / 150; // crude but gets decent values + double quality = m_vidQuality / 100.0; + double tempRate = (double)bitRate * quality; + int finalBitrate = (int)tempRate; + int crf = 51 - (m_vidQuality * 51 / 100); + + preIArgs << "-framerate"; + preIArgs << QString::number(m_frameRate); + + postIArgs << "-c:v"; + postIArgs << "libvpx"; + postIArgs << "-s"; + postIArgs << QString::number(outLx) + "x" + QString::number(outLy); + postIArgs << "-b"; + postIArgs << QString::number(finalBitrate) + "k"; + postIArgs << "-speed"; + postIArgs << "3"; + postIArgs << "-quality"; + postIArgs << "good"; + + ffmpegWriter->runFfmpeg(preIArgs, postIArgs, false, false, true); + ffmpegWriter->cleanUpFiles(); +} + +//----------------------------------------------------------- + +TImageWriterP TLevelWriterWebm::getFrameWriter(TFrameId fid) { + // if (IOError != 0) + // throw TImageException(m_path, buildGifExceptionString(IOError)); + if (fid.getLetter() != 0) return TImageWriterP(0); + int index = fid.getNumber(); + TImageWriterWebm *iwg = new TImageWriterWebm(m_path, index, this); + return TImageWriterP(iwg); +} + +//----------------------------------------------------------- +void TLevelWriterWebm::setFrameRate(double fps) { + m_frameRate = fps; + ffmpegWriter->setFrameRate(fps); +} + +void TLevelWriterWebm::saveSoundTrack(TSoundTrack *st) { + ffmpegWriter->saveSoundTrack(st); +} + +//----------------------------------------------------------- + +void TLevelWriterWebm::save(const TImageP &img, int frameIndex) { + TRasterImageP image(img); + m_lx = image->getRaster()->getLx(); + m_ly = image->getRaster()->getLy(); + ffmpegWriter->createIntermediateImage(img, frameIndex); +} + +//=========================================================== +// +// TImageReaderWebm +// +//=========================================================== + +class TImageReaderWebm final : public TImageReader { +public: + int m_frameIndex; + + TImageReaderWebm(const TFilePath &path, int index, TLevelReaderWebm *lra) + : TImageReader(path), m_lra(lra), m_frameIndex(index) { + m_lra->addRef(); + } + ~TImageReaderWebm() { m_lra->release(); } + + TImageP load() override { return m_lra->load(m_frameIndex); } + TDimension getSize() const { return m_lra->getSize(); } + TRect getBBox() const { return TRect(); } + +private: + TLevelReaderWebm *m_lra; + + // not implemented + TImageReaderWebm(const TImageReaderWebm &); + TImageReaderWebm &operator=(const TImageReaderWebm &src); +}; + +//=========================================================== +// +// TLevelReaderWebm +// +//=========================================================== + +TLevelReaderWebm::TLevelReaderWebm(const TFilePath &path) : TLevelReader(path) { + ffmpegReader = new Ffmpeg(); + ffmpegReader->setPath(m_path); + ffmpegReader->disablePrecompute(); + ffmpegFileInfo tempInfo = ffmpegReader->getInfo(); + double fps = tempInfo.m_frameRate; + m_frameCount = tempInfo.m_frameCount; + m_size = TDimension(tempInfo.m_lx, tempInfo.m_ly); + m_lx = m_size.lx; + m_ly = m_size.ly; + + ffmpegReader->getFramesFromMovie(); + + // set values + m_info = new TImageInfo(); + m_info->m_frameRate = fps; + m_info->m_lx = m_lx; + m_info->m_ly = m_ly; + m_info->m_bitsPerSample = 8; + m_info->m_samplePerPixel = 4; +} +//----------------------------------------------------------- + +TLevelReaderWebm::~TLevelReaderWebm() { + // ffmpegReader->cleanUpFiles(); +} + +//----------------------------------------------------------- + +TLevelP TLevelReaderWebm::loadInfo() { + if (m_frameCount == -1) return TLevelP(); + TLevelP level; + for (int i = 1; i <= m_frameCount; i++) level->setFrame(i, TImageP()); + return level; +} + +//----------------------------------------------------------- + +TImageReaderP TLevelReaderWebm::getFrameReader(TFrameId fid) { + // if (IOError != 0) + // throw TImageException(m_path, buildAVIExceptionString(IOError)); + if (fid.getLetter() != 0) return TImageReaderP(0); + int index = fid.getNumber(); + + TImageReaderWebm *irm = new TImageReaderWebm(m_path, index, this); + return TImageReaderP(irm); +} + +//------------------------------------------------------------------------------ + +TDimension TLevelReaderWebm::getSize() { return m_size; } + +//------------------------------------------------ + +TImageP TLevelReaderWebm::load(int frameIndex) { + return ffmpegReader->getImage(frameIndex); +} + +Tiio::WebmWriterProperties::WebmWriterProperties() + : m_vidQuality("Quality", 1, 100, 90), m_scale("Scale", 1, 100, 100) { + bind(m_vidQuality); + bind(m_scale); +} + +// Tiio::Reader* Tiio::makeWebmReader(){ return nullptr; } +// Tiio::Writer* Tiio::makeWebmWriter(){ return nullptr; } \ No newline at end of file diff --git a/toonz/sources/image/ffmpeg/tiio_webm.h b/toonz/sources/image/ffmpeg/tiio_webm.h new file mode 100644 index 0000000..332db6e --- /dev/null +++ b/toonz/sources/image/ffmpeg/tiio_webm.h @@ -0,0 +1,88 @@ +#pragma once + +#ifndef TTIO_WEBM_INCLUDED +#define TTIO_WEBM_INCLUDED + +#include "tproperty.h" +#include "tlevel_io.h" +#include "tiio_ffmpeg.h" + +//=========================================================== +// +// TLevelWriterWebm +// +//=========================================================== + +class TLevelWriterWebm : public TLevelWriter { +public: + TLevelWriterWebm(const TFilePath &path, TPropertyGroup *winfo); + ~TLevelWriterWebm(); + void setFrameRate(double fps); + + TImageWriterP getFrameWriter(TFrameId fid) override; + void save(const TImageP &image, int frameIndex); + + void saveSoundTrack(TSoundTrack *st); + + static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) { + return new TLevelWriterWebm(path, winfo); + } + +private: + Ffmpeg *ffmpegWriter; + int m_lx, m_ly; + int m_scale; + int m_vidQuality; + // void *m_buffer; +}; + +//=========================================================== +// +// TLevelReaderWebm +// +//=========================================================== + +class TLevelReaderWebm final : public TLevelReader { +public: + TLevelReaderWebm(const TFilePath &path); + ~TLevelReaderWebm(); + TImageReaderP getFrameReader(TFrameId fid) override; + + static TLevelReader *create(const TFilePath &f) { + return new TLevelReaderWebm(f); + } + + TLevelP loadInfo() override; + TImageP load(int frameIndex); + TDimension getSize(); + // TThread::Mutex m_mutex; + // void *m_decompressedBuffer; +private: + Ffmpeg *ffmpegReader; + TDimension m_size; + int m_frameCount, m_lx, m_ly; +}; + +//=========================================================================== + +namespace Tiio { + +//=========================================================================== + +class WebmWriterProperties : public TPropertyGroup { +public: + // TEnumProperty m_pixelSize; + // TBoolProperty m_matte; + TIntProperty m_vidQuality; + TIntProperty m_scale; + WebmWriterProperties(); +}; + +//=========================================================================== + +// Tiio::Reader *makeWebmReader(); +// Tiio::Writer *makeWebmWriter(); + +} // namespace + +#endif diff --git a/toonz/sources/image/mesh/tiio_mesh.h b/toonz/sources/image/mesh/tiio_mesh.h index f49cae0..f515232 100644 --- a/toonz/sources/image/mesh/tiio_mesh.h +++ b/toonz/sources/image/mesh/tiio_mesh.h @@ -49,4 +49,4 @@ private: TLevelReaderMesh &operator=(const TLevelReaderMesh &); }; -#endif /* TIIO_MESH_H */ +#endif /* TIIO_MESH_H */ diff --git a/toonz/sources/image/pli/pli_io.cpp b/toonz/sources/image/pli/pli_io.cpp index d6f97f8..b8c37a3 100644 --- a/toonz/sources/image/pli/pli_io.cpp +++ b/toonz/sources/image/pli/pli_io.cpp @@ -67,7 +67,7 @@ inline double doubleFromUlong1(TUINT32 hi, TUINT32 lo) { /*=====================================================================*/ -TThickPoint operator*(const TAffine &aff, const TThickPoint &p) { +static TThickPoint operator*(const TAffine &aff, const TThickPoint &p) { TPointD p1(p.x, p.y); return TThickPoint(aff * p1, p.thick); } diff --git a/toonz/sources/image/pli/tiio_pli.cpp b/toonz/sources/image/pli/tiio_pli.cpp index f0f51c7..1650067 100644 --- a/toonz/sources/image/pli/tiio_pli.cpp +++ b/toonz/sources/image/pli/tiio_pli.cpp @@ -277,7 +277,7 @@ TImageP TImageReaderPli::load() { //=========================================================================== -void readRegionVersion4x(IntersectionDataTag *tag, TVectorImage *img) { +static void readRegionVersion4x(IntersectionDataTag *tag, TVectorImage *img) { #ifndef NEW_REGION_FILL img->setFillData(tag->m_branchArray, tag->m_branchCount); #endif @@ -316,7 +316,7 @@ void createStroke(ThickQuadraticChainTag *quadTag, TVectorImage *outVectImage, //----------------------------------------------------------------------------- -void createGroup(GroupTag *groupTag, TVectorImage *vi, CreateStrokeData &data) { +static void createGroup(GroupTag *groupTag, TVectorImage *vi, CreateStrokeData &data) { int count = vi->getStrokeCount(); for (int j = 0; j < groupTag->m_numObjects; j++) { if (groupTag->m_object[j]->m_type == PliTag::COLOR_NGOBJ) @@ -443,8 +443,8 @@ TImageWriterPli::TImageWriterPli(const TFilePath &f, const TFrameId &frameId, //----------------------------------------------------------------------------- -void putStroke(TStroke *stroke, int &currStyleId, - std::vector &tags) { +static void putStroke(TStroke *stroke, int &currStyleId, + std::vector &tags) { double maxThickness = 0; assert(stroke); diff --git a/toonz/sources/image/pli/tiio_pli.h b/toonz/sources/image/pli/tiio_pli.h index 2a35e62..418e791 100644 --- a/toonz/sources/image/pli/tiio_pli.h +++ b/toonz/sources/image/pli/tiio_pli.h @@ -7,6 +7,7 @@ #include "tlevel_io.h" +class GroupTag; class ParsedPli; class ImageTag; class TImageWriterPli; @@ -149,4 +150,9 @@ private: TLevelReaderPli *m_lrp; }; +// Functions + +TPalette *readPalette(GroupTag *paletteTag, int majorVersion, + int minorVersion); + #endif // TTIO_PLI_INCLUDED diff --git a/toonz/sources/image/png/tiio_png.cpp b/toonz/sources/image/png/tiio_png.cpp index 674b489..f824d5d 100644 --- a/toonz/sources/image/png/tiio_png.cpp +++ b/toonz/sources/image/png/tiio_png.cpp @@ -20,9 +20,9 @@ using namespace std; extern "C" { -void tnz_abort(jmp_buf, int) {} +static void tnz_abort(jmp_buf, int) {} -void tnz_error_fun(png_structp pngPtr, png_const_charp error_message) { +static void tnz_error_fun(png_structp pngPtr, png_const_charp error_message) { *(int *)png_get_error_ptr(pngPtr) = 0; } } @@ -37,22 +37,18 @@ void tnz_error_fun(png_structp pngPtr, png_const_charp error_message) { #if defined(PNG_LIBPNG_VER) #if (PNG_LIBPNG_VER < 10527) extern "C" { -static png_uint_32 png_get_current_row_number(const png_structp png_ptr) -{ - /* See the comments in png.h - this is the sub-image row when reading and - * interlaced image. - */ - if (png_ptr != NULL) - return png_ptr->row_number; +static png_uint_32 png_get_current_row_number(const png_structp png_ptr) { + /* See the comments in png.h - this is the sub-image row when reading and + * interlaced image. + */ + if (png_ptr != NULL) return png_ptr->row_number; - return PNG_UINT_32_MAX; /* help the app not to fail silently */ + return PNG_UINT_32_MAX; /* help the app not to fail silently */ } -static png_byte png_get_current_pass_number(const png_structp png_ptr) -{ - if (png_ptr != NULL) - return png_ptr->pass; - return 8; /* invalid */ +static png_byte png_get_current_pass_number(const png_structp png_ptr) { + if (png_ptr != NULL) return png_ptr->pass; + return 8; /* invalid */ } } #endif @@ -60,10 +56,9 @@ static png_byte png_get_current_pass_number(const png_structp png_ptr) #error "PNG_LIBPNG_VER undefined, libpng too old?" #endif - //========================================================= +//========================================================= - inline USHORT - mySwap(USHORT val) { +inline USHORT mySwap(USHORT val) { #if TNZ_LITTLE_ENDIAN return ((val) | ((val & 0xff) << 8)); //((val>>8)|((val&0xff)<<8)); (vecchio codice) @@ -141,8 +136,8 @@ public: #if (PNG_LIBPNG_VER >= 10527) png_set_longjmp_fn(m_png_ptr, tnz_abort, sizeof(jmp_buf)); /* ignore all fatal errors */ -#endif // (PNG_LIBPNG_VER >= 10527) -#endif // defined(PNG_LIBPNG_VER) +#endif // (PNG_LIBPNG_VER >= 10527) +#endif // defined(PNG_LIBPNG_VER) m_canDelete = 1; m_info_ptr = png_create_info_struct(m_png_ptr); diff --git a/toonz/sources/image/quantel/filequantel.c b/toonz/sources/image/quantel/filequantel.c index 9159d14..250c0e5 100644 --- a/toonz/sources/image/quantel/filequantel.c +++ b/toonz/sources/image/quantel/filequantel.c @@ -88,7 +88,7 @@ static IMAGE *img_read_region_quantel_interlaced(T_CHAR *fname, int x1, int y1, /*---------------------------------------------------------------------------*/ -static void vpb_string(char *str, int field_type, char **p_h, char *stop) { +static void vpb_string(const char *str, int field_type, char **p_h, char *stop) { char *h; int len; @@ -536,8 +536,8 @@ int img_write_quantel(const T_CHAR *fname, void *buffer, int w, int h, /*---------------------------------------------------------------------------*/ -IMAGE *img_read_region_quantel(T_CHAR *fname, int x1, int y1, int x2, int y2, - int scale, int type) { +static IMAGE *img_read_region_quantel(T_CHAR *fname, int x1, int y1, int x2, int y2, + int scale, int type) { if (type == SDL_FORMAT) return (img_read_region_quantel_no_interlaced(fname, x1, y1, x2, y2, scale, type)); diff --git a/toonz/sources/image/sgi/filesgi.cpp b/toonz/sources/image/sgi/filesgi.cpp index 23e23b5..b045eb1 100644 --- a/toonz/sources/image/sgi/filesgi.cpp +++ b/toonz/sources/image/sgi/filesgi.cpp @@ -722,7 +722,7 @@ static TINT32 img_rle_compact(unsigned short *expbuf, int ibpp, /*-----------------------------------------------------------------------------*/ -void iclose(IMAGERGB *image) { +static void iclose(IMAGERGB *image) { TINT32 tablesize; iflush(image); diff --git a/toonz/sources/image/svg/tiio_svg.cpp b/toonz/sources/image/svg/tiio_svg.cpp index 496051d..21a344e 100644 --- a/toonz/sources/image/svg/tiio_svg.cpp +++ b/toonz/sources/image/svg/tiio_svg.cpp @@ -1809,7 +1809,7 @@ TLevelWriterSvg::TLevelWriterSvg(const TFilePath &path, TPropertyGroup *winfo) //----------------------------------------------------------------------------- -void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, double ly) { +static void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, double ly) { if (r->getEdgeCount() == 0) return; std::vector quadsOutline; @@ -1872,8 +1872,8 @@ void writeRegion(TRegion *r, TPalette *plt, QTextStream &out, double ly) { //-------------------------------------------------------------------------------------- -void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly, - double quality) { +static void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly, + double quality) { if (s->getChunkCount() == 0) return; if (s->getMaxThickness() == 0) return; @@ -1898,7 +1898,7 @@ void writeOutlineStroke(TStroke *s, TPalette *plt, QTextStream &out, double ly, //---------------------------------------------------------- -double computeAverageThickness(const TStroke *s) { +static double computeAverageThickness(const TStroke *s) { int count = s->getControlPointCount(); double resThick = 0; @@ -1914,8 +1914,8 @@ double computeAverageThickness(const TStroke *s) { //---------------------------------------------------------------- -void writeCenterlineStroke(TStroke *s, TPalette *plt, QTextStream &out, - double ly) { +static void writeCenterlineStroke(TStroke *s, TPalette *plt, QTextStream &out, + double ly) { if (s->getChunkCount() == 0) return; if (s->getMaxThickness() == 0) return; diff --git a/toonz/sources/image/tga/tiio_tga.cpp b/toonz/sources/image/tga/tiio_tga.cpp index d1f2647..371189e 100644 --- a/toonz/sources/image/tga/tiio_tga.cpp +++ b/toonz/sources/image/tga/tiio_tga.cpp @@ -70,7 +70,7 @@ struct TgaHeader { //============================================================ -void readTgaHeader(TgaHeader &header, FILE *chan) { +static void readTgaHeader(TgaHeader &header, FILE *chan) { header.IdentificationField = fgetc(chan); header.ColorMapType = fgetc(chan); header.ImageTypeCode = fgetc(chan); @@ -87,7 +87,7 @@ void readTgaHeader(TgaHeader &header, FILE *chan) { //------------------------------------------------------------ -void writeTgaHeader(TgaHeader &header, FILE *chan) { +static void writeTgaHeader(TgaHeader &header, FILE *chan) { fputc(header.IdentificationField, chan); fputc(header.ColorMapType, chan); fputc(header.ImageTypeCode, chan); diff --git a/toonz/sources/image/tiio.cpp b/toonz/sources/image/tiio.cpp index 6bb963c..b6a888b 100644 --- a/toonz/sources/image/tiio.cpp +++ b/toonz/sources/image/tiio.cpp @@ -72,6 +72,9 @@ #include "./pli/tiio_pli.h" #include "./tzl/tiio_tzl.h" #include "./svg/tiio_svg.h" +#include "./ffmpeg/tiio_gif.h" +#include "./ffmpeg/tiio_webm.h" +#include "./ffmpeg/tiio_mp4.h" #include "./mesh/tiio_mesh.h" //------------------------------------------------------------------- @@ -159,6 +162,35 @@ void initImageIo(bool lightVersion) { TFileType::declare("rgb", TFileType::RASTER_IMAGE); Tiio::defineWriterProperties("rgb", new Tiio::SgiWriterProperties()); + // ffmpeg +#if !defined(_WIN32) || defined(x64) + if (Ffmpeg::checkFfmpeg()) { + bool ffprobe = Ffmpeg::checkFfprobe(); + if (Ffmpeg::checkFormat("webm")) { + TLevelWriter::define("webm", TLevelWriterWebm::create, true); + if (ffprobe) + TLevelReader::define("webm", TLevelReaderWebm::create); + TFileType::declare("webm", TFileType::RASTER_LEVEL); + Tiio::defineWriterProperties("webm", new Tiio::WebmWriterProperties()); + } + if (Ffmpeg::checkFormat("gif")) { + TLevelWriter::define("gif", TLevelWriterGif::create, true); + if (ffprobe) + TLevelReader::define("gif", TLevelReaderGif::create); + TFileType::declare("gif", TFileType::RASTER_LEVEL); + Tiio::defineWriterProperties("gif", new Tiio::GifWriterProperties()); + } + if (Ffmpeg::checkFormat("mp4")) { + TLevelWriter::define("mp4", TLevelWriterMp4::create, true); + if (ffprobe) + TLevelReader::define("mp4", TLevelReaderMp4::create); + TFileType::declare("mp4", TFileType::RASTER_LEVEL); + Tiio::defineWriterProperties("mp4", new Tiio::Mp4WriterProperties()); + } + } +#endif + // end ffmpeg + if (!lightVersion) { #ifdef _WIN32 diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cpp index 76efb06..f64cfe5 100644 --- a/toonz/sources/image/tzl/tiio_tzl.cpp +++ b/toonz/sources/image/tzl/tiio_tzl.cpp @@ -42,15 +42,15 @@ char *reverse(char *buffer, int size) { } } -int tfwrite(const char *data, const unsigned int count, FILE *f) { +static int tfwrite(const char *data, const unsigned int count, FILE *f) { return fwrite(data, sizeof(char), count, f); } -int tfwrite(UCHAR *data, const unsigned int count, FILE *f) { +static int tfwrite(UCHAR *data, const unsigned int count, FILE *f) { return fwrite(data, sizeof(char), count, f); } -int tfwrite(TINT32 *data, const unsigned int count, FILE *f) { +static int tfwrite(TINT32 *data, const unsigned int count, FILE *f) { if (count == 1) { #if !TNZ_LITTLE_ENDIAN TUINT32 dataToWrite = swapTINT32(*data); @@ -63,7 +63,7 @@ int tfwrite(TINT32 *data, const unsigned int count, FILE *f) { return 0; } -int tfwrite(TUINT32 *data, const unsigned int count, FILE *f) { +static int tfwrite(TUINT32 *data, const unsigned int count, FILE *f) { if (count == 1) { #if !TNZ_LITTLE_ENDIAN TUINT32 dataToWrite = swapTINT32(*data); @@ -76,7 +76,7 @@ int tfwrite(TUINT32 *data, const unsigned int count, FILE *f) { return 0; } -int tfwrite(double *data, unsigned int count, FILE *f) { +static int tfwrite(double *data, unsigned int count, FILE *f) { if (count == 1) { double v = *data; char *ptr = (char *)&v; @@ -286,8 +286,8 @@ bool readHeaderAndOffsets(FILE *chan, TzlOffsetMap &frameOffsTable, } } -bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, - TDimension imageRes) { +static bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, + TDimension imageRes) { TINT32 iconLx = inDimension.lx, iconLy = inDimension.ly; assert(iconLx > 0 && iconLy > 0); assert(imageRes.lx > 0 && imageRes.ly > 0); @@ -305,7 +305,7 @@ bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, return true; } -void getThumbnail(TRasterP ras, int shrink, TRasterP &thumbnail) { +static void getThumbnail(TRasterP ras, int shrink, TRasterP &thumbnail) { int j = 0; int y = 0; TPixel32 *pix2 = (TPixel32 *)thumbnail->getRawData(); @@ -1995,8 +1995,8 @@ TImageP TImageReaderTzl::load13() { } // Restituisce la regione del raster shrinkata e la relativa savebox. -TRect applyShrinkAndRegion(TRasterP &ras, int shrink, TRect region, - TRect savebox) { +static TRect applyShrinkAndRegion(TRasterP &ras, int shrink, TRect region, + TRect savebox) { // estraggo la regione solo se essa ha coordinate valide. if (!region.isEmpty() && region != TRect() && region.getLx() > 0 && region.getLy() > 0) diff --git a/toonz/sources/image/tzp/avl.c b/toonz/sources/image/tzp/avl.c index 8f974d3..1a7e1e7 100644 --- a/toonz/sources/image/tzp/avl.c +++ b/toonz/sources/image/tzp/avl.c @@ -1841,7 +1841,7 @@ typedef struct { CDB_PARAM *param; } CDB_EFFECT; -char *strsave(const char *str) { +static char *strsave(const char *str) { char *neww; if (!str) return 0; neww = malloc(strlen(str) + 1); @@ -1852,7 +1852,7 @@ char *strsave(const char *str) { /*---------------------------------------------------------------------------*/ -char *strnsave(const char *str, int n) { +static char *strnsave(const char *str, int n) { char *neww; neww = malloc(n + 1); diff --git a/toonz/sources/image/tzp/tiio_plt.cpp b/toonz/sources/image/tzp/tiio_plt.cpp index 49e983e..db0cd36 100644 --- a/toonz/sources/image/tzp/tiio_plt.cpp +++ b/toonz/sources/image/tzp/tiio_plt.cpp @@ -76,8 +76,8 @@ PltReader::~PltReader() { delete m_stripBuffer; } //------------------------------------------------------------ -int decode_group_name(char group_name[], char **name, int *key, - int *sister_index) { +static int decode_group_name(char group_name[], char **name, int *key, + int *sister_index) { char *s, *t; *key = 0; *sister_index = -1; diff --git a/toonz/sources/include/tdoubleparam.h b/toonz/sources/include/tdoubleparam.h index 5fe50e5..f5412ca 100644 --- a/toonz/sources/include/tdoubleparam.h +++ b/toonz/sources/include/tdoubleparam.h @@ -156,6 +156,10 @@ public: std::string getValueAlias(double frame, int precision) override; }; +DV_IMPORT_API void splitSpeedInOutSegment(TDoubleKeyframe &k, + TDoubleKeyframe &k0, + TDoubleKeyframe &k1); + //--------------------------------------------------------- DEFINE_PARAM_SMARTPOINTER(TDoubleParam, double) diff --git a/toonz/sources/include/tlevel_io.h b/toonz/sources/include/tlevel_io.h index 4713788..63e274e 100644 --- a/toonz/sources/include/tlevel_io.h +++ b/toonz/sources/include/tlevel_io.h @@ -226,7 +226,8 @@ public: // Some useful utility inlines inline bool isMovieType(std::string type) { - return (type == "mov" || type == "avi" || type == "3gp"); + return (type == "mov" || type == "avi" || type == "3gp" || type == "webm" || + type == "mp4"); } //----------------------------------------------------------- diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 188526a..f1b39fd 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -380,6 +380,14 @@ public: bool isAutomaticSVNFolderRefreshEnabled() const { return m_automaticSVNFolderRefreshEnabled; } + // Import Export Tab + + void setFfmpegPath(std::string path); + QString getFfmpegPath() const { return m_ffmpegPath; } + void setPrecompute(bool enabled); + bool getPrecompute() { return m_precompute; } + void setFfmpegTimeout(int seconds); + int getFfmpegTimeout() { return m_ffmpegTimeout; } // Uncategorized - internals @@ -419,7 +427,8 @@ private: std::vector m_levelFormats; QString m_units, m_cameraUnits, m_scanLevelType, m_currentRoomChoice, - m_oldUnits, m_oldCameraUnits; + m_oldUnits, m_oldCameraUnits, m_ffmpegPath; + ; double m_defLevelWidth, m_defLevelHeight, m_defLevelDpi; @@ -430,7 +439,8 @@ private: int m_autosavePeriod, // minutes m_chunkSize, m_blanksCount, m_onionPaperThickness, m_step, m_shrink, - m_textureSize, m_autocreationType, m_keyframeType, m_animationStep; + m_textureSize, m_autocreationType, m_keyframeType, m_animationStep, + m_ffmpegTimeout; //seconds int m_currentLanguage, m_currentStyleSheet, m_undoMemorySize, // in megabytes @@ -471,6 +481,7 @@ private: bool m_moveCurrentFrameByClickCellArea; bool m_onionSkinEnabled; bool m_multiLayerStylePickerEnabled; + bool m_precompute; /*-- Color Modelにラスタ画像を読み込んだとき、パレットをどのように作るか 0 : 全ての異なるピクセルの色を別のStyleにする, 1 : diff --git a/toonz/sources/include/tpersistset.h b/toonz/sources/include/tpersistset.h index b787905..e72ad0c 100644 --- a/toonz/sources/include/tpersistset.h +++ b/toonz/sources/include/tpersistset.h @@ -37,7 +37,7 @@ public: return m_objects; } //!< Returns the stored objects list - void insert(std::auto_ptr + void insert(std::unique_ptr object); //!< Overwrites an object type instance with //! the supplied one. public: diff --git a/toonz/sources/include/tspectrum.h b/toonz/sources/include/tspectrum.h index 65063d4..c41c445 100644 --- a/toonz/sources/include/tspectrum.h +++ b/toonz/sources/include/tspectrum.h @@ -172,6 +172,8 @@ updateTable(sampleCount); } }; +DVAPI TSpectrumT convert(const TSpectrumT &s); + #ifdef _WIN32 template class DVAPI TSpectrumT; template class DVAPI TSpectrumT; diff --git a/toonz/sources/sound/CMakeLists.txt b/toonz/sources/sound/CMakeLists.txt index 7769163..668fa13 100644 --- a/toonz/sources/sound/CMakeLists.txt +++ b/toonz/sources/sound/CMakeLists.txt @@ -3,14 +3,16 @@ set(HEADERS aiff/tsio_aiff.h raw/tsio_raw.h ../include/tnzsound.h - tsio.h) + tsio.h +) set(SOURCES tsio.cpp tsioutils.cpp wav/tsio_wav.cpp aiff/tsio_aiff.cpp - raw/tsio_raw.cpp) + raw/tsio_raw.cpp +) add_library(sound SHARED ${HEADERS} ${SOURCES}) add_definitions( diff --git a/toonz/sources/sound/aiff/tsio_aiff.cpp b/toonz/sources/sound/aiff/tsio_aiff.cpp index 7122a9c..cdcccf2 100644 --- a/toonz/sources/sound/aiff/tsio_aiff.cpp +++ b/toonz/sources/sound/aiff/tsio_aiff.cpp @@ -5,7 +5,7 @@ #include "tsound_t.h" #include "tsystem.h" #include "tfilepath_io.h" -#include "tfilepath_io.h" +#include "tsioutils.h" #include #define DEFAULT_OFFSET 0 @@ -21,7 +21,6 @@ TNZ_LITTLE_ENDIAN undefined !! using namespace std; -void swapAndCopySamples(short *srcBuffer, short *dstBuffer, TINT32 sampleCount); TUINT32 convertToLong(UCHAR *buffer); void storeFloat(unsigned char *buffer, TUINT32 value); @@ -136,7 +135,7 @@ public: //-------------------------------------------------------------------- -ostream &operator<<(ostream &os, const TCOMMChunk &commChunk) { +static ostream &operator<<(ostream &os, const TCOMMChunk &commChunk) { commChunk.print(os); return os; } @@ -191,7 +190,7 @@ public: //-------------------------------------------------------------------- -ostream &operator<<(ostream &os, const TSSNDChunk &ssndChunk) { +static ostream &operator<<(ostream &os, const TSSNDChunk &ssndChunk) { os << "name = '" << ssndChunk.m_name << endl; os << "length = '" << ssndChunk.m_length << endl; os << "offset = '" << (unsigned int)ssndChunk.m_offset << endl; @@ -208,7 +207,7 @@ ostream &operator<<(ostream &os, const TSSNDChunk &ssndChunk) { //========================================================== -void flipLong(unsigned char *ptrc) { +static void flipLong(unsigned char *ptrc) { unsigned char val; val = *(ptrc); @@ -222,7 +221,7 @@ void flipLong(unsigned char *ptrc) { //-------------------------------------------------------------------- -TUINT32 fetchLong(TUINT32 *ptrl) { return (*ptrl); } +static TUINT32 fetchLong(TUINT32 *ptrl) { return (*ptrl); } //-------------------------------------------------------------------- @@ -249,7 +248,7 @@ TUINT32 convertToLong(UCHAR *buffer) { //-------------------------------------------------------------------- -void storeLong(TUINT32 val, TUINT32 *ptr) { *ptr = val; } +static void storeLong(TUINT32 val, TUINT32 *ptr) { *ptr = val; } //-------------------------------------------------------------------- diff --git a/toonz/sources/sound/tsioutils.cpp b/toonz/sources/sound/tsioutils.cpp index e54f9c3..b7c6b3d 100644 --- a/toonz/sources/sound/tsioutils.cpp +++ b/toonz/sources/sound/tsioutils.cpp @@ -2,6 +2,8 @@ #include "tcommon.h" +#include "tsioutils.h" + //------------------------------------------------------------------------------ void swapAndCopySamples(short *srcBuffer, short *dstBuffer, TINT32 sampleCount) { diff --git a/toonz/sources/sound/tsioutils.h b/toonz/sources/sound/tsioutils.h new file mode 100644 index 0000000..4d5cad1 --- /dev/null +++ b/toonz/sources/sound/tsioutils.h @@ -0,0 +1,9 @@ +#pragma once + +#ifndef TSIOUTILS_INCLUDED +#define TSIOUTILS_INCLUDED + +void swapAndCopySamples(short *srcBuffer, short *dstBuffer, + TINT32 sampleCount); + +#endif diff --git a/toonz/sources/stdfx/CMakeLists.txt b/toonz/sources/stdfx/CMakeLists.txt index 273d841..3e45b43 100644 --- a/toonz/sources/stdfx/CMakeLists.txt +++ b/toonz/sources/stdfx/CMakeLists.txt @@ -70,7 +70,8 @@ set(HEADERS iwa_simplexnoise.h iwa_noise1234.h iwa_fresnel.h - iwa_pnperspectivefx.h) + iwa_pnperspectivefx.h +) set(SOURCES adjustlevelsfx.cpp @@ -242,7 +243,8 @@ set(SOURCES iwa_tilefx.cpp iwa_simplexnoise.cpp iwa_noise1234.cpp - iwa_pnperspectivefx.cpp) + iwa_pnperspectivefx.cpp +) set(OBJCSOURCES ) diff --git a/toonz/sources/stdfx/backlitfx.cpp b/toonz/sources/stdfx/backlitfx.cpp index 0d15575..cd0c4b7 100644 --- a/toonz/sources/stdfx/backlitfx.cpp +++ b/toonz/sources/stdfx/backlitfx.cpp @@ -11,8 +11,8 @@ //--------------------------------------------------------------------- -void backlit(TRaster32P lighted, TRaster32P light, TRaster32P out, double blur, - const TPixel &color, double fade, double scale) { +static void backlit(TRaster32P lighted, TRaster32P light, TRaster32P out, double blur, + const TPixel &color, double fade, double scale) { assert(light && lighted && out); assert(lighted->getSize() == light->getSize()); @@ -92,8 +92,8 @@ void backlit(TRaster32P lighted, TRaster32P light, TRaster32P out, double blur, //--------------------------------------------------------------------- -void backlit(TRaster64P lighted, TRaster64P light, TRaster64P out, double blur, - const TPixel &color32, double fade, double scale) { +static void backlit(TRaster64P lighted, TRaster64P light, TRaster64P out, double blur, + const TPixel &color32, double fade, double scale) { assert(light && lighted && out); assert(lighted->getSize() == light->getSize()); diff --git a/toonz/sources/stdfx/changecolorfx.cpp b/toonz/sources/stdfx/changecolorfx.cpp index c354f62..2f776b6 100644 --- a/toonz/sources/stdfx/changecolorfx.cpp +++ b/toonz/sources/stdfx/changecolorfx.cpp @@ -135,7 +135,7 @@ public: void doCompute(TTile &tile, double frame, const TRenderSettings &ri) override; }; -double normalize_h(double h) { +static double normalize_h(double h) { if (h < 0) h += 360; if (h > 360) h -= 360; return h; diff --git a/toonz/sources/stdfx/gradients.cpp b/toonz/sources/stdfx/gradients.cpp index f567728..6fea2e4 100644 --- a/toonz/sources/stdfx/gradients.cpp +++ b/toonz/sources/stdfx/gradients.cpp @@ -4,6 +4,9 @@ #include "traster.h" #include "tspectrumparam.h" + +#include "gradients.h" + //------------------------------------------------------------------ namespace { diff --git a/toonz/sources/stdfx/iwa_particlesengine.cpp b/toonz/sources/stdfx/iwa_particlesengine.cpp index a0d771b..0bb91ca 100644 --- a/toonz/sources/stdfx/iwa_particlesengine.cpp +++ b/toonz/sources/stdfx/iwa_particlesengine.cpp @@ -1347,7 +1347,7 @@ void Iwa_Particles_Engine::fill_single_region( まだ出発していない粒子情報を初期化 ----------------------------------------------------------------*/ -bool potentialLessThan(const ParticleOrigin &po1, const ParticleOrigin &po2) { +static bool potentialLessThan(const ParticleOrigin &po1, const ParticleOrigin &po2) { return po1.potential < po2.potential; } diff --git a/toonz/sources/stdfx/motionblurfx.cpp b/toonz/sources/stdfx/motionblurfx.cpp index 606d2df..2d564a0 100644 --- a/toonz/sources/stdfx/motionblurfx.cpp +++ b/toonz/sources/stdfx/motionblurfx.cpp @@ -326,7 +326,7 @@ void directionalBlur(TRasterPT rout, TRasterPT rin, const TPointD &blur, } // namespace -void enlargeDir(TRectD &r, TPointD p, bool bidirectional) { +static void enlargeDir(TRectD &r, TPointD p, bool bidirectional) { if (bidirectional) { r.x1 += fabs(p.x); r.x0 -= fabs(p.x); @@ -345,7 +345,7 @@ void enlargeDir(TRectD &r, TPointD p, bool bidirectional) { } } -void reduceDir(TRectD &r, TPointD p, bool bidirectional) { +static void reduceDir(TRectD &r, TPointD p, bool bidirectional) { if (bidirectional) { r.x1 -= fabs(p.x); r.x0 += fabs(p.x); diff --git a/toonz/sources/stdfx/particlesengine.cpp b/toonz/sources/stdfx/particlesengine.cpp index 79d3986..f13a74b 100644 --- a/toonz/sources/stdfx/particlesengine.cpp +++ b/toonz/sources/stdfx/particlesengine.cpp @@ -33,7 +33,7 @@ Particles_Engine::Particles_Engine(ParticlesFx *parent, double frame) : m_parent(parent), m_frame(frame) {} -void printTime(TStopWatch &sw, std::string name) { +static void printTime(TStopWatch &sw, std::string name) { std::ostrstream ss; ss << name << " : "; sw.print(ss); diff --git a/toonz/sources/stdfx/pins.cpp b/toonz/sources/stdfx/pins.cpp index 788e6d9..518974b 100644 --- a/toonz/sources/stdfx/pins.cpp +++ b/toonz/sources/stdfx/pins.cpp @@ -428,7 +428,7 @@ void subdivision(const TPointD &p00, const TPointD &p10, const TPointD &p11, // ------------------------------------------------------------------------ #define TINY 1.0e-20 -int splitMatrix(double **a, int n, int *index) { +static int splitMatrix(double **a, int n, int *index) { int i, imax = 0, j, k; double big, dum, sum, temp; double *vv, d; @@ -488,8 +488,8 @@ int splitMatrix(double **a, int n, int *index) { /*-----------------------------------------------------------------*/ -void buildMatrixes(const FourPoints &ss, const FourPoints &dd, double **a, - double *b) { +static void buildMatrixes(const FourPoints &ss, const FourPoints &dd, double **a, + double *b) { int i; TPointD s[4], d[4]; @@ -515,7 +515,7 @@ void buildMatrixes(const FourPoints &ss, const FourPoints &dd, double **a, /*-----------------------------------------------------------------*/ -void computeSolutions(double **a, int *index, double *b) { +static void computeSolutions(double **a, int *index, double *b) { int i, ii = 0, ip, j; double sum; @@ -538,7 +538,7 @@ void computeSolutions(double **a, int *index, double *b) { /*-----------------------------------------------------------------*/ -void solveSystems(double **a, double *bx) { +static void solveSystems(double **a, double *bx) { int index[255], i, count = 0, bad_line; double **atmp; int n = 8; @@ -568,8 +568,8 @@ void solveSystems(double **a, double *bx) { /*-----------------------------------------------------------------*/ -void computeTransformation(const FourPoints &s, const FourPoints &d, - TAffine &aff, TPointD &perspectDen) { +static void computeTransformation(const FourPoints &s, const FourPoints &d, + TAffine &aff, TPointD &perspectDen) { double **a, *b; int i; diff --git a/toonz/sources/stdfx/shadingcontext.cpp b/toonz/sources/stdfx/shadingcontext.cpp index fa00ba1..75a68bd 100644 --- a/toonz/sources/stdfx/shadingcontext.cpp +++ b/toonz/sources/stdfx/shadingcontext.cpp @@ -27,9 +27,9 @@ namespace { -typedef std::auto_ptr QGLPixelBufferP; -typedef std::auto_ptr QGLFramebufferObjectP; -typedef std::auto_ptr QGLShaderProgramP; +typedef std::unique_ptr QGLPixelBufferP; +typedef std::unique_ptr QGLFramebufferObjectP; +typedef std::unique_ptr QGLShaderProgramP; struct CompiledShader { QGLShaderProgramP m_program; @@ -53,7 +53,7 @@ struct ShadingContext::Imp { std::map m_shaderPrograms; //!< Shader Programs stored in the context. - //! \warning Values have \p auto_ptr members. + //! \warning Values have \p unique_ptr members. public: Imp(); diff --git a/toonz/sources/stdfx/stdfx.cpp b/toonz/sources/stdfx/stdfx.cpp index 603b9ee..e78f0cc 100644 --- a/toonz/sources/stdfx/stdfx.cpp +++ b/toonz/sources/stdfx/stdfx.cpp @@ -687,4 +687,7 @@ return &info; */ +/* TODO, move to header */ +DV_EXPORT_API void initStdFx(); + DV_EXPORT_API void initStdFx() {} diff --git a/toonz/sources/stdfx/stdfx.h b/toonz/sources/stdfx/stdfx.h index 1518c22..bd0cb0a 100644 --- a/toonz/sources/stdfx/stdfx.h +++ b/toonz/sources/stdfx/stdfx.h @@ -61,4 +61,6 @@ public: bool isAlmostIsotropic(const TAffine &aff); +DV_EXPORT_API void initStdFx(); + #endif diff --git a/toonz/sources/t32bitsrv/CMakeLists.txt b/toonz/sources/t32bitsrv/CMakeLists.txt index 550ae76..5efe593 100644 --- a/toonz/sources/t32bitsrv/CMakeLists.txt +++ b/toonz/sources/t32bitsrv/CMakeLists.txt @@ -5,7 +5,8 @@ add_executable(t32bitsrv t32fontmsg.cpp t32fontmsg.h t32movmsg.cpp - t32movmsg.h) + t32movmsg.h +) if(WIN32) include_directories( @@ -18,7 +19,8 @@ target_link_libraries(t32bitsrv Qt5::Core Qt5::Network tnzcore - image) + image +) if(APPLE AND PLATFORM EQUAL 32) get_target_property(bin t32bitsrv LOCATION) @@ -33,5 +35,6 @@ if(APPLE AND PLATFORM EQUAL 32) add_custom_command(TARGET t32bitsrv POST_BUILD COMMAND - ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/. ${bin}) + ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/. ${bin} + ) endif() diff --git a/toonz/sources/tcleanupper/CMakeLists.txt b/toonz/sources/tcleanupper/CMakeLists.txt index 1dc23d6..541bd9f 100644 --- a/toonz/sources/tcleanupper/CMakeLists.txt +++ b/toonz/sources/tcleanupper/CMakeLists.txt @@ -1,8 +1,10 @@ add_executable(tcleanup - tcleanupper.cpp) + tcleanupper.cpp +) target_link_libraries(tcleanup Qt5::Core Qt5::Widgets tfarm - image) + image +) diff --git a/toonz/sources/tcleanupper/tcleanupper.cpp b/toonz/sources/tcleanupper/tcleanupper.cpp index 816d591..e133730 100644 --- a/toonz/sources/tcleanupper/tcleanupper.cpp +++ b/toonz/sources/tcleanupper/tcleanupper.cpp @@ -195,7 +195,7 @@ TFilePath setToonzFolder(const TFilePath &filename, std::string toonzVar) { //============================================================================================== -void prepareToCleanup(TXshSimpleLevel *xl, TPalette *cleanupPalette) { +static void prepareToCleanup(TXshSimpleLevel *xl, TPalette *cleanupPalette) { assert(xl->getScene()); if (xl->getProperties()->getSubsampling() != 1) { xl->getProperties()->setSubsampling(1); @@ -241,7 +241,7 @@ string TaskId; // //------------------------------------------------------------------------ -void searchLevelsToCleanup( +static void searchLevelsToCleanup( std::vector>> &levels, TXsheet *xsh, bool selectedOnly) { std::map levelTable; @@ -308,7 +308,7 @@ void searchLevelsToCleanup( //------------------------------------------------------------------------------ /*- CleanupDefaultパレットを追加する -*/ -void addCleanupDefaultPalette(TXshSimpleLevel *sl) { +static void addCleanupDefaultPalette(TXshSimpleLevel *sl) { /*- 元となるパレットはStudioPaletteフォルダに置く -*/ TFilePath palettePath = ToonzFolder::getStudioPaletteFolder() + "cleanup_default.tpl"; @@ -384,9 +384,9 @@ void addCleanupDefaultPalette(TXshSimpleLevel *sl) { // //------------------------------------------------------------------------ -void cleanupLevel(TXshSimpleLevel *xl, std::set fidsInXsheet, - ToonzScene *scene, bool overwrite, - TUserLogAppend &m_userLog) { +static void cleanupLevel(TXshSimpleLevel *xl, std::set fidsInXsheet, + ToonzScene *scene, bool overwrite, + TUserLogAppend &m_userLog) { prepareToCleanup(xl, scene->getProperties() ->getCleanupParameters() ->m_cleanupPalette.getPointer()); @@ -847,4 +847,4 @@ namespace { const char *toonzVersion = "Toonz 7.1"; } // namespace -string getToonzVersion() { return toonzVersion; } +static string getToonzVersion() { return toonzVersion; } diff --git a/toonz/sources/tcomposer/CMakeLists.txt b/toonz/sources/tcomposer/CMakeLists.txt index 9d537fc..8e33bf9 100644 --- a/toonz/sources/tcomposer/CMakeLists.txt +++ b/toonz/sources/tcomposer/CMakeLists.txt @@ -1,5 +1,6 @@ add_executable(tcomposer - tcomposer.cpp) + tcomposer.cpp +) target_link_libraries(tcomposer Qt5::Core @@ -11,4 +12,5 @@ target_link_libraries(tcomposer sound image colorfx - toonzqt) + toonzqt +) diff --git a/toonz/sources/tcomposer/tcomposer.cpp b/toonz/sources/tcomposer/tcomposer.cpp index 5d777ba..676857a 100644 --- a/toonz/sources/tcomposer/tcomposer.cpp +++ b/toonz/sources/tcomposer/tcomposer.cpp @@ -394,9 +394,9 @@ bool MyMultimediaRenderListener::onFrameFailed(int frame, int column, //================================================================================== -std::pair generateMovie(ToonzScene *scene, const TFilePath &fp, - int r0, int r1, int step, int shrink, - int threadCount, int maxTileSize) { +static std::pair generateMovie(ToonzScene *scene, const TFilePath &fp, + int r0, int r1, int step, int shrink, + int threadCount, int maxTileSize) { QWaitCondition renderCompleted; // riporto gli indici a base zero @@ -565,7 +565,7 @@ int main(int argc, char *argv[]) { // Create a QObject destroyed just before app - see Tnz6's main.cpp for // rationale - std::auto_ptr mainScope(new QObject(&app)); + std::unique_ptr mainScope(new QObject(&app)); mainScope->setObjectName("mainScope"); #ifdef _WIN32 diff --git a/toonz/sources/tconverter/CMakeLists.txt b/toonz/sources/tconverter/CMakeLists.txt index 20b7d7b..0d51f0c 100644 --- a/toonz/sources/tconverter/CMakeLists.txt +++ b/toonz/sources/tconverter/CMakeLists.txt @@ -1,7 +1,9 @@ add_executable(tconverter - tconverter.cpp) + tconverter.cpp +) target_link_libraries(tconverter Qt5::Core toonzlib - image) + image +) diff --git a/toonz/sources/tnzbase/CMakeLists.txt b/toonz/sources/tnzbase/CMakeLists.txt index e5623ef..d9993d6 100644 --- a/toonz/sources/tnzbase/CMakeLists.txt +++ b/toonz/sources/tnzbase/CMakeLists.txt @@ -1,6 +1,7 @@ set(MOC_HEADERS ../include/tcacheresourcepool.h - ../common/tfx/trendererP.h) + ../common/tfx/trendererP.h +) set(HEADERS ${MOC_HEADERS} ../common/twain/ttwain.h @@ -61,7 +62,8 @@ set(HEADERS ${MOC_HEADERS} ../include/tparser.h ../include/ttokenizer.h ../include/tunit.h - ../include/tzeraryfx.h) + ../include/tzeraryfx.h +) set(SOURCES permissionsmanager.cpp @@ -109,14 +111,17 @@ set(SOURCES ../common/expressions/ttokenizer.cpp ../common/tunit/tunit.cpp tscanner/tscannerutil.cpp - tscanner/tscannerepson.cpp) + tscanner/tscannerepson.cpp +) if(WIN32) set(SOURCES ${SOURCES} - tscanner/TScannerIO/TUSBScannerIO_W.cpp) + tscanner/TScannerIO/TUSBScannerIO_W.cpp + ) else() set(SOURCES ${SOURCES} - tscanner/TScannerIO/TUSBScannerIO_M.cpp) + tscanner/TScannerIO/TUSBScannerIO_M.cpp + ) endif() set(OBJCSOURCES @@ -127,23 +132,27 @@ set(OBJCSOURCES ../common/twain/ttwain_util.c ../common/twain/ttwain_win.c tscanner/tscanner.cpp - tscanner/tscannertwain.cpp) + tscanner/tscannertwain.cpp +) if(WIN32) set(OBJCSOURCES ${OBJCSOURCES} ../common/twain/ttwain_stateW.c ../common/twain/ttwain_utilW.c - ../common/twain/ttwain_winW.c) + ../common/twain/ttwain_winW.c + ) elseif(APPLE) set(OBJCSOURCES ${OBJCSOURCES} ../common/twain/ttwain_stateM.c ../common/twain/ttwain_utilM.c - ../common/twain/ttwain_winM.c) + ../common/twain/ttwain_winM.c + ) elseif(UNIX) set(OBJCSOURCES ${OBJCSOURCES} ../common/twain/ttwain_stateX.c ../common/twain/ttwain_utilX.c - ../common/twain/ttwain_winX.c) + ../common/twain/ttwain_winX.c + ) endif() if(APPLE) @@ -182,7 +191,8 @@ include_directories( if(WIN32) set(EXTRA_LIBS - tnzcore) + tnzcore + ) elseif(APPLE) find_library(TWAIN_LIB TWAIN) find_library(IOKIT_LIB IOKit) @@ -193,13 +203,15 @@ elseif(APPLE) ${USB_LIB} ${TWAIN_LIB} ${IOKIT_LIB} - ${COCOA_LIB}) + ${COCOA_LIB} + ) target_link_libraries(tnzbase Qt5::Core Qt5::Gui) elseif(UNIX) _find_toonz_library(EXTRA_LIBS "tnzcore") set(EXTRA_LIBS ${EXTRA_LIBS} - ${SDL_LIB_LIBRARIES}) + ${SDL_LIB_LIBRARIES} + ) include_directories( SYSTEM diff --git a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp index 7b27402..2cc40ee 100644 --- a/toonz/sources/tnzbase/tscanner/tscannerepson.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannerepson.cpp @@ -18,8 +18,8 @@ using namespace TScannerUtil; -void sense(bool) {} -int scsi_maxlen() { +static void sense(bool) {} +static int scsi_maxlen() { assert(0); return 0; } diff --git a/toonz/sources/tnzbase/tscanner/tscannertwain.cpp b/toonz/sources/tnzbase/tscanner/tscannertwain.cpp index 979d5e5..e907117 100644 --- a/toonz/sources/tnzbase/tscanner/tscannertwain.cpp +++ b/toonz/sources/tnzbase/tscanner/tscannertwain.cpp @@ -9,15 +9,17 @@ using namespace TScannerUtil; extern "C" { #include "../common/twain/ttwain_util.h" +#include "../common/twain/ttwain_global_def.h" /* forward declare functions */ } /* callback used to handle TTWAIN done/error status*/ -void throwIT(const char *msg) { throw TException(msg); } +static void throwIT(const char *msg) { throw TException(msg); } extern "C" void TTWAIN_ErrorBox(const char *msg) { throwIT(msg); } -extern "C" int onDoneCB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, int ly, +extern "C" { +static int onDoneCB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, int ly, int wrap, float xdpi, float ydpi, void *usrData) { TRasterP ras; switch (pixelType) { @@ -69,13 +71,16 @@ extern "C" int onDoneCB(UCHAR *buffer, TTWAIN_PIXTYPE pixelType, int lx, int ly, scannerDevice->decrementPaperLeftCount(); return scannerDevice->getPaperLeftCount(); } +} //----------------------------------------------------------------------------- -extern "C" void onErrorCB(void *usrData, void *alwaysZero) { +extern "C" { +static void onErrorCB(void *usrData, void *alwaysZero) { TScanner *scannerDevice = reinterpret_cast(usrData); scannerDevice->notifyError(); } +} //----------------------------------------------------------------------------- @@ -218,7 +223,7 @@ param.m_version = string(TTWAIN_GetVersion()); //----------------------------------------------------------------------------- -void setupParameters(const TScannerParameters ¶ms, bool isAreaSupported) { +static void setupParameters(const TScannerParameters ¶ms, bool isAreaSupported) { if (isAreaSupported) { TRectD scanArea = params.getScanArea(); float L = (float)(scanArea.getP00().x / 25.4); @@ -259,7 +264,7 @@ void setupParameters(const TScannerParameters ¶ms, bool isAreaSupported) { } //----------------------------------------------------------------------------- -void openAndSetupTwain() { +static void openAndSetupTwain() { int rc = TTWAIN_OpenDefaultSource(); if (rc) { TTWAIN_SetTwainUsage(TTWAIN_MODE_UNLEASHED); diff --git a/toonz/sources/tnzcore/CMakeLists.txt b/toonz/sources/tnzcore/CMakeLists.txt index 6732805..f30d022 100644 --- a/toonz/sources/tnzcore/CMakeLists.txt +++ b/toonz/sources/tnzcore/CMakeLists.txt @@ -5,7 +5,8 @@ set(MOC_HEADERS ../include/tipcsrv.h ../include/tipcsrvP.h ../include/tmsgcore.h - ../include/tfunctorinvoker.h) + ../include/tfunctorinvoker.h +) set(HEADERS ${MOC_HEADERS} ../common/trop/loop_macros.h @@ -118,7 +119,8 @@ set(HEADERS ${MOC_HEADERS} ../include/t32bitsrv_wrap.h ../include/tenv.h ../include/tmeshimage.h - ../include/tgldisplaylistsmanager.h) + ../include/tgldisplaylistsmanager.h +) set(SOURCES ../common/tcore/tdata.cpp @@ -240,25 +242,31 @@ set(SOURCES ../common/tsystem/tsystempd.cpp ../common/tapptools/tenv.cpp ../common/tmeshimage/tmeshimage.cpp - ../common/tmsgcore.cpp) + ../common/tmsgcore.cpp +) if(WIN32) set(SOURCES ${SOURCES} ../common/tsound/tsound_nt.cpp - ../common/tvrender/tfont_nt.cpp) + ../common/tvrender/tfont_nt.cpp + ) elseif(APPLE) set(SOURCES ${SOURCES} ../common/tsound/tsound_mac.cpp - ../common/tvrender/tfont_mac.cpp) + ../common/tvrender/tfont_mac.cpp + ) elseif(UNIX) set(SOURCES ${SOURCES} - ../common/tvrender/tfont_qt.cpp) + ../common/tvrender/tfont_qt.cpp + ) if(SDL_LIB_FOUND) set(SOURCES ${SOURCES} - ../common/tsound/tsound_sdl.cpp) + ../common/tsound/tsound_sdl.cpp + ) else() set(SOURCES ${SOURCES} - ../common/tsound/tsound_x.cpp) + ../common/tsound/tsound_x.cpp + ) endif() endif() @@ -313,7 +321,8 @@ if(WIN32) mpr.lib winmm.lib opengl32.lib - glu32.lib) + glu32.lib + ) elseif(APPLE) find_library(AUDIOUNIT_LIB AudioUnit) find_library(AUDIOTB_LIB AudioToolbox) @@ -322,7 +331,8 @@ elseif(APPLE) set(EXTRA_LIBS ${AUDIOUNIT_LIB} ${AUDIOTB_LIB} - ${CARBON_LIB}) + ${CARBON_LIB} + ) elseif(UNIX) set(QT_LIB) # avoid warning include_directories( @@ -330,10 +340,12 @@ elseif(UNIX) ${FREETYPE_INCLUDE_DIRS} ) set(EXTRA_LIBS - ${GLU_LIB}) + ${GLU_LIB} + ) endif() target_link_libraries(tnzcore Qt5::OpenGL Qt5::Network ${GL_LIB} ${GLUT_LIB} ${QT_LIB} ${Z_LIB} ${JPEG_LIB} ${LZ4_LIB} - ${EXTRA_LIBS}) + ${EXTRA_LIBS} +) diff --git a/toonz/sources/tnzext/CMakeLists.txt b/toonz/sources/tnzext/CMakeLists.txt index 44ffce5..9fd2f0d 100644 --- a/toonz/sources/tnzext/CMakeLists.txt +++ b/toonz/sources/tnzext/CMakeLists.txt @@ -34,7 +34,8 @@ set(HEADERS ../include/tlin/tlin_matrix.h ../include/tlin/tlin_sparsemat.h ../include/tlin/tlin_superlu_wrap.h - ../include/tlin/tlin_vector.h) + ../include/tlin/tlin_vector.h +) set(SOURCES ContextStatus.cpp @@ -65,7 +66,8 @@ set(SOURCES plasticskeletondeformation.cpp ttexturesstorage.cpp tlin/tlin_cblas_wrap.cpp - tlin/tlin_superlu_wrap.cpp) + tlin/tlin_superlu_wrap.cpp +) set(OBJCSOURCES ) @@ -101,15 +103,18 @@ if(WIN32) target_link_libraries(tnzext Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Network ${GLUT_LIB} ${GL_LIB} ${SUPERLU_LIB} ${OPENBLAS_LIB} ${EXTRA_LIBS} - tnzcore tnzbase) + tnzcore tnzbase + ) elseif(APPLE) set(EXTRA_LIBS ${CMAKE_CURRENT_BINARY_DIR}/../tnzcore/libtnzcore.dylib - ${CMAKE_CURRENT_BINARY_DIR}/../tnzbase/libtnzbase.dylib) + ${CMAKE_CURRENT_BINARY_DIR}/../tnzbase/libtnzbase.dylib + ) target_link_libraries(tnzext Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Network - ${ACCE_LIB} ${GLUT_LIB} ${GL_LIB} ${SUPERLU_LIB} ${EXTRA_LIBS}) + ${ACCE_LIB} ${GLUT_LIB} ${GL_LIB} ${SUPERLU_LIB} ${EXTRA_LIBS} + ) elseif(UNIX) _find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase") @@ -117,5 +122,6 @@ elseif(UNIX) target_link_libraries(tnzext Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Network - ${GLUT_LIB} ${GL_LIB} ${SUPERLU_LIB} ${EXTRA_LIBS}) + ${GLUT_LIB} ${GL_LIB} ${SUPERLU_LIB} ${EXTRA_LIBS} + ) endif() diff --git a/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp b/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp index 8e104f8..885d122 100644 --- a/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp +++ b/toonz/sources/tnzext/tlin/tlin_cblas_wrap.cpp @@ -55,7 +55,7 @@ extern "C" { //======================================================================================== -void sum(int n, const double *x, double *&y) { +static void sum(int n, const double *x, double *&y) { /* void cblas_daxpy(blasint n, double a, double *x, blasint incx, double *y, blasint incy); diff --git a/toonz/sources/tnztools/CMakeLists.txt b/toonz/sources/tnztools/CMakeLists.txt index 306464c..8f2b1c2 100644 --- a/toonz/sources/tnztools/CMakeLists.txt +++ b/toonz/sources/tnztools/CMakeLists.txt @@ -11,7 +11,8 @@ set(MOC_HEADERS ../include/tools/screenpicker.h rgbpickertool.h rulertool.h - stylepickertool.h) + stylepickertool.h +) set(HEADERS ${MOC_HEADERS} autofill.h @@ -31,7 +32,8 @@ set(HEADERS ${MOC_HEADERS} ../include/tools/tool.h ../include/tools/toolcommandids.h ../include/tools/toolutils.h - ../include/tools/RGBpicker.h) + ../include/tools/RGBpicker.h +) set(SOURCES autofillpli.cpp @@ -89,7 +91,8 @@ set(SOURCES strokeselection.cpp screenpicker.cpp fingertool.cpp - rulertool.cpp) + rulertool.cpp +) set(RESOURCES tnztools.qrc) diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp index 6cf93b9..3272da2 100644 --- a/toonz/sources/tnztools/brushtool.cpp +++ b/toonz/sources/tnztools/brushtool.cpp @@ -89,8 +89,8 @@ TEnv::DoubleVar RasterBrushHardness("RasterBrushHardness", 100); // note: stroke is unchanged // -void split(TStroke *stroke, const std::vector ¶meterValues, - std::vector &strokes) { +static void split(TStroke *stroke, const std::vector ¶meterValues, + std::vector &strokes) { TThickPoint p2; std::vector points; TThickPoint lastPoint = stroke->getControlPoint(0); @@ -199,7 +199,7 @@ void split(TStroke *stroke, const std::vector ¶meterValues, // Note: if the curve is a single point (that's dp=0) or it is a straight // line (that's ddp=0) return 0 -double curvature(TPointD dp, TPointD ddp) { +static double curvature(TPointD dp, TPointD ddp) { if (dp == TPointD(0, 0)) return 0; else @@ -217,9 +217,9 @@ double curvature(TPointD dp, TPointD ddp) { // Output: // parameterValues = vector of max curvature parameter points -void findMaxCurvPoints(TStroke *stroke, const float &angoloLim, - const float &curvMaxLim, - std::vector ¶meterValues) { +static void findMaxCurvPoints(TStroke *stroke, const float &angoloLim, + const float &curvMaxLim, + std::vector ¶meterValues) { TPointD tg1, tg2; // Tangent vectors TPointD dp, ddp; // First and Second derivate. @@ -320,9 +320,9 @@ void findMaxCurvPoints(TStroke *stroke, const float &angoloLim, } } -void addStroke(TTool::Application *application, const TVectorImageP &vi, - TStroke *stroke, bool breakAngles, bool frameCreated, - bool levelCreated) { +static void addStroke(TTool::Application *application, const TVectorImageP &vi, + TStroke *stroke, bool breakAngles, bool frameCreated, + bool levelCreated) { QMutexLocker lock(vi->getMutex()); if (application->getCurrentObject()->isSpline()) { diff --git a/toonz/sources/tnztools/geometrictool.cpp b/toonz/sources/tnztools/geometrictool.cpp index bf6c80f..3014d02 100644 --- a/toonz/sources/tnztools/geometrictool.cpp +++ b/toonz/sources/tnztools/geometrictool.cpp @@ -65,7 +65,7 @@ TEnv::IntVar GeometricMiterValue("InknpaintGeometricMiterValue", 4); // Utility Functions //----------------------------------------------------------------------------- -TPointD rectify(const TPointD &oldPos, const TPointD &pos) { +static TPointD rectify(const TPointD &oldPos, const TPointD &pos) { const double h = sqrt(2.0) / 2.0; const TPointD directions[] = {TPointD(1, 0), TPointD(h, h), TPointD(0, 1), TPointD(-h, h), TPointD(-1, 0), TPointD(-h, -h), @@ -85,15 +85,15 @@ TPointD rectify(const TPointD &oldPos, const TPointD &pos) { //----------------------------------------------------------------------------- -TPointD computeSpeed(TPointD p0, TPointD p1, double factor) { +static TPointD computeSpeed(TPointD p0, TPointD p1, double factor) { TPointD d = p1 - p0; return (d == TPointD()) ? TPointD() : d * (factor / norm(d)); } //----------------------------------------------------------------------------- -TRect drawBluredBrush(const TRasterImageP &ri, TStroke *stroke, int thick, - double hardness, double opacity) { +static TRect drawBluredBrush(const TRasterImageP &ri, TStroke *stroke, int thick, + double hardness, double opacity) { TStroke *s = new TStroke(*stroke); TPointD riCenter = ri->getRaster()->getCenterD(); s->transform(TTranslation(riCenter)); @@ -135,8 +135,8 @@ TRect drawBluredBrush(const TRasterImageP &ri, TStroke *stroke, int thick, //----------------------------------------------------------------------------- -TRect drawBluredBrush(const TToonzImageP &ti, TStroke *stroke, int thick, - double hardness, bool selective) { +static TRect drawBluredBrush(const TToonzImageP &ti, TStroke *stroke, int thick, + double hardness, bool selective) { TStroke *s = new TStroke(*stroke); TPointD riCenter = ti->getRaster()->getCenterD(); s->transform(TTranslation(riCenter)); diff --git a/toonz/sources/tnztools/imagegrouping.cpp b/toonz/sources/tnztools/imagegrouping.cpp index 0aa69ef..5020392 100644 --- a/toonz/sources/tnztools/imagegrouping.cpp +++ b/toonz/sources/tnztools/imagegrouping.cpp @@ -76,7 +76,7 @@ void ungroupWithoutUndo(TVectorImage *vimg, StrokeSelection *selection) { //----------------------------------------------------------------------------- class GroupUndo final : public ToolUtils::TToolUndo { - std::auto_ptr m_selection; + std::unique_ptr m_selection; public: GroupUndo(TXshSimpleLevel *level, const TFrameId &frameId, @@ -103,7 +103,7 @@ public: //----------------------------------------------------------------------------- class UngroupUndo final : public ToolUtils::TToolUndo { - std::auto_ptr m_selection; + std::unique_ptr m_selection; public: UngroupUndo(TXshSimpleLevel *level, const TFrameId &frameId, @@ -616,9 +616,9 @@ refStroke, count, refStroke+count)>commonDepth(vimg, refStroke, count, prev)) if(count==0) return; */ -int doMoveGroup(UCHAR moveType, TVectorImage *vimg, - const std::vector> &selectedGroups, - int index) { +static int doMoveGroup(UCHAR moveType, TVectorImage *vimg, + const std::vector> &selectedGroups, + int index) { int refStroke = vimg->getStrokeIndex(selectedGroups[index].first); int count = selectedGroups[index].second; diff --git a/toonz/sources/tnztools/plastictool.cpp b/toonz/sources/tnztools/plastictool.cpp index 3822f05..8bffbe0 100644 --- a/toonz/sources/tnztools/plastictool.cpp +++ b/toonz/sources/tnztools/plastictool.cpp @@ -1682,7 +1682,7 @@ void drawFullSquare(const TPointD &pos, double radius) { //------------------------------------------------------------------------ -void drawFilledSquare(const TPointD &pos, double radius) { +static void drawFilledSquare(const TPointD &pos, double radius) { glBegin(GL_QUADS); glVertex2d(pos.x - radius, pos.y - radius); glVertex2d(pos.x + radius, pos.y - radius); @@ -1693,7 +1693,7 @@ void drawFilledSquare(const TPointD &pos, double radius) { //------------------------------------------------------------------------ -void drawHandle(const TPointD &pos, double radius, const TPixel32 &color) { +static void drawHandle(const TPointD &pos, double radius, const TPixel32 &color) { glColor4ub(0, 0, 0, color.m); // Black border glLineWidth(4.0f); drawSquare(pos, radius); @@ -1705,8 +1705,8 @@ void drawHandle(const TPointD &pos, double radius, const TPixel32 &color) { //------------------------------------------------------------------------ -void drawFilledHandle(const TPointD &pos, double radius, double pixelSize, - const TPixel32 &color) { +static void drawFilledHandle(const TPointD &pos, double radius, double pixelSize, + const TPixel32 &color) { glColor4ub(0, 0, 0, color.m); drawFilledSquare(pos, radius + pixelSize); @@ -1716,7 +1716,7 @@ void drawFilledHandle(const TPointD &pos, double radius, double pixelSize, //------------------------------------------------------------------------ -void drawText(const TPointD &pos, const QString &text, double fontScale) { +static void drawText(const TPointD &pos, const QString &text, double fontScale) { // Get the world-to-window affine double matrix[16]; diff --git a/toonz/sources/tnztools/plastictool.h b/toonz/sources/tnztools/plastictool.h index 721db5e..0b5b807 100644 --- a/toonz/sources/tnztools/plastictool.h +++ b/toonz/sources/tnztools/plastictool.h @@ -160,8 +160,8 @@ private: // Editing-related vars - std::auto_ptr m_rigidityPainter; //!< Delegate class to - //! deal with (undoable) + std::unique_ptr m_rigidityPainter; //!< Delegate class to + //! deal with (undoable) //! rigidity painting bool m_showSkeletonOS; //!< Whether onion-skinned skeletons must be shown @@ -352,7 +352,7 @@ private: void setGlobalRestKey(); // Rigidity methods - static std::auto_ptr createRigidityPainter(); + static std::unique_ptr createRigidityPainter(); // Drawing methods diff --git a/toonz/sources/tnztools/plastictool_meshedit.cpp b/toonz/sources/tnztools/plastictool_meshedit.cpp index 2cd70e4..52752cc 100644 --- a/toonz/sources/tnztools/plastictool_meshedit.cpp +++ b/toonz/sources/tnztools/plastictool_meshedit.cpp @@ -155,8 +155,8 @@ struct Closer { //============================================================================== -std::pair closestVertex(const TTextureMesh &mesh, - const TPointD &pos) { +static std::pair closestVertex(const TTextureMesh &mesh, + const TPointD &pos) { Closer closer = {mesh, pos}; int vIdx = int( std::min_element(mesh.vertices().begin(), mesh.vertices().end(), closer) @@ -167,8 +167,8 @@ std::pair closestVertex(const TTextureMesh &mesh, //------------------------------------------------------------------------ -std::pair closestEdge(const TTextureMesh &mesh, - const TPointD &pos) { +static std::pair closestEdge(const TTextureMesh &mesh, + const TPointD &pos) { Closer closer = {mesh, pos}; int eIdx = int(std::min_element(mesh.edges().begin(), mesh.edges().end(), closer) @@ -1188,7 +1188,7 @@ void PlasticTool::swapEdge_mesh_undo() { } // Perform operation - std::auto_ptr undo(new SwapEdgeUndo(m_meSel.objects().front())); + std::unique_ptr undo(new SwapEdgeUndo(m_meSel.objects().front())); undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -1208,7 +1208,7 @@ void PlasticTool::collapseEdge_mesh_undo() { } // Perform operation - std::auto_ptr undo(new CollapseEdgeUndo(m_meSel.objects().front())); + std::unique_ptr undo(new CollapseEdgeUndo(m_meSel.objects().front())); undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -1219,7 +1219,7 @@ void PlasticTool::collapseEdge_mesh_undo() { void PlasticTool::splitEdge_mesh_undo() { if (!(m_mi && m_meSel.hasSingleObject())) return; - std::auto_ptr undo(new SplitEdgeUndo(m_meSel.objects().front())); + std::unique_ptr undo(new SplitEdgeUndo(m_meSel.objects().front())); undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -1230,7 +1230,7 @@ void PlasticTool::splitEdge_mesh_undo() { void PlasticTool::cutEdges_mesh_undo() { if (!m_mi) return; - std::auto_ptr undo(new CutEdgesUndo(m_meSel.objects())); + std::unique_ptr undo(new CutEdgesUndo(m_meSel.objects())); if (undo->do_()) TUndoManager::manager()->add(undo.release()); } diff --git a/toonz/sources/tnztools/plastictool_rigidity.cpp b/toonz/sources/tnztools/plastictool_rigidity.cpp index dd584e8..06c83f4 100644 --- a/toonz/sources/tnztools/plastictool_rigidity.cpp +++ b/toonz/sources/tnztools/plastictool_rigidity.cpp @@ -186,8 +186,8 @@ void RigidityPainter::commit() { // PlasticTool functions //**************************************************************************************** -std::auto_ptr PlasticTool::createRigidityPainter() { - return std::auto_ptr(new RigidityPainter); +std::unique_ptr PlasticTool::createRigidityPainter() { + return std::unique_ptr(new RigidityPainter); } //------------------------------------------------------------------------ diff --git a/toonz/sources/tnztools/skeletontool.cpp b/toonz/sources/tnztools/skeletontool.cpp index 0ce0e13..6f3620c 100644 --- a/toonz/sources/tnztools/skeletontool.cpp +++ b/toonz/sources/tnztools/skeletontool.cpp @@ -80,7 +80,7 @@ inline std::string removeTrailingH(std::string handle) { // return true iff column ancestorIndex is column descentIndex or its parent or // the parent of the parent, etc. -bool isAncestorOf(int ancestorIndex, int descendentIndex) { +static bool isAncestorOf(int ancestorIndex, int descendentIndex) { TStageObjectId ancestorId = TStageObjectId::ColumnId(ancestorIndex); TStageObjectId descendentId = TStageObjectId::ColumnId(descendentIndex); TXsheet *xsh = TTool::getApplication()->getCurrentXsheet()->getXsheet(); @@ -91,8 +91,8 @@ bool isAncestorOf(int ancestorIndex, int descendentIndex) { //------------------------------------------------------------ -void getHooks(std::vector &hooks, TXsheet *xsh, int row, int col, - TPointD dpiScale) { +static void getHooks(std::vector &hooks, TXsheet *xsh, int row, int col, + TPointD dpiScale) { // nota. hook position is in the coordinate system of the parent object. // a inch is Stage::inch @@ -138,8 +138,8 @@ void getHooks(std::vector &hooks, TXsheet *xsh, int row, int col, //------------------------------------------------------------------- -void getConnectedColumns(std::set &connectedColumns, TXsheet *xsh, - int col) { +static void getConnectedColumns(std::set &connectedColumns, TXsheet *xsh, + int col) { TStageObjectId id; // insert col and all column ancestors id = TStageObjectId::ColumnId(col); @@ -165,7 +165,7 @@ void getConnectedColumns(std::set &connectedColumns, TXsheet *xsh, } } -bool canShowBone(Skeleton::Bone *bone, TXsheet *xsh, int row) { +static bool canShowBone(Skeleton::Bone *bone, TXsheet *xsh, int row) { TStageObjectId id = bone->getStageObject()->getId(); if (!xsh->getCell(row, id.getIndex()).isEmpty() && xsh->getColumn(id.getIndex())->isCamstandVisible()) diff --git a/toonz/sources/tnztools/strokeselection.cpp b/toonz/sources/tnztools/strokeselection.cpp index c4efaef..020519d 100644 --- a/toonz/sources/tnztools/strokeselection.cpp +++ b/toonz/sources/tnztools/strokeselection.cpp @@ -118,7 +118,7 @@ bool pasteStrokesWithoutUndo(TVectorImageP image, std::set &outIndexes, scene->getProperties()->getVectorizerParameters(); assert(vParams); - std::auto_ptr config( + std::unique_ptr config( vParams->getCurrentConfiguration(0.0)); vectorizeToonzImageData(image, tiData, indexes, image->getPalette(), *config); diff --git a/toonz/sources/tnztools/toolhandle.cpp b/toonz/sources/tnztools/toolhandle.cpp index 15ae313..1143db9 100644 --- a/toonz/sources/tnztools/toolhandle.cpp +++ b/toonz/sources/tnztools/toolhandle.cpp @@ -103,7 +103,7 @@ void ToolHandle::setToolBusy(bool value) { QIcon currentIcon; -QIcon getCurrentIcon() { return currentIcon; } +static QIcon getCurrentIcon() { return currentIcon; } //----------------------------------------------------------------------------- diff --git a/toonz/sources/tnztools/toolutils.cpp b/toonz/sources/tnztools/toolutils.cpp index 666da37..3717d96 100644 --- a/toonz/sources/tnztools/toolutils.cpp +++ b/toonz/sources/tnztools/toolutils.cpp @@ -1066,10 +1066,9 @@ void ToolUtils::UndoPencil::undo() const { VIStroke *stroke = image->getStrokeById(m_strokeId); if (!stroke) return; image->deleteStroke(stroke); - TSelection *selection = app->getCurrentSelection()->getSelection(); + TSelection *selection = app->getCurrentSelection()->getSelection(); StrokeSelection *strokeSelection = dynamic_cast(selection); - if (strokeSelection) - strokeSelection->selectNone(); + if (strokeSelection) strokeSelection->selectNone(); UINT size = m_fillInformation->size(); TRegion *reg; diff --git a/toonz/sources/tnztools/trackertool.cpp b/toonz/sources/tnztools/trackertool.cpp index 7813b24..33d8202 100644 --- a/toonz/sources/tnztools/trackertool.cpp +++ b/toonz/sources/tnztools/trackertool.cpp @@ -849,7 +849,7 @@ void TrackerTool::onDeactivate() { //============================================================================= -TTool *getTrackerToolTool() { return &trackerTool; } +static TTool *getTrackerToolTool() { return &trackerTool; } //============================================================================= diff --git a/toonz/sources/tnztools/typetool.cpp b/toonz/sources/tnztools/typetool.cpp index 8aa6701..23229fa 100644 --- a/toonz/sources/tnztools/typetool.cpp +++ b/toonz/sources/tnztools/typetool.cpp @@ -1645,7 +1645,7 @@ void TypeTool::onImageChanged() { stopEditing(); } //========================================================= -TTool *getTypeTool() { return &typeTool; } +static TTool *getTypeTool() { return &typeTool; } /*void resetTypetTool(TTool*tool) { diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txt index c3d76c8..f430c1a 100644 --- a/toonz/sources/toonz/CMakeLists.txt +++ b/toonz/sources/toonz/CMakeLists.txt @@ -145,7 +145,8 @@ set(MOC_HEADERS metnum.h ObjectTracker.h predict3d.h - processor.h) + processor.h +) set(HEADERS ${MOC_HEADERS}) @@ -301,7 +302,8 @@ set(SOURCES dummyprocessor.cpp metnum.cpp ObjectTracker.cpp - predict3d.cpp) + predict3d.cpp +) add_translation(toonz ${HEADERS} ${SOURCES}) @@ -374,9 +376,11 @@ endif() if(WIN32) target_link_libraries(OpenToonz_${VERSION} - Qt5::WinMain Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia + Qt5::WinMain Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml + Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia ${GL_LIB} ${GLUT_LIB} - tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm) + tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm + ) elseif(APPLE) find_library(COCOA_LIB Cocoa) @@ -386,7 +390,12 @@ elseif(APPLE) set(EXTRA_LIBS ${EXTRA_LIBS} "$" "$") - target_link_libraries(OpenToonz_${VERSION} Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia ${GL_LIB} ${GLUT_LIB} ${COCOA_LIB} ${EXTRA_LIBS} mousedragfilter) + target_link_libraries(OpenToonz_${VERSION} + Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml + Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia + ${GL_LIB} ${GLUT_LIB} + ${COCOA_LIB} ${EXTRA_LIBS} mousedragfilter + ) elseif(UNIX) _find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;toonzlib;colorfx;tnzext;image;sound;toonzqt;tnztools") @@ -396,7 +405,12 @@ elseif(UNIX) set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} ${OPENBLAS_LIB}) - target_link_libraries(OpenToonz_${VERSION} Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia ${GL_LIB} ${GLUT_LIB} ${GLU_LIB} ${EXTRA_LIBS}) + target_link_libraries( + OpenToonz_${VERSION} Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml + Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia + ${GL_LIB} ${GLUT_LIB} ${GLU_LIB} + ${EXTRA_LIBS} + ) endif() if(APPLE) @@ -423,10 +437,12 @@ if(APPLE) add_custom_command(TARGET OpenToonz_${VERSION} POST_BUILD COMMAND - ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/. ${bin}) + ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/. ${bin} + ) add_custom_command(TARGET OpenToonz_${VERSION} POST_BUILD COMMAND - ${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH} ${bin}) + ${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH} ${bin} + ) add_custom_command(TARGET OpenToonz_${VERSION} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/OpenToonz_${VERSION}.app/Contents/Resources) add_custom_command(TARGET OpenToonz_${VERSION} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/OpenToonz_${VERSION}.app/Contents/Resources) diff --git a/toonz/sources/toonz/adjustthicknesspopup.cpp b/toonz/sources/toonz/adjustthicknesspopup.cpp index c1b3fdb..46e5554 100644 --- a/toonz/sources/toonz/adjustthicknesspopup.cpp +++ b/toonz/sources/toonz/adjustthicknesspopup.cpp @@ -1092,7 +1092,7 @@ void AdjustThicknessPopup::apply() { double fromTransform[2], toTransform[2]; getTransformParameters(fromTransform, toTransform); - std::auto_ptr undo( + std::unique_ptr undo( new AdjustThicknessUndo(m_selectionData, fromTransform, toTransform)); undo->redo(); diff --git a/toonz/sources/toonz/cellselectioncommand.cpp b/toonz/sources/toonz/cellselectioncommand.cpp index af0274b..a670e73 100644 --- a/toonz/sources/toonz/cellselectioncommand.cpp +++ b/toonz/sources/toonz/cellselectioncommand.cpp @@ -226,7 +226,7 @@ void TCellSelection::incrementCells() { TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet(); - std::auto_ptr undo(new IncrementUndo( + std::unique_ptr undo(new IncrementUndo( m_range.m_r0, m_range.m_c0, m_range.m_r1, m_range.m_c1)); if (undo->redo(), !undo->m_ok) { @@ -1312,7 +1312,7 @@ TXshSimpleLevel *CloneLevelUndo::cloneLevel( //----------------------------------------------------------------------------- bool CloneLevelUndo::chooseLevelName(TFilePath &fp) const { - std::auto_ptr levelNamePopup( + std::unique_ptr levelNamePopup( new LevelNamePopup(fp.getWideName())); if (levelNamePopup->exec() == QDialog::Accepted) { const QString &levelName = levelNamePopup->getName(); @@ -1385,7 +1385,7 @@ void CloneLevelUndo::cloneLevels() const { bool askCloneName = (levels.size() == 1); // Now, try to clone every found level in the associated range - std::auto_ptr dialog; + std::unique_ptr dialog; ExistsFunc exists(scene); LevelsMap::iterator lt, lEnd(levels.end()); @@ -1533,7 +1533,7 @@ void CloneLevelUndo::undo() const { //----------------------------------------------------------------------------- void TCellSelection::cloneLevel() { - std::auto_ptr undo(new CloneLevelUndo(m_range)); + std::unique_ptr undo(new CloneLevelUndo(m_range)); if (undo->redo(), undo->m_ok) TUndoManager::manager()->add(undo.release()); } diff --git a/toonz/sources/toonz/columncommand.cpp b/toonz/sources/toonz/columncommand.cpp index 07f5d48..0aa1e17 100644 --- a/toonz/sources/toonz/columncommand.cpp +++ b/toonz/sources/toonz/columncommand.cpp @@ -539,7 +539,7 @@ class DeleteColumnsUndo final : public TUndo { QMap> m_columnObjChildren; QMap m_columnObjParents; - mutable std::auto_ptr m_data; + mutable std::unique_ptr m_data; public: DeleteColumnsUndo(const std::set &indices) @@ -736,7 +736,7 @@ void ColumnCmd::insertEmptyColumns(const std::set &indices) { std::vector positiveIndices(indices.lower_bound(0), indices.end()); if (positiveIndices.empty()) return; - std::auto_ptr undo( + std::unique_ptr undo( new InsertEmptyColumnsUndo(positiveIndices)); if (undo->isConsistent()) { undo->redo(); diff --git a/toonz/sources/toonz/drawingdata.cpp b/toonz/sources/toonz/drawingdata.cpp index 4eb2bdc..370f22f 100644 --- a/toonz/sources/toonz/drawingdata.cpp +++ b/toonz/sources/toonz/drawingdata.cpp @@ -385,7 +385,7 @@ TImageP DrawingData::getImage(QString imageId, TXshSimpleLevel *sl, ToonzScene *scene = sl->getScene(); assert(scene); - std::auto_ptr config( + std::unique_ptr config( scene->getProperties() ->getVectorizerParameters() ->getCurrentConfiguration(0.0)); diff --git a/toonz/sources/toonz/exportlevelcommand.cpp b/toonz/sources/toonz/exportlevelcommand.cpp index 10e62f7..e0b7c90 100644 --- a/toonz/sources/toonz/exportlevelcommand.cpp +++ b/toonz/sources/toonz/exportlevelcommand.cpp @@ -217,7 +217,7 @@ class ImageExporter { ExportLevelOptions m_opts; TRasterP m_rout; - std::auto_ptr m_glContext; + std::unique_ptr m_glContext; public: ImageExporter(const TXshSimpleLevel &sl, const ExportLevelOptions &opts) @@ -536,9 +536,9 @@ bool IoCmd::exportLevel(const TFilePath &path, TXshSimpleLevel *sl, assert(opts.m_camera.getRes().lx > 0 && opts.m_camera.getRes().ly > 0); // Callbacks - std::auto_ptr overwriteDefault( + std::unique_ptr overwriteDefault( overwriteCB ? 0 : (overwriteCB = new ExportOverwriteCB())); - std::auto_ptr progressDefault( + std::unique_ptr progressDefault( progressCB ? 0 : (progressCB = new ExportProgressCB())); // Initialize variables diff --git a/toonz/sources/toonz/exportlevelpopup.cpp b/toonz/sources/toonz/exportlevelpopup.cpp index 35cef83..c5e0a2d 100644 --- a/toonz/sources/toonz/exportlevelpopup.cpp +++ b/toonz/sources/toonz/exportlevelpopup.cpp @@ -708,7 +708,7 @@ ExportLevelPopup::ExportOptions::ExportOptions(QWidget *parent) QLabel *bgColorLabel = new QLabel(tr("Background Color:")); m_bgColorField = - new DVGui::ColorField(0, false, TPixel32::Black, 35, false); + new DVGui::ColorField(0, false, TPixel32::White, 35, false); layout->addWidget(bgColorLabel, row, 1, Qt::AlignRight); layout->addWidget(m_bgColorField, row++, 2, Qt::AlignLeft); diff --git a/toonz/sources/toonz/filmstrip.cpp b/toonz/sources/toonz/filmstrip.cpp index a20b94b..ec00be4 100644 --- a/toonz/sources/toonz/filmstrip.cpp +++ b/toonz/sources/toonz/filmstrip.cpp @@ -34,6 +34,7 @@ #include "toonz/tscenehandle.h" #include "toonz/toonzscene.h" #include "toonz/levelset.h" +#include "toonz/preferences.h" // TnzCore includes #include "tpalette.h" @@ -49,6 +50,46 @@ #include #include +namespace { +QString fidToFrameNumberWithLetter(int f) { + QString str = QString::number((int)(f / 10)); + while (str.length() < 3) str.push_front("0"); + switch (f % 10) { + case 1: + str.append('A'); + break; + case 2: + str.append('B'); + break; + case 3: + str.append('C'); + break; + case 4: + str.append('D'); + break; + case 5: + str.append('E'); + break; + case 6: + str.append('F'); + break; + case 7: + str.append('G'); + break; + case 8: + str.append('H'); + break; + case 9: + str.append('I'); + break; + default: + str.append(' '); + break; + } + return str; +} +} // namespace + //============================================================================= // Filmstrip //----------------------------------------------------------------------------- @@ -538,17 +579,21 @@ void FilmstripFrames::paintEvent(QPaintEvent *evt) { p.setBrush(Qt::NoBrush); // for single frame + QString text; if (fid.getNumber() == TFrameId::EMPTY_FRAME || fid.getNumber() == TFrameId::NO_FRAME) { - p.drawText(tmp_frameRect.adjusted(0, 0, -3, 2), "Single Frame", - QTextOption(Qt::AlignRight | Qt::AlignBottom)); + text = QString("Single Frame"); + } + // for sequencial frame (with letter) + else if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) { + text = fidToFrameNumberWithLetter(fid.getNumber()); } // for sequencial frame else { - p.drawText(tmp_frameRect.adjusted(0, 0, -3, 2), - QString().setNum(fid.getNumber()).rightJustified(4, '0'), - QTextOption(Qt::AlignRight | Qt::AlignBottom)); + text = QString::number(fid.getNumber()).rightJustified(4, '0'); } + p.drawText(tmp_frameRect.adjusted(0, 0, -3, 2), text, + QTextOption(Qt::AlignRight | Qt::AlignBottom)); p.setPen(Qt::NoPen); // Read-only frames (lock) diff --git a/toonz/sources/toonz/formatsettingspopups.cpp b/toonz/sources/toonz/formatsettingspopups.cpp index e36e5e1..c053324 100644 --- a/toonz/sources/toonz/formatsettingspopups.cpp +++ b/toonz/sources/toonz/formatsettingspopups.cpp @@ -157,9 +157,11 @@ void FormatSettingsPopup::buildValueField(int index, TPropertyGroup *props) { m_mainLayout->addWidget(new QLabel(tr(prop->getName().c_str()) + ":", this), row, 0, Qt::AlignRight | Qt::AlignVCenter); m_mainLayout->addWidget(v, row, 1); - + // get value here - bug loses value if the range doesn't start with 0 + double value = prop->getValue(); v->setValues(prop->getValue(), prop->getRange().first, prop->getRange().second); + if (prop->getValue() != value) { prop->setValue(value); } } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/frameheadgadget.cpp b/toonz/sources/toonz/frameheadgadget.cpp index dc318d3..e6ab484 100644 --- a/toonz/sources/toonz/frameheadgadget.cpp +++ b/toonz/sources/toonz/frameheadgadget.cpp @@ -659,4 +659,3 @@ public: enableOnionSkin(checked); } } onionSkinToggle; - diff --git a/toonz/sources/toonz/insertfxpopup.cpp b/toonz/sources/toonz/insertfxpopup.cpp index 8206c15..ed7ed17 100644 --- a/toonz/sources/toonz/insertfxpopup.cpp +++ b/toonz/sources/toonz/insertfxpopup.cpp @@ -249,7 +249,7 @@ void InsertFxPopup::loadFolder(QTreeWidgetItem *parent) { // Found a sub-folder QString folderName = QString::fromStdString(tagName); - std::auto_ptr folder( + std::unique_ptr folder( new QTreeWidgetItem((QTreeWidget *)0, QStringList(folderName))); folder->setIcon(0, m_folderIcon); diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index 47e83c3..d9f6345 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -1287,12 +1287,11 @@ void IoCmd::newScene() { TDimensionD((double)res.lx / cameraDpi, (double)res.ly / cameraDpi)); scene->getProperties()->setBgColor(TPixel32::White); TProjectManager::instance()->initializeScene(scene); - if (Preferences::instance()->getPixelsOnly()) - { - TCamera *updateCamera = scene->getCurrentCamera(); - TDimension updateRes = updateCamera->getRes(); - updateCamera->setSize( - TDimensionD((double)updateRes.lx / cameraDpi, (double)updateRes.ly / cameraDpi)); + if (Preferences::instance()->getPixelsOnly()) { + TCamera *updateCamera = scene->getCurrentCamera(); + TDimension updateRes = updateCamera->getRes(); + updateCamera->setSize(TDimensionD((double)updateRes.lx / cameraDpi, + (double)updateRes.ly / cameraDpi)); } // Must set current scene after initializeScene!! app->getCurrentScene()->setScene(scene); @@ -1960,7 +1959,8 @@ std::vector //! Returns the number of actually loaded levels static int createSubXSheetFromPSDFolder(IoCmd::LoadResourceArguments &args, - TXsheet *xsh, int &col0, int psdLevelIndex, + TXsheet *xsh, int &col0, + int psdLevelIndex, PsdSettingsPopup *popup) { assert(popup->isFolder(psdLevelIndex)); @@ -2016,8 +2016,8 @@ static int createSubXSheetFromPSDFolder(IoCmd::LoadResourceArguments &args, // Load a psd file //! Returns the number of actually loaded levels -static int loadPSDResource(IoCmd::LoadResourceArguments &args, bool updateRecentFile, - PsdSettingsPopup *popup) { +static int loadPSDResource(IoCmd::LoadResourceArguments &args, + bool updateRecentFile, PsdSettingsPopup *popup) { int &row0 = args.row0; int &col0 = args.col0; int &row1 = args.row1; diff --git a/toonz/sources/toonz/levelcreatepopup.cpp b/toonz/sources/toonz/levelcreatepopup.cpp index 8442974..2a7ed3d 100644 --- a/toonz/sources/toonz/levelcreatepopup.cpp +++ b/toonz/sources/toonz/levelcreatepopup.cpp @@ -302,7 +302,7 @@ void LevelCreatePopup::updatePath() { //----------------------------------------------------------------------------- void LevelCreatePopup::nextName() { - const std::auto_ptr nameBuilder(NameBuilder::getBuilder(L"")); + const std::unique_ptr nameBuilder(NameBuilder::getBuilder(L"")); TLevelSet *levelSet = TApp::instance()->getCurrentScene()->getScene()->getLevelSet(); diff --git a/toonz/sources/toonz/loadfoldercommand.cpp b/toonz/sources/toonz/loadfoldercommand.cpp index 7808c1a..950d518 100644 --- a/toonz/sources/toonz/loadfoldercommand.cpp +++ b/toonz/sources/toonz/loadfoldercommand.cpp @@ -366,7 +366,7 @@ TFilePath dstPath(const TFilePath &dstDir, const Resource::Component &comp) { struct import_Locals { const ToonzScene &m_scene; - std::auto_ptr m_overwriteDialog; + std::unique_ptr m_overwriteDialog; void switchToDst(Resource::Path &path) { path.m_rootFp = m_scene.decodeFilePath( @@ -423,7 +423,7 @@ struct import_Locals { void import(const ToonzScene &scene, std::vector &resources, IoCmd::LoadResourceArguments::ScopedBlock &sb) { - import_Locals locals = {scene, std::auto_ptr()}; + import_Locals locals = {scene, std::unique_ptr()}; // Setup import GUI int r, rCount = resources.size(); diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index 00dd059..90e2de7 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -319,7 +319,7 @@ int main(int argc, char *argv[]) { // order ONLY within the same library. On MAC, it made the app crash on exit // o_o. So, nope. - std::auto_ptr mainScope(new QObject( + std::unique_ptr mainScope(new QObject( &a)); // A QObject destroyed before the qApp is therefore explicitly mainScope->setObjectName("mainScope"); // provided. It can be accessed by // looking in the qApp's children. diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 2cedecf..eeea127 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -435,11 +435,23 @@ centralWidget->setLayout(centralWidgetLayout);*/ setCommandHandler(MI_About, this, &MainWindow::onAbout); setCommandHandler(MI_MaximizePanel, this, &MainWindow::maximizePanel); setCommandHandler(MI_FullScreenWindow, this, &MainWindow::fullScreenWindow); + //remove ffmpegCache if still exists from crashed exit + QString ffmpegCachePath = ToonzFolder::getCacheRootFolder().getQString() + "//ffmpeg"; + if (TSystem::doesExistFileOrLevel(TFilePath(ffmpegCachePath))) { + TSystem::rmDirTree(TFilePath(ffmpegCachePath)); + } } //----------------------------------------------------------------------------- -MainWindow::~MainWindow() { TEnv::saveAllEnvVariables(); } +MainWindow::~MainWindow() { + TEnv::saveAllEnvVariables(); + //cleanup ffmpeg cache + QString ffmpegCachePath = ToonzFolder::getCacheRootFolder().getQString() + "//ffmpeg"; + if (TSystem::doesExistFileOrLevel(TFilePath(ffmpegCachePath))) { + TSystem::rmDirTree(TFilePath(ffmpegCachePath)); + } +} //----------------------------------------------------------------------------- @@ -1908,7 +1920,7 @@ void MainWindow::defineActions() { createToggle(MI_OnionSkin, tr("Onion Skin Toggle"), "//", false, RightClickMenuCommandType); - createToggle(MI_ZeroThick, tr("Zero Thick Lines"), "Shift+/", false, + createToggle(MI_ZeroThick, tr("Zero Thick Lines"), "Shift+/", false, RightClickMenuCommandType); // createRightClickMenuAction(MI_LoadSubSceneFile, tr("Load As diff --git a/toonz/sources/toonz/meshifypopup.cpp b/toonz/sources/toonz/meshifypopup.cpp index bf51ea7..4138011 100644 --- a/toonz/sources/toonz/meshifypopup.cpp +++ b/toonz/sources/toonz/meshifypopup.cpp @@ -121,7 +121,7 @@ TRaster32P render(const TVectorImageP &vi, double &rasDpi, int margin, rasDpi = scale * Stage::inch; // Initialize a corresponding OpenGL context - std::auto_ptr offlineGlContext(new TOfflineGL(bbox.getSize())); + std::unique_ptr offlineGlContext(new TOfflineGL(bbox.getSize())); offlineGlContext->makeCurrent(); // Draw the image @@ -936,8 +936,9 @@ void createMeshifiedLevels(std::map &meshLevels, } // Prepare a progress dialog - std::auto_ptr progressDialog(new DVGui::ProgressDialog( - MeshifyPopup::tr("Mesh Creation in progress..."), QString(), 0, 0)); + std::unique_ptr progressDialog( + new DVGui::ProgressDialog( + MeshifyPopup::tr("Mesh Creation in progress..."), QString(), 0, 0)); { progressDialog->setWindowTitle("Create Mesh"); progressDialog->setModal(true); diff --git a/toonz/sources/toonz/outputsettingspopup.cpp b/toonz/sources/toonz/outputsettingspopup.cpp index 78d58fa..e8a57b9 100644 --- a/toonz/sources/toonz/outputsettingspopup.cpp +++ b/toonz/sources/toonz/outputsettingspopup.cpp @@ -943,6 +943,13 @@ void OutputSettingsPopup::onFormatChanged(const QString &str) { TApp::instance()->getCurrentScene()->setDirtyFlag(true); if (m_presetCombo) m_presetCombo->setCurrentIndex(0); + if (str == "mp4" || str == "gif" || str == "webm") { + m_threadsComboOm->setDisabled(true); + m_threadsComboOm->setCurrentIndex(0); + } else { + m_threadsComboOm->setDisabled(false); + m_threadsComboOm->setCurrentIndex(2); + } } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/penciltestpopup.cpp b/toonz/sources/toonz/penciltestpopup.cpp index 261b08e..4667d68 100644 --- a/toonz/sources/toonz/penciltestpopup.cpp +++ b/toonz/sources/toonz/penciltestpopup.cpp @@ -28,6 +28,7 @@ #include "toonz/txshsimplelevel.h" #include "toonz/levelproperties.h" #include "toonz/tcamera.h" +#include "toonz/preferences.h" // TnzCore includes #include "tsystem.h" @@ -61,6 +62,8 @@ #include #include #include +#include +#include using namespace DVGui; @@ -235,6 +238,69 @@ TPointD getCurrentCameraDpi() { return TPointD(res.lx / size.lx, res.ly / size.ly); } +//----------------------------------------------------------------------------- + +QChar numToLetter(int letterNum) { + switch (letterNum) { + case 0: + return QChar(); + break; + case 1: + return 'A'; + break; + case 2: + return 'B'; + break; + case 3: + return 'C'; + break; + case 4: + return 'D'; + break; + case 5: + return 'E'; + break; + case 6: + return 'F'; + break; + case 7: + return 'G'; + break; + case 8: + return 'H'; + break; + case 9: + return 'I'; + break; + default: + return QChar(); + break; + } +} + +int letterToNum(QChar appendix) { + if (appendix == QChar('A') || appendix == QChar('a')) + return 1; + else if (appendix == QChar('B') || appendix == QChar('b')) + return 2; + else if (appendix == QChar('C') || appendix == QChar('c')) + return 3; + else if (appendix == QChar('D') || appendix == QChar('d')) + return 4; + else if (appendix == QChar('E') || appendix == QChar('e')) + return 5; + else if (appendix == QChar('F') || appendix == QChar('f')) + return 6; + else if (appendix == QChar('G') || appendix == QChar('g')) + return 7; + else if (appendix == QChar('H') || appendix == QChar('h')) + return 8; + else if (appendix == QChar('I') || appendix == QChar('i')) + return 9; + else + return 0; +} + } // namespace //============================================================================= @@ -262,6 +328,8 @@ void MyViewFinder::paintEvent(QPaintEvent* event) { return; } + p.save(); + if (m_upsideDown) { p.translate(m_imageRect.center()); p.rotate(180); @@ -281,6 +349,8 @@ void MyViewFinder::paintEvent(QPaintEvent* event) { p.setCompositionMode(QPainter::CompositionMode_SourceOver); } + p.restore(); + // draw countdown text if (m_countDownTime > 0) { QString str = @@ -313,6 +383,72 @@ void MyViewFinder::resizeEvent(QResizeEvent* event) { //============================================================================= +FrameNumberLineEdit::FrameNumberLineEdit(QWidget* parent, int value) + : LineEdit(parent) { + setFixedWidth(54); + m_intValidator = new QIntValidator(this); + setValue(value); + m_intValidator->setRange(1, 9999); + + QRegExp rx("^[0-9]{1,4}[A-Ia-i]?$"); + m_regexpValidator = new QRegExpValidator(rx, this); + + updateValidator(); +} + +//----------------------------------------------------------------------------- + +void FrameNumberLineEdit::updateValidator() { + if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) + setValidator(m_regexpValidator); + else + setValidator(m_intValidator); +} + +//----------------------------------------------------------------------------- + +void FrameNumberLineEdit::setValue(int value) { + if (value <= 0) + value = 1; + else if (value > 9999) + value = 9999; + + QString str; + if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) { + str.setNum((int)(value / 10)); + while (str.length() < 3) str.push_front("0"); + QChar letter = numToLetter(value % 10); + if (!letter.isNull()) str.append(letter); + } else { + str.setNum(value); + while (str.length() < 4) str.push_front("0"); + } + setText(str); + setCursorPosition(0); +} + +//----------------------------------------------------------------------------- + +int FrameNumberLineEdit::getValue() { + if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) { + QString str = text(); + // if no letters added + if (str.at(str.size() - 1).isDigit()) + return str.toInt() * 10; + else { + return str.left(str.size() - 1).toInt() * 10 + + letterToNum(str.at(str.size() - 1)); + } + } else + return text().toInt(); +} + +//----------------------------------------------------------------------------- + +void FrameNumberLineEdit::focusOutEvent(QFocusEvent*) {} + +//============================================================================= + PencilTestPopup::PencilTestPopup() : Dialog(TApp::instance()->getMainWindow(), false, false, "PencilTest") , m_currentCamera(0) @@ -342,9 +478,14 @@ PencilTestPopup::PencilTestPopup() QPushButton* refreshCamListButton = new QPushButton(tr("Refresh"), this); m_resolutionCombo = new QComboBox(this); - QGroupBox* fileFrame = new QGroupBox(tr("File"), this); - m_levelNameEdit = new QLineEdit(this); - m_frameNumberEdit = new IntLineEdit(this, 1, 1, INT_MAX, 4); + QGroupBox* fileFrame = new QGroupBox(tr("File"), this); + m_levelNameEdit = new QLineEdit(this); + // set the start frame 10 if the option in preferences + // "Show ABC Appendix to the Frame Number in Xsheet Cell" is active. + // (frame 10 is displayed as "1" with this option) + int startFrame = + Preferences::instance()->isShowFrameNumberWithLettersEnabled() ? 10 : 1; + m_frameNumberEdit = new FrameNumberLineEdit(this, startFrame); m_fileTypeCombo = new QComboBox(this); m_fileFormatOptionButton = new QPushButton(tr("Options"), this); m_saveInFileFld = new FileField( @@ -798,7 +939,12 @@ void PencilTestPopup::onNextName() { } m_levelNameEdit->setText(QString::fromStdWString(levelName)); - m_frameNumberEdit->setValue(1); + // set the start frame 10 if the option in preferences + // "Show ABC Appendix to the Frame Number in Xsheet Cell" is active. + // (frame 10 is displayed as "1" with this option) + int startFrame = + Preferences::instance()->isShowFrameNumberWithLettersEnabled() ? 10 : 1; + m_frameNumberEdit->setValue(startFrame); } //----------------------------------------------------------------------------- @@ -825,7 +971,11 @@ void PencilTestPopup::onImageCaptured(int id, const QImage& image) { m_captureCue = false; if (importImage(procImg)) { m_cameraViewfinder->setPreviousImage(procImg); - m_frameNumberEdit->setValue(m_frameNumberEdit->getValue() + 1); + if (Preferences::instance()->isShowFrameNumberWithLettersEnabled()) { + int f = m_frameNumberEdit->getValue(); + m_frameNumberEdit->setValue(((int)(f / 10) + 1) * 10); + } else + m_frameNumberEdit->setValue(m_frameNumberEdit->getValue() + 1); // restart interval timer for capturing next frame (it is single shot) if (m_timerCB->isChecked() && m_captureButton->isChecked()) { diff --git a/toonz/sources/toonz/penciltestpopup.h b/toonz/sources/toonz/penciltestpopup.h index 7b56e1f..d2150ba 100644 --- a/toonz/sources/toonz/penciltestpopup.h +++ b/toonz/sources/toonz/penciltestpopup.h @@ -4,6 +4,7 @@ #define PENCILTESTPOPUP_H #include "toonzqt/dvdialog.h" +#include "toonzqt/lineedit.h" #include @@ -18,10 +19,11 @@ class QCheckBox; class QPushButton; class QVideoFrame; class QTimer; +class QIntValidator; +class QRegExpValidator; namespace DVGui { class FileField; -class IntLineEdit; class IntField; } @@ -67,6 +69,37 @@ protected slots: }; //============================================================================= +// FrameNumberLineEdit +// a special Line Edit which accepts imputting alphabets if the preference +// option +// "Show ABC Appendix to the Frame Number in Xsheet Cell" is active. +//----------------------------------------------------------------------------- + +class FrameNumberLineEdit : public DVGui::LineEdit { + Q_OBJECT + /* having two validators and switch them according to the preferences*/ + QIntValidator* m_intValidator; + QRegExpValidator* m_regexpValidator; + + void updateValidator(); + +public: + FrameNumberLineEdit(QWidget* parent = 0, int value = 1); + ~FrameNumberLineEdit() {} + + /*! Set text in field to \b value. */ + void setValue(int value); + /*! Return an integer with text field value. */ + int getValue(); + +protected: + /*! If focus is lost and current text value is out of range emit signal + \b editingFinished.*/ + void focusOutEvent(QFocusEvent*) override; + void showEvent(QShowEvent* event) override { updateValidator(); } +}; + +//============================================================================= // PencilTestPopup //----------------------------------------------------------------------------- @@ -85,7 +118,7 @@ class PencilTestPopup : public DVGui::Dialog { QPushButton *m_fileFormatOptionButton, *m_captureWhiteBGButton, *m_captureButton; DVGui::FileField* m_saveInFileFld; - DVGui::IntLineEdit* m_frameNumberEdit; + FrameNumberLineEdit* m_frameNumberEdit; DVGui::IntField *m_thresholdFld, *m_contrastFld, *m_brightnessFld, *m_bgReductionFld, *m_onionOpacityFld, *m_timerIntervalFld; diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 9c8cc9f..0ac1767 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -227,12 +227,15 @@ void PreferencesPopup::onPixelsOnlyChanged(int index) { camSize.lx = camRes.lx / 53.33333; camSize.ly = camRes.ly / 53.33333; camera->setSize(camSize); - TDimension cleanupRes = CleanupSettingsModel::instance()->getCurrentParameters()->m_camera.getRes(); + TDimension cleanupRes = CleanupSettingsModel::instance() + ->getCurrentParameters() + ->m_camera.getRes(); TDimensionD cleanupSize; cleanupSize.lx = cleanupRes.lx / 53.33333; cleanupSize.ly = cleanupRes.ly / 53.33333; - CleanupSettingsModel::instance()->getCurrentParameters()->m_camera.setSize(cleanupSize); - m_pref->storeOldUnits(); + CleanupSettingsModel::instance()->getCurrentParameters()->m_camera.setSize( + cleanupSize); + m_pref->storeOldUnits(); if (m_unitOm->currentIndex() != 4) m_unitOm->setCurrentIndex(4); if (m_cameraUnitOm->currentIndex() != 4) m_cameraUnitOm->setCurrentIndex(4); m_unitOm->setDisabled(true); @@ -839,6 +842,19 @@ void PreferencesPopup::onRegionAntialiasChanged(int on) { m_pref->setRegionAntialias(on); } +//----------------------------------------------------------------------------- + +void PreferencesPopup::onFfmpegPathChanged() { + QString text = m_ffmpegPathFileFld->getPath(); + m_pref->setFfmpegPath(text.toStdString()); +} + +//----------------------------------------------------------------------------- + +void PreferencesPopup::onFfmpegTimeoutChanged() { + m_pref->setFfmpegTimeout(m_ffmpegTimeout->getValue()); +} + //********************************************************************************** // PrefencesPopup's constructor //********************************************************************************** @@ -971,6 +987,11 @@ PreferencesPopup::PreferencesPopup() QComboBox *paletteTypeForRasterColorModelComboBox = new QComboBox(this); + //--- Import/Export ------------------------------ + categoryList->addItem(tr("Import/Export")); + m_ffmpegPathFileFld = new DVGui::FileField(this, QString("")); + m_ffmpegTimeout = new DVGui::IntLineEdit(this, 30, 1); + //--- Drawing ------------------------------ categoryList->addItem(tr("Drawing")); @@ -1170,6 +1191,11 @@ PreferencesPopup::PreferencesPopup() paletteTypeForRasterColorModelComboBox->setCurrentIndex( m_pref->getPaletteTypeOnLoadRasterImageAsColorModel()); + //--- Import/Export ------------------------------ + QString path = m_pref->getFfmpegPath(); + m_ffmpegPathFileFld->setPath(path); + m_ffmpegTimeout->setValue(m_pref->getFfmpegTimeout()); + //--- Drawing ------------------------------ keepOriginalCleanedUpCB->setChecked(m_pref->isSaveUnpaintedInCleanupEnable()); multiLayerStylePickerCB->setChecked(m_pref->isMultiLayerStylePickerEnabled()); @@ -1505,6 +1531,55 @@ PreferencesPopup::PreferencesPopup() loadingBox->setLayout(loadingFrameLay); stackedWidget->addWidget(loadingBox); + //--- Import/Export -------------------------- + QWidget *ioBox = new QWidget(this); + QVBoxLayout *ioLay = new QVBoxLayout(); + ioLay->setMargin(15); + ioLay->setSpacing(10); + { + ioLay->addWidget( + new QLabel( + tr("OpenToonz can use FFmpeg for additional file formats.")), + 0, Qt::AlignCenter | Qt::AlignVCenter); + ioLay->addWidget(new QLabel(tr("FFmpeg is not bundled with OpenToonz")), + 0, Qt::AlignCenter | Qt::AlignVCenter); + ioLay->addWidget(new QLabel(" "), + 0, Qt::AlignCenter | Qt::AlignVCenter); + ioLay->addWidget(new QLabel(tr("NOTE: This is an experimental feature.")), + 0, Qt::AlignCenter | Qt::AlignVCenter); + ioLay->addWidget(new QLabel(tr("Please SAVE YOUR WORK before exporting " + "in MP4, WEBM, or GIF format.")), + 0, Qt::AlignCenter | Qt::AlignVCenter); + ioLay->addWidget(new QLabel(" "), + 0, Qt::AlignCenter | Qt::AlignVCenter); + ioLay->addWidget(new QLabel(tr("Please provide the path where FFmpeg is " + "located on your computer.")), + 0, Qt::AlignLeft | Qt::AlignVCenter); + QGridLayout *ioGridLay = new QGridLayout(); + ioGridLay->setVerticalSpacing(10); + ioGridLay->setHorizontalSpacing(15); + ioGridLay->setMargin(0); + { + ioGridLay->addWidget(new QLabel(tr("FFmpeg Path: ")), 0, 0, + Qt::AlignRight); + ioGridLay->addWidget(m_ffmpegPathFileFld, 0, 1, 1, 3); + ioGridLay->addWidget(new QLabel(" "), 1, 0); + ioGridLay->addWidget(new QLabel(tr("Number of seconds to wait for FFmpeg to complete " + "processing the output:")), 2, 0, 1, 4); + ioGridLay->addWidget(new QLabel(tr("Note: FFmpeg begins working once all images " + "have been processed.")), 3, 0, 1, 4); + ioGridLay->addWidget(new QLabel(tr("FFmpeg Timeout:")), 4, 0, + Qt::AlignRight); + ioGridLay->addWidget(m_ffmpegTimeout, 4, 1, 1, 3); + } + ioLay->addLayout(ioGridLay); + ioLay->addStretch(1); + + ioLay->addWidget(note_version, 0); + } + ioBox->setLayout(ioLay); + stackedWidget->addWidget(ioBox); + //--- Drawing -------------------------- QWidget *drawingBox = new QWidget(this); QVBoxLayout *drawingFrameLay = new QVBoxLayout(); @@ -1841,6 +1916,12 @@ PreferencesPopup::PreferencesPopup() SIGNAL(currentIndexChanged(int)), this, SLOT(onPaletteTypeForRasterColorModelChanged(int))); + //--- Import/Export ---------------------- + ret = ret && connect(m_ffmpegPathFileFld, SIGNAL(pathChanged()), this, + SLOT(onFfmpegPathChanged())); + ret = ret && connect(m_ffmpegTimeout, SIGNAL(editingFinished()), this, + SLOT(onFfmpegTimeoutChanged())); + //--- Drawing ---------------------- ret = ret && connect(keepOriginalCleanedUpCB, SIGNAL(stateChanged(int)), this, SLOT(onSaveUnpaintedInCleanupChanged(int))); diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index 07f0c9d..8e8b640 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -9,6 +9,7 @@ #include "toonzqt/doublefield.h" #include "toonzqt/colorfield.h" #include "toonzqt/checkbox.h" +#include "toonzqt/filefield.h" // TnzLib includes #include "toonz/preferences.h" @@ -62,13 +63,15 @@ private: DVGui::IntLineEdit *m_minuteFld, *m_chunkSizeFld, *m_iconSizeLx, *m_iconSizeLy, *m_viewShrink, *m_viewStep, *m_blanksCount, *m_onionPaperThickness, *m_animationStepField, *m_undoMemorySize, - *m_xsheetStep; + *m_xsheetStep, *m_ffmpegTimeout; QPushButton *m_addLevelFormat, *m_removeLevelFormat, *m_editLevelFormat; DVGui::CheckBox *m_inksOnly, *m_enableVersionControl, *m_levelsBackup, *m_onionSkinVisibility, *m_pixelsOnlyCB; + DVGui::FileField *m_ffmpegPathFileFld; + private: // QWidget* create(const QString& lbl, bool def, const char* slot); void rebuildFormatsList(); @@ -148,6 +151,8 @@ private slots: void onShowFrameNumberWithLettersChanged(int index); void onPaletteTypeForRasterColorModelChanged(int index); void onShowKeyframesOnCellAreaChanged(int); + void onFfmpegPathChanged(); + void onFfmpegTimeoutChanged(); }; //********************************************************************************** diff --git a/toonz/sources/toonz/rendercommand.cpp b/toonz/sources/toonz/rendercommand.cpp index 1171ddb..adaf9f8 100644 --- a/toonz/sources/toonz/rendercommand.cpp +++ b/toonz/sources/toonz/rendercommand.cpp @@ -128,7 +128,8 @@ public: if (Preferences::instance()->isGeneratedMovieViewEnabled()) { if (!isPreview && (Preferences::instance()->isDefaultViewerEnabled()) && (m_fp.getType() == "mov" || m_fp.getType() == "avi" || - m_fp.getType() == "3gp")) { + m_fp.getType() == "3gp" || m_fp.getType() == "mp4" || + m_fp.getType() == "gif" || m_fp.getType() == "webm")) { QString name = QString::fromStdString(m_fp.getName()); int index; if ((index = name.indexOf("#RENDERID")) != -1) //! quite ugly I @@ -169,15 +170,19 @@ public: prop->m_frameRate = outputSettings.getFrameRate(); TSoundTrack *snd = app->getCurrentXsheet()->getXsheet()->makeSound(prop); - if (outputSettings.getRenderSettings().m_stereoscopic) { - assert(!isPreview); - ::viewFile(m_fp.withName(m_fp.getName() + "_l"), r0 + 1, r1 + 1, step, - isPreview ? rs.m_shrinkX : 1, snd, 0, false, true); - ::viewFile(m_fp.withName(m_fp.getName() + "_r"), r0 + 1, r1 + 1, step, - isPreview ? rs.m_shrinkX : 1, snd, 0, false, true); - } else - ::viewFile(m_fp, r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, - snd, 0, false, true); + // keeps ffmpeg files from being previewed until import is fixed + if (m_fp.getType() != "mp4" && m_fp.getType() != "webm" && + m_fp.getType() != "gif") { + if (outputSettings.getRenderSettings().m_stereoscopic) { + assert(!isPreview); + ::viewFile(m_fp.withName(m_fp.getName() + "_l"), r0 + 1, r1 + 1, + step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true); + ::viewFile(m_fp.withName(m_fp.getName() + "_r"), r0 + 1, r1 + 1, + step, isPreview ? rs.m_shrinkX : 1, snd, 0, false, true); + } else + ::viewFile(m_fp, r0 + 1, r1 + 1, step, isPreview ? rs.m_shrinkX : 1, + snd, 0, false, true); + } } } } @@ -381,7 +386,7 @@ void RenderCommand::flashRender() { class RenderListener final : public DVGui::ProgressDialog, public MovieRenderer::Listener { QString m_progressBarString; - int m_frameCounter; + int m_frameCounter, m_totalFrames; TRenderer *m_renderer; bool m_error; @@ -428,13 +433,17 @@ public: m_progressBarString = QString::number(steps) + ((isPreview) ? "" : " of " + toQString(path)); // setMinimumDuration (0); + m_totalFrames = steps; show(); } /*-- 以下3つの関数はMovieRenderer::Listenerの純粋仮想関数の実装 --*/ bool onFrameCompleted(int frame) override { bool ret = wasCanceled(); - Message(this, ret ? -1 : ++m_frameCounter, m_progressBarString).send(); + if (m_frameCounter + 1 < m_totalFrames) + Message(this, ret ? -1 : ++m_frameCounter, m_progressBarString).send(); + else + setLabelText(tr("Finalizing render, please wait.")); return !ret; } bool onFrameFailed(int frame, TException &) override { @@ -491,7 +500,10 @@ void RenderCommand::rasterRender(bool isPreview) { TPixel32 currBgColor = scene->getProperties()->getBgColor(); m_priorBgColor = currBgColor; - if (ext == "jpg" || ext == "avi" || ext == "bmp") { + // fixes background colors for non alpha-enabled export types (eventually + // transparent gif would be good) + if (ext == "jpg" || ext == "avi" || ext == "bmp" || ext == "mp4" || + ext == "webm" || ext == "gif") { currBgColor.m = 255; scene->getProperties()->setBgColor(currBgColor); } @@ -532,7 +544,11 @@ void RenderCommand::rasterRender(bool isPreview) { TPointD cameraDpi = isPreview ? scene->getCurrentPreviewCamera()->getDpi() : scene->getCurrentCamera()->getDpi(); movieRenderer.setDpi(cameraDpi.x, cameraDpi.y); - movieRenderer.enablePrecomputing(true); + // Precomputing causes a long delay for ffmpeg imported types + if (!isPreview && !Preferences::instance()->getPrecompute()) + movieRenderer.enablePrecomputing(false); + else + movieRenderer.enablePrecomputing(true); /*-- プログレス ダイアログの作成 --*/ RenderListener *listener = diff --git a/toonz/sources/toonz/sceneviewercontextmenu.cpp b/toonz/sources/toonz/sceneviewercontextmenu.cpp index f9c6cff..ed8c2e5 100644 --- a/toonz/sources/toonz/sceneviewercontextmenu.cpp +++ b/toonz/sources/toonz/sceneviewercontextmenu.cpp @@ -178,8 +178,8 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent) OnioniSkinMaskGUI::addOnionSkinCommand(this); // Zero Thick - if (!parent->isPreviewEnabled()) - ZeroThickToggleGui::addZeroThickCommand(this); + if (!parent->isPreviewEnabled()) + ZeroThickToggleGui::addZeroThickCommand(this); // preview if (parent->isPreviewEnabled()) { @@ -393,44 +393,41 @@ void SceneViewerContextMenu::savePreviewedFrames() { ->saveRenderedFrames(); } - - class ZeroThickToggle : public MenuItemHandler { public: - ZeroThickToggle() : MenuItemHandler(MI_ZeroThick) {} - void execute() { - QAction *action = CommandManager::instance()->getAction(MI_ZeroThick); - if (!action) - return; - bool checked = action->isChecked(); - enableZeroThick(checked); - } - - static void enableZeroThick(bool enable = true) { - Preferences::instance()->setShow0ThickLines(enable); - TApp::instance()->getCurrentScene()->notifySceneChanged(); - } -} ZeroThickToggle; + ZeroThickToggle() : MenuItemHandler(MI_ZeroThick) {} + void execute() { + QAction *action = CommandManager::instance()->getAction(MI_ZeroThick); + if (!action) return; + bool checked = action->isChecked(); + enableZeroThick(checked); + } + static void enableZeroThick(bool enable = true) { + Preferences::instance()->setShow0ThickLines(enable); + TApp::instance()->getCurrentScene()->notifySceneChanged(); + } +} ZeroThickToggle; void ZeroThickToggleGui::addZeroThickCommand(QMenu *menu) { - static ZeroThickToggleHandler switcher; - if (Preferences::instance()->getShow0ThickLines()) { - QAction *hideZeroThick = menu->addAction(QString(QObject::tr("Hide Zero Thickness Lines"))); - menu->connect(hideZeroThick, SIGNAL(triggered()), - &switcher, SLOT(deactivate())); - } - else { - QAction *showZeroThick = menu->addAction(QString(QObject::tr("Show Zero Thickness Lines"))); - menu->connect(showZeroThick, SIGNAL(triggered()), - &switcher, SLOT(activate())); - } + static ZeroThickToggleHandler switcher; + if (Preferences::instance()->getShow0ThickLines()) { + QAction *hideZeroThick = + menu->addAction(QString(QObject::tr("Hide Zero Thickness Lines"))); + menu->connect(hideZeroThick, SIGNAL(triggered()), &switcher, + SLOT(deactivate())); + } else { + QAction *showZeroThick = + menu->addAction(QString(QObject::tr("Show Zero Thickness Lines"))); + menu->connect(showZeroThick, SIGNAL(triggered()), &switcher, + SLOT(activate())); + } } void ZeroThickToggleGui::ZeroThickToggleHandler::activate() { - ZeroThickToggle::enableZeroThick(true); + ZeroThickToggle::enableZeroThick(true); } void ZeroThickToggleGui::ZeroThickToggleHandler::deactivate() { - ZeroThickToggle::enableZeroThick(false); + ZeroThickToggle::enableZeroThick(false); } \ No newline at end of file diff --git a/toonz/sources/toonz/sceneviewercontextmenu.h b/toonz/sources/toonz/sceneviewercontextmenu.h index e9ada49..09de03f 100644 --- a/toonz/sources/toonz/sceneviewercontextmenu.h +++ b/toonz/sources/toonz/sceneviewercontextmenu.h @@ -37,17 +37,16 @@ public slots: }; namespace ZeroThickToggleGui { - void addZeroThickCommand(QMenu* menu); +void addZeroThickCommand(QMenu *menu); - class ZeroThickToggleHandler : public QObject { - Q_OBJECT - - public slots: - void activate(); - void deactivate(); - }; +class ZeroThickToggleHandler : public QObject { + Q_OBJECT +public slots: + void activate(); + void deactivate(); +}; -} //Namespace ZeroThickToggleGui +} // Namespace ZeroThickToggleGui #endif diff --git a/toonz/sources/toonz/shortcutpopup.cpp b/toonz/sources/toonz/shortcutpopup.cpp index ef169ea..04d0c19 100644 --- a/toonz/sources/toonz/shortcutpopup.cpp +++ b/toonz/sources/toonz/shortcutpopup.cpp @@ -49,7 +49,7 @@ public: text.remove("&"); setText(0, text); QString shortcut = m_action->shortcut().toString(); - setText(1, shortcut); + setText(1, shortcut); } QAction *getAction() const { return m_action; } }; @@ -196,7 +196,7 @@ ShortcutTree::ShortcutTree(QWidget *parent) : QTreeWidget(parent) { addFolder(tr("File"), MenuFileCommandType, menuCommandFolder); addFolder(tr("Edit"), MenuEditCommandType, menuCommandFolder); addFolder(tr("Scan & Cleanup"), MenuScanCleanupCommandType, - menuCommandFolder); + menuCommandFolder); addFolder(tr("Level"), MenuLevelCommandType, menuCommandFolder); addFolder(tr("Xsheet"), MenuXsheetCommandType, menuCommandFolder); addFolder(tr("Cells"), MenuCellsCommandType, menuCommandFolder); @@ -225,14 +225,13 @@ ShortcutTree::~ShortcutTree() {} //----------------------------------------------------------------------------- -void ShortcutTree::addFolder(const QString &title, int commandType, - QTreeWidgetItem *parentFolder) { +void ShortcutTree::addFolder(const QString &title, int commandType, + QTreeWidgetItem *parentFolder) { QTreeWidgetItem *folder; - if (!parentFolder){ + if (!parentFolder) { folder = new QTreeWidgetItem(this); m_folders.push_back(folder); - } - else{ + } else { folder = new QTreeWidgetItem(parentFolder); m_subFolders.push_back(folder); } @@ -249,44 +248,44 @@ void ShortcutTree::addFolder(const QString &title, int commandType, //----------------------------------------------------------------------------- -void ShortcutTree::searchItems(const QString& searchWord) { - +void ShortcutTree::searchItems(const QString &searchWord) { if (searchWord.isEmpty()) { for (int i = 0; i < (int)m_items.size(); i++) m_items[i]->setHidden(false); - for (int f = 0; f < m_subFolders.size(); f++){ + for (int f = 0; f < m_subFolders.size(); f++) { m_subFolders[f]->setHidden(false); m_subFolders[f]->setExpanded(false); } - for (int f = 0; f < m_folders.size(); f++){ + for (int f = 0; f < m_folders.size(); f++) { m_folders[f]->setHidden(false); - m_folders[f]->setExpanded(f==0); + m_folders[f]->setExpanded(f == 0); } show(); emit searched(true); update(); return; } - - QList foundItems = findItems(searchWord, Qt::MatchContains | Qt::MatchRecursive, 0); - if (foundItems.isEmpty()){ + + QList foundItems = + findItems(searchWord, Qt::MatchContains | Qt::MatchRecursive, 0); + if (foundItems.isEmpty()) { hide(); emit searched(false); update(); return; } - + // show all matched items, hide all unmatched items for (int i = 0; i < (int)m_items.size(); i++) m_items[i]->setHidden(!foundItems.contains(m_items[i])); - + // hide folders which does not contain matched items // show and expand folders containing matched items bool found; - for (int f = 0; f < m_subFolders.size(); f++){ - QTreeWidgetItem* sf = m_subFolders.at(f); - found = false; - for (int i = 0; i < sf->childCount(); i++){ - if (!sf->child(i)->isHidden()){ + for (int f = 0; f < m_subFolders.size(); f++) { + QTreeWidgetItem *sf = m_subFolders.at(f); + found = false; + for (int i = 0; i < sf->childCount(); i++) { + if (!sf->child(i)->isHidden()) { found = true; break; } @@ -294,11 +293,11 @@ void ShortcutTree::searchItems(const QString& searchWord) { sf->setHidden(!found); sf->setExpanded(found); } - for (int f = 0; f < m_folders.size(); f++){ - QTreeWidgetItem* fol = m_folders.at(f); - found = false; - for (int i = 0; i < fol->childCount(); i++){ - if (!fol->child(i)->isHidden()){ + for (int f = 0; f < m_folders.size(); f++) { + QTreeWidgetItem *fol = m_folders.at(f); + found = false; + for (int i = 0; i < fol->childCount(); i++) { + if (!fol->child(i)->isHidden()) { found = true; break; } @@ -314,8 +313,7 @@ void ShortcutTree::searchItems(const QString& searchWord) { //----------------------------------------------------------------------------- -void ShortcutTree::resizeEvent(QResizeEvent *event) -{ +void ShortcutTree::resizeEvent(QResizeEvent *event) { header()->resizeSection(0, width() - 120); header()->resizeSection(1, 120); QTreeView::resizeEvent(event); @@ -351,31 +349,33 @@ ShortcutPopup::ShortcutPopup() m_sViewer = new ShortcutViewer(this); m_removeBtn = new QPushButton(tr("Remove"), this); - QLabel* noSearchResultLabel = new QLabel(tr("Couldn't find any matching command."), this); + QLabel *noSearchResultLabel = + new QLabel(tr("Couldn't find any matching command."), this); noSearchResultLabel->setHidden(true); - QLineEdit* searchEdit = new QLineEdit(this); + QLineEdit *searchEdit = new QLineEdit(this); m_topLayout->setMargin(5); m_topLayout->setSpacing(8); { - QHBoxLayout* searchLay = new QHBoxLayout(); + QHBoxLayout *searchLay = new QHBoxLayout(); searchLay->setMargin(0); searchLay->setSpacing(5); { - searchLay->addWidget(new QLabel("Search:",this),0); + searchLay->addWidget(new QLabel("Search:", this), 0); searchLay->addWidget(searchEdit); } m_topLayout->addLayout(searchLay, 0); - QVBoxLayout* listLay = new QVBoxLayout(); + QVBoxLayout *listLay = new QVBoxLayout(); listLay->setMargin(0); listLay->setSpacing(0); { - listLay->addWidget(noSearchResultLabel, 0, Qt::AlignTop|Qt::AlignHCenter); + listLay->addWidget(noSearchResultLabel, 0, + Qt::AlignTop | Qt::AlignHCenter); listLay->addWidget(m_list, 1); } - m_topLayout->addLayout(listLay,1); + m_topLayout->addLayout(listLay, 1); QHBoxLayout *bottomLayout = new QHBoxLayout(); bottomLayout->setMargin(0); @@ -395,8 +395,10 @@ ShortcutPopup::ShortcutPopup() connect(m_sViewer, SIGNAL(shortcutChanged()), m_list, SLOT(onShortcutChanged())); - connect(m_list, SIGNAL(searched(bool)), noSearchResultLabel, SLOT(setHidden(bool))); - connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onSearchTextChanged(const QString &))); + connect(m_list, SIGNAL(searched(bool)), noSearchResultLabel, + SLOT(setHidden(bool))); + connect(searchEdit, SIGNAL(textChanged(const QString &)), this, + SLOT(onSearchTextChanged(const QString &))); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonz/shortcutpopup.h b/toonz/sources/toonz/shortcutpopup.h index 84e8602..2044ac6 100644 --- a/toonz/sources/toonz/shortcutpopup.h +++ b/toonz/sources/toonz/shortcutpopup.h @@ -61,13 +61,14 @@ public: ShortcutTree(QWidget *parent = 0); ~ShortcutTree(); - void searchItems(const QString& searchWord = QString()); + void searchItems(const QString &searchWord = QString()); + protected: // aggiunge un blocco di QAction. commandType e' un // CommandType::MenubarCommandType - void addFolder(const QString &title, int commandType, + void addFolder(const QString &title, int commandType, QTreeWidgetItem *folder = 0); - + void resizeEvent(QResizeEvent *event); public slots: @@ -91,14 +92,13 @@ class ShortcutPopup final : public DVGui::Dialog { QPushButton *m_removeBtn; ShortcutViewer *m_sViewer; ShortcutTree *m_list; - + public: ShortcutPopup(); ~ShortcutPopup(); protected slots: void onSearchTextChanged(const QString &text); - }; #endif // SHORTCUTPOPUP_H diff --git a/toonz/sources/toonz/tasksviewer.cpp b/toonz/sources/toonz/tasksviewer.cpp index b9e99d8..1b2a985 100644 --- a/toonz/sources/toonz/tasksviewer.cpp +++ b/toonz/sources/toonz/tasksviewer.cpp @@ -36,7 +36,8 @@ using namespace DVGui; namespace { bool isMovieType(std::string type) { - return (type == "mov" || type == "avi" || type == "3gp"); + return (type == "mov" || type == "avi" || type == "3gp" || type == "mp4" || + type == "webm"); } }; diff --git a/toonz/sources/toonz/vectorizerpopup.cpp b/toonz/sources/toonz/vectorizerpopup.cpp index 511d1e1..3aa13db 100644 --- a/toonz/sources/toonz/vectorizerpopup.cpp +++ b/toonz/sources/toonz/vectorizerpopup.cpp @@ -243,7 +243,8 @@ void Vectorizer::setLevel(const TXshSimpleLevelP &level) { // Build the new level name std::wstring levelName = sl->getName() + L"v"; { - std::auto_ptr nameBuilder(NameBuilder::getBuilder(levelName)); + std::unique_ptr nameBuilder( + NameBuilder::getBuilder(levelName)); for (;;) { levelName = nameBuilder->getNext(); @@ -1411,8 +1412,8 @@ void VectorizerPopup::saveParameters() { // Replace data to be saved VectorizerParameters *params = getCurrentVectorizerParameters(); - std::auto_ptr paramsClone(new VectorizerParameters(*params)); - levelSettings.insert(paramsClone); + levelSettings.insert( + std::unique_ptr(new VectorizerParameters(*params))); // Save the new settings TOStream os(fp); diff --git a/toonz/sources/toonz/vectorizerswatch.cpp b/toonz/sources/toonz/vectorizerswatch.cpp index bf65f8a..2cfc4dd 100644 --- a/toonz/sources/toonz/vectorizerswatch.cpp +++ b/toonz/sources/toonz/vectorizerswatch.cpp @@ -59,9 +59,9 @@ inline TImageP getXsheetImage(int row, int col) { //----------------------------------------------------------------------------- -std::auto_ptr getCurrentVectorizerConfiguration( +std::unique_ptr getCurrentVectorizerConfiguration( int row, int col) { - typedef std::auto_ptr result_type; + typedef std::unique_ptr result_type; TApp *app = TApp::instance(); TXsheet *xsh = app->getCurrentXsheet()->getXsheet(); diff --git a/toonz/sources/toonz/vectorizerswatch.h b/toonz/sources/toonz/vectorizerswatch.h index 576c8d5..6827d9d 100644 --- a/toonz/sources/toonz/vectorizerswatch.h +++ b/toonz/sources/toonz/vectorizerswatch.h @@ -93,7 +93,7 @@ class VectorizationSwatchTask final : public TThread::Runnable { int m_row, m_col; TImageP m_image; - std::auto_ptr m_config; + std::unique_ptr m_config; public: VectorizationSwatchTask(int row, int col); diff --git a/toonz/sources/toonz/xsheetcmd.cpp b/toonz/sources/toonz/xsheetcmd.cpp index f378f60..32673fc 100644 --- a/toonz/sources/toonz/xsheetcmd.cpp +++ b/toonz/sources/toonz/xsheetcmd.cpp @@ -1299,7 +1299,8 @@ public: pegbar->getKeyframeSpan(row, r0, ease0, r1, ease1); - std::auto_ptr undo(new KeyFrameHandleCommandUndo(objectId, r0, r1)); + std::unique_ptr undo( + new KeyFrameHandleCommandUndo(objectId, r0, r1)); TStageObject::Keyframe keyframe0 = pegbar->getKeyframe(r0); TStageObject::Keyframe keyframe1 = pegbar->getKeyframe(r1); @@ -1346,7 +1347,8 @@ public: pegbar->getKeyframeSpan(row, r0, ease0, r1, ease1); - std::auto_ptr undo(new KeyFrameHandleCommandUndo(objectId, r0, r1)); + std::unique_ptr undo( + new KeyFrameHandleCommandUndo(objectId, r0, r1)); TStageObject::Keyframe keyframe0 = pegbar->getKeyframe(r0); TStageObject::Keyframe keyframe1 = pegbar->getKeyframe(r1); diff --git a/toonz/sources/toonzfarm/tfarm/CMakeLists.txt b/toonz/sources/toonzfarm/tfarm/CMakeLists.txt index 4581905..099c5c1 100644 --- a/toonz/sources/toonzfarm/tfarm/CMakeLists.txt +++ b/toonz/sources/toonzfarm/tfarm/CMakeLists.txt @@ -6,7 +6,8 @@ set(HEADERS ../include/tfarmproxy.h ../../include/tfarmserver.h ../../include/tfarmtask.h - ../include/tlog.h) + ../include/tlog.h +) set(SOURCES service.cpp @@ -18,7 +19,8 @@ set(SOURCES tfarmtask.cpp tlog.cpp ttcpipclient.cpp - ttcpipserver.cpp) + ttcpipserver.cpp +) add_library(tfarm SHARED ${HEADERS} ${SOURCES}) add_definitions( @@ -39,16 +41,19 @@ include_directories( if(WIN32) set(EXTRA_LIBS tnzcore tnzbase toonzlib - ws2_32.lib) + ws2_32.lib + ) elseif(APPLE) set(EXTRA_LIBS ${CMAKE_CURRENT_BINARY_DIR}/../../tnzcore/libtnzcore.dylib ${CMAKE_CURRENT_BINARY_DIR}/../../tnzbase/libtnzbase.dylib - ${CMAKE_CURRENT_BINARY_DIR}/../../toonzlib/libtoonzlib.dylib) + ${CMAKE_CURRENT_BINARY_DIR}/../../toonzlib/libtoonzlib.dylib + ) elseif(UNIX) _find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;toonzlib;tnzext") endif() target_link_libraries(tfarm Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Network - ${GLUT_LIB} ${GL_LIB} ${EXTRA_LIBS}) + ${GLUT_LIB} ${GL_LIB} ${EXTRA_LIBS} +) diff --git a/toonz/sources/toonzfarm/tfarmcontroller/CMakeLists.txt b/toonz/sources/toonzfarm/tfarmcontroller/CMakeLists.txt index 604062f..ca9e700 100644 --- a/toonz/sources/toonzfarm/tfarmcontroller/CMakeLists.txt +++ b/toonz/sources/toonzfarm/tfarmcontroller/CMakeLists.txt @@ -3,8 +3,10 @@ include_directories( ) add_executable(tfarmcontroller - tfarmcontroller.cpp) + tfarmcontroller.cpp +) target_link_libraries(tfarmcontroller Qt5::Core - tfarm) + tfarm +) diff --git a/toonz/sources/toonzfarm/tfarmserver/CMakeLists.txt b/toonz/sources/toonzfarm/tfarmserver/CMakeLists.txt index 80b1549..d4168e6 100644 --- a/toonz/sources/toonzfarm/tfarmserver/CMakeLists.txt +++ b/toonz/sources/toonzfarm/tfarmserver/CMakeLists.txt @@ -3,8 +3,10 @@ include_directories( ) add_executable(tfarmserver - tfarmserver.cpp) + tfarmserver.cpp +) target_link_libraries(tfarmserver Qt5::Core - tfarm) + tfarm +) diff --git a/toonz/sources/toonzlib/CMakeLists.txt b/toonz/sources/toonzlib/CMakeLists.txt index 49e329d..dbfb826 100644 --- a/toonz/sources/toonzlib/CMakeLists.txt +++ b/toonz/sources/toonzlib/CMakeLists.txt @@ -151,7 +151,8 @@ set(MOC_HEADERS sandor_fxs/YOMBInputParam.h sandor_fxs/YOMBParam.h texturemanager.h - imagebuilders.h) + imagebuilders.h +) set(HEADERS ${MOC_HEADERS}) @@ -308,11 +309,13 @@ set(SOURCES tbinarizer.cpp plasticdeformerfx.cpp txshmeshcolumn.cpp - textureutils.cpp) + textureutils.cpp +) if(WIN32) set(SOURCES ${SOURCES} - avicodecrestrictions.cpp) + avicodecrestrictions.cpp + ) endif() add_translation(toonzlib ${HEADERS} ${SOURCES}) @@ -343,13 +346,15 @@ if(WIN32) target_link_libraries(toonzlib Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Script ${GLUT_LIB} ${GL_LIB} vfw32.lib - tnzcore tnzbase tnzext) + tnzcore tnzbase tnzext + ) elseif(APPLE) set(EXTRA_LIBS ${CMAKE_CURRENT_BINARY_DIR}/../tnzcore/libtnzcore.dylib ${CMAKE_CURRENT_BINARY_DIR}/../tnzbase/libtnzbase.dylib ${CMAKE_CURRENT_BINARY_DIR}/../tnzext/libtnzext.dylib - ${USB_LIB}) + ${USB_LIB} + ) target_link_libraries(toonzlib Qt5::Core Qt5::Gui Qt5::OpenGL Qt5::Script ${GLUT_LIB} ${GL_LIB} ${EXTRA_LIBS}) elseif(UNIX) diff --git a/toonz/sources/toonzlib/doubleparamcmd.cpp b/toonz/sources/toonzlib/doubleparamcmd.cpp index 90016cc..2fa15db 100644 --- a/toonz/sources/toonzlib/doubleparamcmd.cpp +++ b/toonz/sources/toonzlib/doubleparamcmd.cpp @@ -9,10 +9,6 @@ #include #include -DV_IMPORT_API void splitSpeedInOutSegment(TDoubleKeyframe &k, - TDoubleKeyframe &k0, - TDoubleKeyframe &k1); - //============================================================================= // // Keyframes Undo diff --git a/toonz/sources/toonzlib/fxcommand.cpp b/toonz/sources/toonzlib/fxcommand.cpp index 33c677c..90bbac0 100644 --- a/toonz/sources/toonzlib/fxcommand.cpp +++ b/toonz/sources/toonzlib/fxcommand.cpp @@ -921,7 +921,7 @@ void TFxCommand::insertFx(TFx *newFx, const QList &fxs, int row) { if (!newFx) return; - std::auto_ptr undo( + std::unique_ptr undo( new InsertFxUndo(newFx, row, col, fxs, links, app)); if (undo->isConsistent()) { undo->redo(); @@ -937,7 +937,7 @@ void TFxCommand::addFx(TFx *newFx, const QList &fxs, TApplication *app, int col, int row) { if (!newFx) return; - std::auto_ptr undo( + std::unique_ptr undo( new InsertFxUndo(newFx, row, col, fxs, QList(), app, false)); if (!undo->isConsistent()) return; @@ -1068,7 +1068,7 @@ QString DuplicateFxUndo::getHistoryString() { void TFxCommand::duplicateFx(TFx *src, TXsheetHandle *xshHandle, TFxHandle *fxHandle) { - std::auto_ptr undo( + std::unique_ptr undo( new DuplicateFxUndo(src, xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -1297,7 +1297,7 @@ void TFxCommand::replaceFx(TFx *newFx, const QList &fxs, for (f = 0; f != fCount; ++f) { if (!clonedFx) clonedFx = cloneFx(); - std::auto_ptr undo( + std::unique_ptr undo( new ReplaceFxUndo(clonedFx, fxs[f], xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -1350,7 +1350,7 @@ void TFxCommand::unlinkFx(TFx *fx, TFxHandle *fxHandle, TXsheetHandle *xshHandle) { if (!fx) return; - std::auto_ptr undo(new UnlinkFxUndo(fx, xshHandle)); + std::unique_ptr undo(new UnlinkFxUndo(fx, xshHandle)); if (undo->isConsistent()) { undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -1498,7 +1498,7 @@ void MakeMacroUndo::undo() const { void TFxCommand::makeMacroFx(const std::vector &fxs, TApplication *app) { if (fxs.empty()) return; - std::auto_ptr undo(new MakeMacroUndo(fxs, app)); + std::unique_ptr undo(new MakeMacroUndo(fxs, app)); if (undo->isConsistent()) { undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -1542,7 +1542,7 @@ void ExplodeMacroUndo::initialize() { void TFxCommand::explodeMacroFx(TMacroFx *macroFx, TApplication *app) { if (!macroFx) return; - std::auto_ptr undo(new ExplodeMacroUndo(macroFx, app)); + std::unique_ptr undo(new ExplodeMacroUndo(macroFx, app)); if (undo->isConsistent()) { undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -1711,7 +1711,7 @@ void ConnectNodesToXsheetUndo::initialize() { void TFxCommand::connectNodesToXsheet(const std::list &fxs, TXsheetHandle *xshHandle) { - std::auto_ptr undo( + std::unique_ptr undo( new ConnectNodesToXsheetUndo(fxs, xshHandle)); if (undo->isConsistent()) { undo->redo(); @@ -1766,7 +1766,7 @@ void DisconnectNodesFromXsheetUndo::initialize() { void TFxCommand::disconnectNodesFromXsheet(const std::list &fxs, TXsheetHandle *xshHandle) { - std::auto_ptr undo( + std::unique_ptr undo( new DisconnectNodesFromXsheetUndo(fxs, xshHandle)); if (undo->isConsistent()) { undo->redo(); @@ -2037,8 +2037,8 @@ QString DeleteLinksUndo::getHistoryString() { //============================================================= static void deleteLinks(const std::list &links, - TXsheetHandle *xshHandle) { - std::auto_ptr undo(new DeleteLinksUndo(links, xshHandle)); + TXsheetHandle *xshHandle) { + std::unique_ptr undo(new DeleteLinksUndo(links, xshHandle)); if (undo->isConsistent()) { undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -2058,7 +2058,7 @@ protected: TFxP m_linkedFx; std::vector m_nonTerminalInputs; - mutable std::auto_ptr m_columnData; + mutable std::unique_ptr m_columnData; TXsheetHandle *m_xshHandle; TFxHandle *m_fxHandle; @@ -2299,7 +2299,7 @@ QString DeleteFxOrColumnUndo::getHistoryString() { //============================================================= static void deleteFxs(const std::list &fxs, TXsheetHandle *xshHandle, - TFxHandle *fxHandle) { + TFxHandle *fxHandle) { TUndoManager *undoManager = TUndoManager::manager(); TXsheet *xsh = xshHandle->getXsheet(); @@ -2313,7 +2313,7 @@ static void deleteFxs(const std::list &fxs, TXsheetHandle *xshHandle, // or ABOVE, if any. if (dynamic_cast(ft->getPointer())) continue; - std::auto_ptr undo( + std::unique_ptr undo( new DeleteFxOrColumnUndo(*ft, xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -2333,7 +2333,7 @@ void TFxCommand::removeOutputFx(TFx *fx, TXsheetHandle *xshHandle, TOutputFx *outputFx = dynamic_cast(fx); if (!outputFx) return; - std::auto_ptr undo( + std::unique_ptr undo( new DeleteFxOrColumnUndo(fx, xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -2346,7 +2346,7 @@ void TFxCommand::removeOutputFx(TFx *fx, TXsheetHandle *xshHandle, //********************************************************************** static void deleteColumns(const std::list &columns, TXsheetHandle *xshHandle, - TFxHandle *fxHandle) { + TFxHandle *fxHandle) { TUndoManager *undoManager = TUndoManager::manager(); undoManager->beginBlock(); @@ -2365,7 +2365,7 @@ static void deleteColumns(const std::list &columns, TXsheetHandle *xshHandl size_t c, cCount = cols.size(); for (c = 0; c != cCount; ++c) { - std::auto_ptr undo( + std::unique_ptr undo( new DeleteFxOrColumnUndo(cols[c]->getIndex(), xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -2726,7 +2726,7 @@ void TFxCommand::pasteFxs(const std::list &fxs, const std::list &columns, const TPointD &pos, TXsheetHandle *xshHandle, TFxHandle *fxHandle) { - std::auto_ptr undo(new UndoPasteFxs( + std::unique_ptr undo(new UndoPasteFxs( fxs, zeraryFxColumnSize, columns, pos, xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -2815,7 +2815,7 @@ void TFxCommand::addPasteFxs(TFx *inFx, const std::list &fxs, const std::map &zeraryFxColumnSize, const std::list &columns, TXsheetHandle *xshHandle, TFxHandle *fxHandle) { - std::auto_ptr undo(new UndoAddPasteFxs( + std::unique_ptr undo(new UndoAddPasteFxs( inFx, fxs, zeraryFxColumnSize, columns, xshHandle, fxHandle)); if (undo->isConsistent()) { // NOTE: (inFx == 0) is considered consistent, as long as @@ -2907,7 +2907,7 @@ void TFxCommand::insertPasteFxs(const Link &link, const std::list &fxs, const std::map &zeraryFxColumnSize, const std::list &columns, TXsheetHandle *xshHandle, TFxHandle *fxHandle) { - std::auto_ptr undo(new UndoInsertPasteFxs( + std::unique_ptr undo(new UndoInsertPasteFxs( link, fxs, zeraryFxColumnSize, columns, xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -2920,7 +2920,7 @@ void TFxCommand::insertPasteFxs(const Link &link, const std::list &fxs, //********************************************************************** class UndoReplacePasteFxs final : public UndoAddPasteFxs { - std::auto_ptr m_deleteFxUndo; + std::unique_ptr m_deleteFxUndo; TFx *m_fx, *m_rightmostFx; @@ -3033,7 +3033,7 @@ void TFxCommand::replacePasteFxs(TFx *inFx, const std::list &fxs, const std::list &columns, TXsheetHandle *xshHandle, TFxHandle *fxHandle) { - std::auto_ptr undo(new UndoReplacePasteFxs( + std::unique_ptr undo(new UndoReplacePasteFxs( inFx, fxs, zeraryFxColumnSize, columns, xshHandle, fxHandle)); if (undo->isConsistent()) { undo->redo(); @@ -3199,7 +3199,7 @@ void UndoDisconnectFxs::undo() const { void TFxCommand::disconnectFxs(const std::list &fxs, TXsheetHandle *xshHandle, const QList> &fxPos) { - std::auto_ptr undo( + std::unique_ptr undo( new UndoDisconnectFxs(fxs, fxPos, xshHandle)); if (undo->isConsistent()) { undo->redo(); @@ -3343,7 +3343,7 @@ QString UndoConnectFxs::getHistoryString() { void TFxCommand::connectFxs(const Link &link, const std::list &fxs, TXsheetHandle *xshHandle, const QList> &fxPos) { - std::auto_ptr undo( + std::unique_ptr undo( new UndoConnectFxs(link, fxs, fxPos, xshHandle)); if (undo->isConsistent()) { undo->redo(); @@ -3463,14 +3463,14 @@ void SetParentUndo::undo() const { void TFxCommand::setParent(TFx *fx, TFx *parentFx, int parentFxPort, TXsheetHandle *xshHandle) { if (dynamic_cast(parentFx) || parentFxPort < 0) { - std::auto_ptr undo( + std::unique_ptr undo( new ConnectNodesToXsheetUndo(std::list(1, fx), xshHandle)); if (undo->isConsistent()) { undo->redo_(); TUndoManager::manager()->add(undo.release()); } } else { - std::auto_ptr undo( + std::unique_ptr undo( new SetParentUndo(fx, parentFx, parentFxPort, xshHandle)); if (undo->isConsistent()) { undo->redo_(); @@ -3527,7 +3527,7 @@ void TFxCommand::renameFx(TFx *fx, const std::wstring &newName, TXsheetHandle *xshHandle) { if (!fx) return; - std::auto_ptr undo(new UndoRenameFx(fx, newName, xshHandle)); + std::unique_ptr undo(new UndoRenameFx(fx, newName, xshHandle)); if (undo->isConsistent()) { undo->redo_(); TUndoManager::manager()->add(undo.release()); @@ -3650,7 +3650,7 @@ void UndoGroupFxs::undo() const { void TFxCommand::groupFxs(const std::list &fxs, TXsheetHandle *xshHandle) { - std::auto_ptr undo(new UndoGroupFxs(fxs, xshHandle)); + std::unique_ptr undo(new UndoGroupFxs(fxs, xshHandle)); if (undo->isConsistent()) { undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -3737,7 +3737,7 @@ void UndoUngroupFxs::initialize() { //====================================================== void TFxCommand::ungroupFxs(int groupId, TXsheetHandle *xshHandle) { - std::auto_ptr undo(new UndoUngroupFxs(groupId, xshHandle)); + std::unique_ptr undo(new UndoUngroupFxs(groupId, xshHandle)); if (undo->isConsistent()) { undo->redo(); TUndoManager::manager()->add(undo.release()); @@ -3849,7 +3849,7 @@ void UndoRenameGroup::undo() const { void TFxCommand::renameGroup(const std::list &fxs, const std::wstring &name, bool fromEditor, TXsheetHandle *xshHandle) { - std::auto_ptr undo( + std::unique_ptr undo( new UndoRenameGroup(fxs, name, fromEditor, xshHandle)); if (undo->isConsistent()) { undo->redo_(); // Same schematic nodes problem as above... :( diff --git a/toonz/sources/toonzlib/imagebuilders.cpp b/toonz/sources/toonzlib/imagebuilders.cpp index 5f5ad70..eeaa1f7 100644 --- a/toonz/sources/toonzlib/imagebuilders.cpp +++ b/toonz/sources/toonzlib/imagebuilders.cpp @@ -275,6 +275,14 @@ TImageP ImageRasterizer::build(int imFlags, void *extData) { QSurfaceFormat format; format.setProfile(QSurfaceFormat::CompatibilityProfile); + std::unique_ptr surface(new QOffscreenSurface()); + surface->setFormat(format); + surface->create(); + + std::unique_ptr context(new QOpenGLContext()); + context->create(); + context->makeCurrent(surface.get()); + TRaster32P ras(d); glPushAttrib(GL_ALL_ATTRIB_BITS); @@ -326,6 +334,7 @@ TImageP ImageRasterizer::build(int imFlags, void *extData) { glPopAttrib(); + context->doneCurrent(); tglMakeCurrent(oldContext); TRasterImageP ri = TRasterImageP(ras); diff --git a/toonz/sources/toonzlib/movierenderer.cpp b/toonz/sources/toonzlib/movierenderer.cpp index 35c6e30..924ce5b 100644 --- a/toonz/sources/toonzlib/movierenderer.cpp +++ b/toonz/sources/toonzlib/movierenderer.cpp @@ -107,7 +107,7 @@ public: double m_xDpi, m_yDpi; std::set m_listeners; - std::auto_ptr m_levelUpdaterA, m_levelUpdaterB; + std::unique_ptr m_levelUpdaterA, m_levelUpdaterB; TSoundTrackP m_st; std::map> m_toBeSaved; diff --git a/toonz/sources/toonzlib/palettecmd.cpp b/toonz/sources/toonzlib/palettecmd.cpp index 5c375bd..b0fa7f9 100644 --- a/toonz/sources/toonzlib/palettecmd.cpp +++ b/toonz/sources/toonzlib/palettecmd.cpp @@ -603,7 +603,7 @@ void PaletteCmd::eraseStyles(const std::set &levels, if (levels.empty() || styleIds.empty()) return; - std::auto_ptr undo(new Undo(levels, styleIds)); + std::unique_ptr undo(new Undo(levels, styleIds)); if (static_cast(*undo).isValid()) { undo->redo(); TUndoManager::manager()->add(undo.release()); diff --git a/toonz/sources/toonzlib/palettecontroller.cpp b/toonz/sources/toonzlib/palettecontroller.cpp index 8129f98..9a7632a 100644 --- a/toonz/sources/toonzlib/palettecontroller.cpp +++ b/toonz/sources/toonzlib/palettecontroller.cpp @@ -12,7 +12,8 @@ #include "toonz/palettecontroller.h" -TEnv::IntVar PaletteControllerAutoApplyState("PaletteControllerAutoApplyState", 1); +TEnv::IntVar PaletteControllerAutoApplyState("PaletteControllerAutoApplyState", + 1); PaletteController::PaletteController() : QObject() @@ -20,7 +21,7 @@ PaletteController::PaletteController() , m_currentCleanupPalette(0) , m_originalCurrentPalette(0) , m_currentPalette(0) - , m_colorAutoApplyEnabled( PaletteControllerAutoApplyState != 0 ) + , m_colorAutoApplyEnabled(PaletteControllerAutoApplyState != 0) , m_colorSample() { m_currentLevelPalette = new TPaletteHandle; m_currentCleanupPalette = new TPaletteHandle; @@ -93,7 +94,7 @@ void PaletteController::editCleanupPalette() { void PaletteController::enableColorAutoApply(bool enabled) { if (m_colorAutoApplyEnabled != enabled) { - m_colorAutoApplyEnabled = enabled; + m_colorAutoApplyEnabled = enabled; PaletteControllerAutoApplyState = (enabled) ? 1 : 0; emit colorAutoApplyEnabled(m_colorAutoApplyEnabled); } diff --git a/toonz/sources/toonzlib/plasticdeformerfx.cpp b/toonz/sources/toonzlib/plasticdeformerfx.cpp index e9870c3..bda75e2 100644 --- a/toonz/sources/toonzlib/plasticdeformerfx.cpp +++ b/toonz/sources/toonzlib/plasticdeformerfx.cpp @@ -317,7 +317,7 @@ void PlasticDeformerFx::doCompute(TTile &tile, double frame, TScale worldMeshToMeshAff(meshDpi.x / Stage::inch, meshDpi.y / Stage::inch); - std::auto_ptr dataGroup( + std::unique_ptr dataGroup( PlasticDeformerStorage::instance()->processOnce( sdFrame, mi.getPointer(), sd.getPointer(), sd->skeletonId(sdFrame), worldMeshToMeshAff)); @@ -356,7 +356,7 @@ void PlasticDeformerFx::doCompute(TTile &tile, double frame, const std::string &texId = "render_tex " + std::to_string(++var); // Prepare an OpenGL context - std::auto_ptr context( + std::unique_ptr context( new TOfflineGL(tile.getRaster()->getSize())); context->makeCurrent(); diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 5f73e5d..0c151a3 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -216,7 +216,7 @@ Preferences::Preferences() , m_defLevelWidth(0.0) , m_defLevelHeight(0.0) , m_defLevelDpi(0.0) - , m_iconSize(160, 120) + , m_iconSize(160, 90) , m_blankColor(TPixel32::White) , m_frontOnionColor(TPixel::Black) , m_backOnionColor(TPixel::Black) @@ -285,7 +285,9 @@ Preferences::Preferences() , m_onionSkinEnabled(true) , m_multiLayerStylePickerEnabled(false) , m_paletteTypeOnLoadRasterImageAsColorModel(0) - , m_showKeyframesOnXsheetCellArea(true) { + , m_showKeyframesOnXsheetCellArea(true) + , m_precompute(true) + , m_ffmpegTimeout(30) { TCamera camera; m_defLevelType = PLI_XSHLEVEL; m_defLevelWidth = camera.getSize().lx; @@ -539,6 +541,11 @@ Preferences::Preferences() m_paletteTypeOnLoadRasterImageAsColorModel); getValue(*m_settings, "showKeyframesOnXsheetCellArea", m_showKeyframesOnXsheetCellArea); + QString ffmpegPath = m_settings->value("ffmpegPath").toString(); + if (ffmpegPath != "") m_ffmpegPath = ffmpegPath; + setFfmpegPath(m_ffmpegPath.toStdString()); + getValue(*m_settings, "ffmpegTimeout", + m_ffmpegTimeout); } //----------------------------------------------------------------- @@ -1179,6 +1186,26 @@ void Preferences::setPaletteTypeOnLoadRasterImageAsColorModel(int type) { //----------------------------------------------------------------- +void Preferences::setFfmpegPath(std::string path) { + m_ffmpegPath = QString::fromStdString(path); + std::string strPath = m_ffmpegPath.toStdString(); + m_settings->setValue("ffmpegPath", m_ffmpegPath); +} + +//----------------------------------------------------------------- + +void Preferences::setPrecompute(bool enabled) { m_precompute = enabled; } + +//----------------------------------------------------------------- + +void Preferences::setFfmpegTimeout(int seconds) { + m_ffmpegTimeout = seconds; + m_settings->setValue("ffmpegTimeout", seconds); +} + +//----------------------------------------------------------------- + + int Preferences::addLevelFormat(const LevelFormat &format) { LevelFormatVector::iterator lft = m_levelFormats.insert( std::upper_bound(m_levelFormats.begin(), m_levelFormats.end(), format, diff --git a/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp b/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp index dd21f04..065b442 100644 --- a/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp +++ b/toonz/sources/toonzlib/sandor_fxs/calligraph.cpp @@ -24,6 +24,7 @@ #include "SDef.h" #include "CallCircle.h" #include "CallParam.h" +#include "calligraph.h" //#include "tmsg.h" using namespace std; diff --git a/toonz/sources/toonzlib/screensavermaker.cpp b/toonz/sources/toonzlib/screensavermaker.cpp index 8b6066b..4cbd8cf 100644 --- a/toonz/sources/toonzlib/screensavermaker.cpp +++ b/toonz/sources/toonzlib/screensavermaker.cpp @@ -1,10 +1,10 @@ - - #include "toonz/screensavermaker.h" -#include "texception.h" +#include "texception.h" #include "tsystem.h" +#include + #ifdef _WIN32 #pragma warning(disable : 4996) @@ -24,7 +24,7 @@ void makeScreenSaver(TFilePath scrFn, TFilePath swfFn, throw TException(L"Can't stat file " + swfFn.getWideString()); int swfSize = results.st_size; - std::auto_ptr swf(new char[swfSize]); + std::unique_ptr swf(new char[swfSize]); FILE *chan = _wfopen(swfFn.getWideString().c_str(), L"rb"); if (!chan) throw TException(L"fopen failed on " + swfFn.getWideString()); fread(swf.get(), swfSize, 1, chan); diff --git a/toonz/sources/toonzlib/tcolumnfx.cpp b/toonz/sources/toonzlib/tcolumnfx.cpp index f9597c8..b85566a 100644 --- a/toonz/sources/toonzlib/tcolumnfx.cpp +++ b/toonz/sources/toonzlib/tcolumnfx.cpp @@ -38,6 +38,7 @@ #include "toonz/levelset.h" #include "toonz/txshchildlevel.h" #include "toonz/fxdag.h" +#include "toonz/tcolumnfx.h" #include "toonz/tcolumnfxset.h" #include "toonz/stage.h" #include "toonz/fill.h" @@ -1347,15 +1348,23 @@ void TLevelColumnFx::getImageInfo(TImageInfo &info, TXshSimpleLevel *sl, if (!storedInfo) // sulle pict caricate info era nullo, ma l'immagine c'e'! // con la getFullSampleFrame riprendo l'immagine e ricalcolo la savebox... { - TImageP img; + TImageP img; if (!(img = sl->getFullsampledFrame(frameId, ImageManager::dontPutInCache))) { assert(false); return; } - - info.m_lx = (int)img->getBBox().getLx(); - info.m_ly = (int)img->getBBox().getLy(); + //Raster levels from ffmpeg were not giving the right dimensions without the raster cast and check + TRasterImageP rasterImage = (TRasterImageP)img; + if (rasterImage) + { + info.m_lx = (int)rasterImage->getRaster()->getLx(); + info.m_ly = (int)rasterImage->getRaster()->getLy(); + } + else { + info.m_lx = (int)img->getBBox().getLx(); + info.m_ly = (int)img->getBBox().getLy(); + } info.m_x0 = info.m_y0 = 0; info.m_x1 = (int)img->getBBox().getP11().x; info.m_y1 = (int)img->getBBox().getP11().y; diff --git a/toonz/sources/toonzlib/toonzscene.cpp b/toonz/sources/toonzlib/toonzscene.cpp index e4125ad..a73c1b3 100644 --- a/toonz/sources/toonzlib/toonzscene.cpp +++ b/toonz/sources/toonzlib/toonzscene.cpp @@ -824,7 +824,7 @@ TXshLevel *ToonzScene::createNewLevel(int type, std::wstring levelName, // Select a different unique level name in case it already exists (either in // scene or on disk) { - const std::auto_ptr nameBuilder( + const std::unique_ptr nameBuilder( NameBuilder::getBuilder(levelName)); for (;;) { diff --git a/toonz/sources/toonzlib/txsheetexpr.cpp b/toonz/sources/toonzlib/txsheetexpr.cpp index fe7d917..0968c3a 100644 --- a/toonz/sources/toonzlib/txsheetexpr.cpp +++ b/toonz/sources/toonzlib/txsheetexpr.cpp @@ -66,12 +66,12 @@ class ParamCalculatorNode final : public CalculatorNode, public TParamObserver, public boost::noncopyable { TDoubleParamP m_param; - std::auto_ptr m_frame; + std::unique_ptr m_frame; public: ParamCalculatorNode(Calculator *calculator, const TDoubleParamP ¶m, - std::auto_ptr frame) - : CalculatorNode(calculator), m_param(param), m_frame(frame) { + std::unique_ptr frame) + : CalculatorNode(calculator), m_param(param), m_frame(std::move(frame)) { param->addObserver(this); } @@ -122,15 +122,15 @@ class XsheetDrawingCalculatorNode final : public CalculatorNode, TXsheet *m_xsh; int m_columnIndex; - std::auto_ptr m_frame; + std::unique_ptr m_frame; public: XsheetDrawingCalculatorNode(Calculator *calc, TXsheet *xsh, int columnIndex, - std::auto_ptr frame) + std::unique_ptr frame) : CalculatorNode(calc) , m_xsh(xsh) , m_columnIndex(columnIndex) - , m_frame(frame) {} + , m_frame(std::move(frame)) {} double compute(double vars[3]) const override { double f = m_frame->compute(vars); @@ -265,7 +265,7 @@ public: const std::vector &tokens) const override { assert(tokens.size() >= 3); - std::auto_ptr frameNode( + std::unique_ptr frameNode( (tokens.size() == 6) ? popNode(stack) : new VariableNode(calc, CalculatorNode::FRAME)); @@ -274,14 +274,15 @@ public: std::string field = toLower(tokens[2].getText()); if (field == "cell" || field == "cel" || field == "cels") { int columnIndex = objectId.getIndex(); - stack.push_back( - new XsheetDrawingCalculatorNode(calc, m_xsh, columnIndex, frameNode)); + stack.push_back(new XsheetDrawingCalculatorNode(calc, m_xsh, columnIndex, + std::move(frameNode))); } else { TStageObject *object = m_xsh->getStageObject(objectId); TStageObject::Channel channelName = matchChannelName(tokens[2]); TDoubleParam *channel = object->getParam(channelName); if (channel) - stack.push_back(new ParamCalculatorNode(calc, channel, frameNode)); + stack.push_back( + new ParamCalculatorNode(calc, channel, std::move(frameNode))); } } }; @@ -388,7 +389,7 @@ public: const std::vector &tokens) const override { int tokenSize = tokens.size(); - std::auto_ptr frameNode( + std::unique_ptr frameNode( (tokenSize > 0 && tokens.back().getText() == ")") ? popNode(stack) : new VariableNode(calc, CalculatorNode::FRAME)); @@ -409,7 +410,8 @@ public: channel = param; if (channel.getPointer()) - stack.push_back(new ParamCalculatorNode(calc, channel, frameNode)); + stack.push_back( + new ParamCalculatorNode(calc, channel, std::move(frameNode))); } }; @@ -526,7 +528,7 @@ public: const std::vector &tokens) const override { assert(tokens.size() > COMPONENT); - std::auto_ptr frameNode( + std::unique_ptr frameNode( (tokens.size() == POSITIONS_COUNT) ? popNode(stack) : new VariableNode(calc, CalculatorNode::FRAME)); @@ -550,7 +552,8 @@ public: if (component != componentsEnd) { const TDoubleParamP ¶m = skvd->m_params[component->m_paramId].getPointer(); - stack.push_back(new ParamCalculatorNode(calc, param, frameNode)); + stack.push_back( + new ParamCalculatorNode(calc, param, std::move(frameNode))); } } } diff --git a/toonz/sources/toonzqt/CMakeLists.txt b/toonz/sources/toonzqt/CMakeLists.txt index 4a7d31e..9509daa 100644 --- a/toonz/sources/toonzqt/CMakeLists.txt +++ b/toonz/sources/toonzqt/CMakeLists.txt @@ -86,7 +86,8 @@ set(MOC_HEADERS ../include/toonzqt/flipconsoleowner.h ../include/toonzqt/combohistogram.h ../include/toonzqt/fxiconmanager.h - pluginhost.h) + pluginhost.h +) set(HEADERS ${MOC_HEADERS} @@ -95,7 +96,8 @@ set(HEADERS toonz_plugin.h plugin_tile_interface.h plugin_port_interface.h - plugin_fxnode_interface.h) + plugin_fxnode_interface.h +) set(SOURCES checkbox.cpp @@ -189,7 +191,8 @@ set(SOURCES plugin_param_interface.cpp plugin_param_view_interface.cpp plugin_ui_page_interface.cpp - toonz_params.cpp) + toonz_params.cpp +) set(RESOURCES toonzqt.qrc) @@ -226,7 +229,8 @@ _find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;tnzext;toonzlib;sound") if(WIN32) set(EXTRA_LIBS ${EXTRA_LIBS} - advapi32.lib) + advapi32.lib + ) endif() target_link_libraries(toonzqt Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network Qt5::OpenGL ${EXTRA_LIBS} ${GL_LIB}) diff --git a/toonz/sources/toonzqt/addfxcontextmenu.cpp b/toonz/sources/toonzqt/addfxcontextmenu.cpp index b6bf3c2..908455e 100644 --- a/toonz/sources/toonzqt/addfxcontextmenu.cpp +++ b/toonz/sources/toonzqt/addfxcontextmenu.cpp @@ -245,9 +245,9 @@ void AddFxContextMenu::loadFxs() { void AddFxContextMenu::loadFxPluginGroup() { QString groupName = QString::fromStdString("Plugins"); - std::auto_ptr insertFxGroup(new QMenu(groupName, m_insertMenu)); - std::auto_ptr addFxGroup(new QMenu(groupName, m_addMenu)); - std::auto_ptr replaceFxGroup(new QMenu(groupName, m_replaceMenu)); + std::unique_ptr insertFxGroup(new QMenu(groupName, m_insertMenu)); + std::unique_ptr addFxGroup(new QMenu(groupName, m_addMenu)); + std::unique_ptr replaceFxGroup(new QMenu(groupName, m_replaceMenu)); loadFxPlugins(insertFxGroup.get(), addFxGroup.get(), replaceFxGroup.get()); @@ -263,9 +263,10 @@ void AddFxContextMenu::loadFxGroup(TIStream *is) { if (is->matchTag(tagName)) { QString groupName = QString::fromStdString(tagName); - std::auto_ptr insertFxGroup(new QMenu(groupName, m_insertMenu)); - std::auto_ptr addFxGroup(new QMenu(groupName, m_addMenu)); - std::auto_ptr replaceFxGroup(new QMenu(groupName, m_replaceMenu)); + std::unique_ptr insertFxGroup(new QMenu(groupName, m_insertMenu)); + std::unique_ptr addFxGroup(new QMenu(groupName, m_addMenu)); + std::unique_ptr replaceFxGroup( + new QMenu(groupName, m_replaceMenu)); loadFx(is, insertFxGroup.get(), addFxGroup.get(), replaceFxGroup.get()); diff --git a/toonz/sources/toonzqt/colorfield.cpp b/toonz/sources/toonzqt/colorfield.cpp index b35a391..3e0f32b 100644 --- a/toonz/sources/toonzqt/colorfield.cpp +++ b/toonz/sources/toonzqt/colorfield.cpp @@ -389,8 +389,10 @@ void ColorField::setAlphaActive(bool active) { connect(m_alphaChannel, SIGNAL(valueChanged(int, bool)), SLOT(onAlphaChannelChanged(int, bool))); assert(m_color.m == 255); - // m_color.m = m_alphaChannel->getChannel(); - // m_colorSample->setColor(m_color); + m_alphaChannel->setChannel(0); + m_color.m = 0; + m_colorSample->setColor(m_color); + emit colorChanged(m_color, false); } else if (!active && m_alphaChannel->isVisible()) { m_alphaChannel->hide(); disconnect(m_alphaChannel, SIGNAL(valueChanged(int, bool)), this, diff --git a/toonz/sources/toonzqt/dvdialog.cpp b/toonz/sources/toonzqt/dvdialog.cpp index c36ee18..3692f7e 100644 --- a/toonz/sources/toonzqt/dvdialog.cpp +++ b/toonz/sources/toonzqt/dvdialog.cpp @@ -805,7 +805,7 @@ ProgressDialog::ProgressDialog(const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent, Qt::WindowFlags f) : Dialog(parent, true, true), m_isCanceled(false) { - setWindowTitle(tr("Toonz")); + setWindowTitle(tr("OpenToonz")); setMinimumSize(20, 20); diff --git a/toonz/sources/toonzqt/functionpaneltools.cpp b/toonz/sources/toonzqt/functionpaneltools.cpp index daa6abe..d0d6bfd 100644 --- a/toonz/sources/toonzqt/functionpaneltools.cpp +++ b/toonz/sources/toonzqt/functionpaneltools.cpp @@ -207,9 +207,6 @@ void MovePointDragTool::click(QMouseEvent *e) { //----------------------------------------------------------------------------- void MovePointDragTool::drag(QMouseEvent *e) { - // need ctrl modifier - if (0 == (e->modifiers() & Qt::ControlModifier)) return; - QPoint pos = e->pos(); // if shift is pressed then apply constraints (only horizontal or vertical @@ -331,9 +328,6 @@ void MoveHandleDragTool::click(QMouseEvent *e) { //----------------------------------------------------------------------------- void MoveHandleDragTool::drag(QMouseEvent *e) { - // need ctrl modifier - if (0 == (e->modifiers() & Qt::ControlModifier)) return; - if (!m_curve) return; QPoint pos = e->pos(); diff --git a/toonz/sources/toonzqt/keyframenavigator.cpp b/toonz/sources/toonzqt/keyframenavigator.cpp index 8bc430b..b8d1431 100644 --- a/toonz/sources/toonzqt/keyframenavigator.cpp +++ b/toonz/sources/toonzqt/keyframenavigator.cpp @@ -353,7 +353,7 @@ void PaletteKeyframeNavigator::toggle() { int styleId = getStyleIndex(), frame = getCurrentFrame(); - std::auto_ptr undo( + std::unique_ptr undo( new UndoPaletteSetKeyFrame(styleId, frame, m_paletteHandle)); undo->redo(); diff --git a/toonz/sources/toonzqt/paletteviewergui.cpp b/toonz/sources/toonzqt/paletteviewergui.cpp index a20bb85..fcd489b 100644 --- a/toonz/sources/toonzqt/paletteviewergui.cpp +++ b/toonz/sources/toonzqt/paletteviewergui.cpp @@ -949,7 +949,6 @@ void PageViewer::mouseDoubleClickEvent(QMouseEvent *e) { } CommandManager::instance()->execute("MI_OpenStyleControl"); - } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzqt/rasterimagedata.cpp b/toonz/sources/toonzqt/rasterimagedata.cpp index f0cce67..def5ac4 100644 --- a/toonz/sources/toonzqt/rasterimagedata.cpp +++ b/toonz/sources/toonzqt/rasterimagedata.cpp @@ -294,7 +294,7 @@ StrokesData *FullColorImageData::toStrokesData(ToonzScene *scene) const { scene->getProperties()->getVectorizerParameters(); assert(vParams); - std::auto_ptr config( + std::unique_ptr config( vParams->getCurrentConfiguration(0.0)); TVectorImageP vi = vectorize(image, rect, *config, m_transformation); diff --git a/toonz/sources/toonzqt/styleselection.cpp b/toonz/sources/toonzqt/styleselection.cpp index 81e823b..024ace0 100644 --- a/toonz/sources/toonzqt/styleselection.cpp +++ b/toonz/sources/toonzqt/styleselection.cpp @@ -605,7 +605,7 @@ void TStyleSelection::cutStyles() { styleIds.push_back(page->getStyleId(*it)); } - std::auto_ptr undo(new CutStylesUndo(this, data, oldData)); + std::unique_ptr undo(new CutStylesUndo(this, data, oldData)); if (m_xsheetHandle) { if (eraseStylesInDemand(palette, styleIds, m_xsheetHandle) == 0) return; @@ -683,7 +683,7 @@ void TStyleSelection::deleteStyles() { return; } - std::auto_ptr undo(new DeleteStylesUndo(this, data)); + std::unique_ptr undo(new DeleteStylesUndo(this, data)); deleteStylesWithoutUndo(m_paletteHandle->getPalette(), m_paletteHandle, m_pageIndex, &m_styleIndicesInPage);