From 83c0cff6dc05fb1a2c989dca7be0424101627e94 Mon Sep 17 00:00:00 2001 From: Jeremy Bullock Date: Tue, 7 Jul 2020 11:06:59 -0600 Subject: [PATCH] Merge changes from OpenToonz as of 7-7 (#77) * add multi arc mockup * implement mutli arc * add join and smooth option * reset multiarc and arc when deactivated * create self loop if the last point is the same as the first * make join option in multiarc consistent with tape tool * fix a bug where thickness don't affect mutliarc in vector level * remove join option in geometric tool * stop mutliarc after closing shape * double click can also end multi arc * fix a bug where multiArc will produce buggy stroke * fix a bug where geometric tools is not deactivated * add multiArc shortcut * rewrite multiArc * revert changes to tvectorimage * add undo data for multiArc * Paste as Copy Command for XSheet * Remove unneeded code * Bug fix * prevent guide lines from jumping around in MultiArc * make stroke color consistent in MultiArc * remove color in MultiArc's undo data * make color consistent in MultiArc with previous version * Fix single image raster levels * fix compilation error * fix a bug where multiArc might generate bugged stroke * Remove ICONV dep (#3304) * fix crash on saving studio palette * Move to Paste Special Menu * Don't Set Fixed Width if Docking a Floating Panel * Update how_to_build_win.md New draft of pr for requested changes to windows build instructions. * fix geometric tool multiarc smooth option * fix level saving failure * fix wrong warning after saving palette * fix a bug where moving a control point while holding alt has unintended result * fix overwriting raster drawing palette * Hide color swatch on color 0 Co-authored-by: pojienie Co-authored-by: rim <11380091+rozhuk-im@users.noreply.github.com> Co-authored-by: shun-iwasawa Co-authored-by: Rodney Co-authored-by: DoctorRyan <65507211+DoctorRyan@users.noreply.github.com> --- doc/how_to_build_win.md | 91 +++++++++---------- toonz/sources/image/tzl/tiio_tzl.cpp | 23 +++-- .../sources/include/toonz/fullcolorpalette.h | 1 + toonz/sources/include/toonzqt/icongenerator.h | 4 + .../tnztools/controlpointeditortool.cpp | 1 + toonz/sources/toonz/iocommand.cpp | 6 +- toonz/sources/toonz/menubar.cpp | 2 + toonz/sources/toonz/tapp.cpp | 17 +++- toonz/sources/toonzlib/imagebuilders.cpp | 7 +- toonz/sources/toonzlib/txshsimplelevel.cpp | 41 +++++---- toonz/sources/toonzqt/styleeditor.cpp | 12 +-- 11 files changed, 115 insertions(+), 90 deletions(-) diff --git a/doc/how_to_build_win.md b/doc/how_to_build_win.md index 2ea25e55..1110ab6f 100644 --- a/doc/how_to_build_win.md +++ b/doc/how_to_build_win.md @@ -1,78 +1,75 @@ + # Building on Windows -This software can be built using Visual Studio 2015 and Qt 5.9 +This software can be built using Visual Studio 2015 or above and Qt 5.9 (later Qt versions still not working correctly.) ## Required Software -### Visual Studio Express 2015 for Windows Desktop +### Visual Studio Express 2015 or higher for Windows Desktop - https://www.visualstudio.com/vs/older-downloads/ -- Make sure that the version is "2015" and that the target platform is "for Windows Desktop", not "for Windows". -- Community and Professional versions of Visual Studio 2015 for Windows Desktop also work. -- Visual Studio 2017 is currently unsupported. +- Make sure the target platform is "for Windows Desktop", not "for Windows". +- Community and Professional versions of Visual Studio for Windows Desktop also work. - During the installation, make sure to select all the Visual C++ packages. ### CMake - https://cmake.org/download/ - This will be used to create the `MSVC 2015` project file. -## Acquiring the Source Code -- Clone the base repository. -- Throughout the explanation `$opentoonz` will represent the root for the base repository. -- Visual Studio cannot recognize UTF-8 without BOM source code properly. Furthermore, since the endline character is represented with only the LF character, one line comments in Japanese will often cause the following line to be treated as a comment by `MSVS` as well. -- In order to prevent this, please change the following setting in git so that it will preserve the proper endline characters: - - `git config core.safecrlf true` - -## Installation of Required Libraries -Because of the size of these libraries, they are not maintained in the git repository. -They will have to be installed seperately as follows. - -### `lib` and `dll` -- `lib` and `dll` files are tracked by [Git Large File Storage](https://git-lfs.github.com/). -- Execute `git lfs pull` after `git clone` by using the `lfs` client. - ### Qt - https://www.qt.io/download-open-source/ - Qt is a cross-platform GUI framework. -- Install Qt 5.9 (64-bit version, tested up to 5.9.4) with the [Qt Online Installer for Windows](http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe). +- Install Qt 5.9 (64-bit version, tested up to 5.9.9) with the [Qt Online Installer for Windows](http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe). ### boost - Boost 1.55.0 or later is required (tested up to 1.61.0). - http://www.boost.org/users/history/version_1_61_0.html -- Download boost_1_61_0.zip from the above link. Extract all contents to the '$opentoonz/thirdparty/boost' directory. +- Download boost_1_73_0.zip from the above link. Extract all contents to the - '$opentoonz/thirdparty/boost' directory. - Install the following patch (Make the changes listed in the patch file), if you use Boost 1.55.0 with Visual Studio 2013. - - https://svn.boost.org/trac/boost/attachment/ticket/9369/vc12_fix_has_member_function_callable_with.patch +- https://svn.boost.org/trac/boost/attachment/ticket/9369/vc12_fix_has_member_function_callable_with.patch +## Acquiring the Source Code +- Note: You can also perform these next commands with Github for Desktop client. +- Clone the base repository. +- Throughout the explanation `$opentoonz` will represent the root for the base repository. -## Building +### lib and dll + +- `lib` and `dll` files are tracked by [Git Large File Storage](https://git-lfs.github.com/). +- Note: git-lfs is also installed with Github Desktop. +- Visual Studio cannot recognize UTF-8 without BOM source code properly. Furthermore, since the endline character is represented with only the LF character, one line comments in Japanese will often cause the following line to be treated as a comment by `MSVS` as well. +- In order to prevent this, please change the following setting in git so that it will preserve the proper endline characters: +- `git config core.safecrlf true` +- Execute `git lfs pull` after `git clone` by using the lfs client. ### Using CMake to Create a Visual Studio Project -1. Launch CMake -2. In `Where is the source code`, navigate to `$opentoonz/toonz/sources` -3. In `Where to build the binaries`, navigate to `$opentoonz/toonz/build` - - Or to wherever you usually build to. - - If the build directory is in the git repository, be sure to add the directory to .gitignore - - If the build directory is different from the one above, be sure to change to the specified directory where appropriate below. -4. Click on Configure and select Visual Studio 14 2015 Win64. -5. If Qt was installed to a directory other than the default, and the error `Specify QT_PATH properly` appears, navigate to the `QT_DIR` install folder and specify the path to `msvc2015_64`. Rerun Configure. - - If red lines appear in the bottom box, you can safely ignore them. -6. Click Generate - - Should the CMakeLists.txt file change, such as during automatic build cleanup, there is no need to rerun CMake. +- Launch CMake +- In `Where is the source code`, navigate to `$opentoonz/toonz/sources` +- In `Where to build the binaries`, navigate to `$opentoonz/toonz/build` +- Or to wherever you usually build to. +- If the build directory is in the git repository, be sure to add the directory to .gitignore +- If the build directory is different from the one above, be sure to change to the specified directory where appropriate below. +-Click on Configure and select the version of Visual Studio you are using. +-If Qt was installed to a directory other than the default, and the error Specify QT_PATH properly appears, navigate to the `QT_DIR` install folder and specify the path to `msvc2015_64`. Rerun Configure. +-If red lines appear in the bottom box, you can safely ignore them. +-Click Generate +-Should the CMakeLists.txt file change, such as during automatic build cleanup, there is no need to rerun CMake. ## Setting Up Libraries Rename the following files: - - `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.vc` to `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.h` - - `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.vc.h` to `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.h` - - `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.vc.h` to `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.h` - - `$opentoonz/thirdparty/libpng-1.6.21/scripts/pnglibconf.h.prebuilt` to `$opentoonz/thirdparty/libpng-1.6.21/pnglibconf.h` - - Note that the destination is a different folder for the last file. +- `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.vc` to `$opentoonz/thirdparty/LibJPEG/jpeg-9/jconfig.h` +- `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.vc.h` to `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tif_config.h` +- `$opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.vc.h to $opentoonz/thirdparty/tiff-4.0.3/libtiff/tiffconf.h` +- `$opentoonz/thirdparty/libpng-1.6.21/scripts/pnglibconf.h.prebuilt to $opentoonz/thirdparty/libpng-1.6.21/pnglibconf.h` +- Note that the destination is a different folder for the last file. ## Building -1. Open `$opentoonz/toonz/build/OpenToonz.sln` and change to `Debug` or `Release` in the top bar. -2. The output will be in the corresponding folder in `$opentoonz/toonz/build/` +- Open `$opentoonz/toonz/build/OpenToonz.sln` and change to `Debug` or `Release` in the top bar. +- Compile the build. +- The output will be in the corresponding folder in `$opentoonz/toonz/build/` ## Building with extended stop motion support for webcams and Canon DSLR cameras. -You will need three additional libraries. - - [OpenCV](https://opencv.org/) (v4.1.0 and later) + You will need three additional libraries. +- [OpenCV](https://opencv.org/) (v4.1.0 and later) - [libjpeg-turbo](https://www.libjpeg-turbo.org/) - The Canon SDK. This requires applying for the Canon developer program and downloading the SDK. @@ -88,10 +85,10 @@ To run the program with stop motion support, you will need to copy the .dll file ## Running the Program ### Setting Up the Program's Path -1. Copy the entire contents of `$opentoonz/toonz/build/Release` to an appropriate folder. +1. Copy the entire contents of $opentoonz/toonz/build/Release to an appropriate folder. -2. Open a Command Prompt and navigate to `QT_DIR/msvc2015_64/bin`. Run the Qt program `windeployqt.exe` with the path for `OpenToonz.exe` as an argument. - - The necessary Qt library files should be in the same folder as `OpenToonz.exe` +2. Open a Command Prompt and navigate to `QT_DIR/msvc2015_64/bin`. Run the Qt program `windeployqt.exe` with the path for `OpenToonz.exe` as an argument. (Another way to do this is navigate to the exe that was created in your Release folder and drag and drop the Opentoonz.exe on top of the windeployqt.exe This will automatically generate the QT files and folders you will need.) + - The necessary Qt library files should be in the same folder as `OpenToonz.exe` - These include: - `Qt5Core.dll` - `Qt5Gui.dll` diff --git a/toonz/sources/image/tzl/tiio_tzl.cpp b/toonz/sources/image/tzl/tiio_tzl.cpp index 47c69291..bcdf7f6b 100644 --- a/toonz/sources/image/tzl/tiio_tzl.cpp +++ b/toonz/sources/image/tzl/tiio_tzl.cpp @@ -40,7 +40,7 @@ char *reverse(char *buffer, int size) { } return buffer; } -} +} // namespace static int tfwrite(const char *data, const unsigned int count, FILE *f) { return fwrite(data, sizeof(char), count, f); @@ -208,8 +208,8 @@ bool readHeaderAndOffsets(FILE *chan, TzlOffsetMap &frameOffsTable, if (version >= 12) fread(&length, sizeof(TINT32), 1, chan); #if !TNZ_LITTLE_ENDIAN - number = swapTINT32(number); - offs = swapTINT32(offs); + number = swapTINT32(number); + offs = swapTINT32(offs); if (version == 12) length = swapTINT32(length); #endif // std::cout << "#" << i << std::hex << " n 0x" << number @@ -270,16 +270,16 @@ bool readHeaderAndOffsets(FILE *chan, TzlOffsetMap &frameOffsTable, level->setFrame(TFrameId(i), TImageP()); } - res.lx = lx; - res.ly = ly; - if (_offsetTablePos) *_offsetTablePos = offsetTablePos; + res.lx = lx; + res.ly = ly; + if (_offsetTablePos) *_offsetTablePos = offsetTablePos; if (_iconOffsetTablePos) *_iconOffsetTablePos = iconOffsetTablePos; if (_frameCount) *_frameCount = frameCount; return true; } -} +} // namespace static bool adjustIconAspectRatio(TDimension &outDimension, TDimension inDimension, TDimension imageRes) { @@ -295,7 +295,7 @@ static bool adjustIconAspectRatio(TDimension &outDimension, double(ly) / inDimension.ly) iconLx = tround((double(lx) * inDimension.ly) / ly); else - iconLy = tround((double(ly) * inDimension.lx) / lx); + iconLy = tround((double(ly) * inDimension.lx) / lx); outDimension = TDimension(iconLx, iconLy); return true; } @@ -1084,7 +1084,7 @@ void TLevelWriterTzl::renumberFids( frameOffsTableTemp = m_frameOffsTable; TzlOffsetMap::iterator it = frameOffsTableTemp.begin(); while (it != frameOffsTableTemp.end()) { - TFrameId fid = it->first; + TFrameId fid = it->first; std::map::const_iterator it2 = renumberTable.find(fid); if (it2 == renumberTable.end()) remove(fid); it++; @@ -1403,12 +1403,11 @@ bool TLevelWriterTzl::optimize() { void TLevelReaderTzl::readPalette() { TFilePath pltfp = m_path.withNoFrame().withType("tpl"); - TFileStatus fs(pltfp); - TPersist *p = 0; + TPersist *p = 0; TIStream is(pltfp); TPalette *palette = 0; - if (is && fs.doesExist()) { + if (is) { std::string tagName; if (is.matchTag(tagName) && tagName == "palette") { std::string gname; diff --git a/toonz/sources/include/toonz/fullcolorpalette.h b/toonz/sources/include/toonz/fullcolorpalette.h index 56227112..30280cda 100644 --- a/toonz/sources/include/toonz/fullcolorpalette.h +++ b/toonz/sources/include/toonz/fullcolorpalette.h @@ -36,6 +36,7 @@ public: TPalette *getPalette(ToonzScene *scene); void savePalette(ToonzScene *scene); bool isFullColorPalette(TPalette *palette) { return m_palette == palette; } + const TFilePath getPath() const { return m_fullcolorPalettePath; } }; #endif // FULLCOLOR_PALETTE diff --git a/toonz/sources/include/toonzqt/icongenerator.h b/toonz/sources/include/toonzqt/icongenerator.h index 8c366e3d..1ca7aa3e 100644 --- a/toonz/sources/include/toonzqt/icongenerator.h +++ b/toonz/sources/include/toonzqt/icongenerator.h @@ -140,6 +140,10 @@ public: const TDimension &iconSize, const TFrameId &fid); + // This function is called when only colors of styles are changed in toonz + // raster levels. In such case it doesn't need to re-compute icons but needs + // to let panels to update. See TApp::onLevelColorStyleChanged() for details. + void notifyIconGenerated() { emit iconGenerated(); } signals: void iconGenerated(); diff --git a/toonz/sources/tnztools/controlpointeditortool.cpp b/toonz/sources/tnztools/controlpointeditortool.cpp index b3caa91e..6e56dfef 100644 --- a/toonz/sources/tnztools/controlpointeditortool.cpp +++ b/toonz/sources/tnztools/controlpointeditortool.cpp @@ -652,6 +652,7 @@ void ControlPointEditorTool::leftButtonDown(const TPointD &pos, m_selection.makeCurrent(); } else if (pointType == ControlPointEditorStroke::CONTROL_POINT) { if (e.isAltPressed()) { + m_action = NONE; m_selection.selectNone(); m_selection.select(pointIndex); initUndo(); diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp index d3a95379..ca74f1d0 100644 --- a/toonz/sources/toonz/iocommand.cpp +++ b/toonz/sources/toonz/iocommand.cpp @@ -1532,7 +1532,7 @@ bool IoCmd::saveLevel(const TFilePath &path) { realPath = TFilePath(realPath.getWideString() + ::to_wstring(dotts + ext)); bool ret = saveLevel(realPath, sl, false); - if(!ret){ //save level failed + if (!ret) { // save level failed return false; } @@ -2941,6 +2941,8 @@ public: } if (sl->getPath().getType() == "pli") palettePath = sl->getPath(); + else if (sl->getType() & FULLCOLOR_TYPE) + palettePath = FullColorPalette::instance()->getPath(); else palettePath = sl->getPath().withType("tpl"); } @@ -2980,6 +2982,8 @@ public: if (sl && sl->getPath().getType() == "pli") sl->save(palettePath, TFilePath(), true); + else if (sl->getType() & FULLCOLOR_TYPE) + FullColorPalette::instance()->savePalette(scene); else StudioPalette::instance()->save(palettePath, palette); /*- Dirtyフラグの変更 -*/ diff --git a/toonz/sources/toonz/menubar.cpp b/toonz/sources/toonz/menubar.cpp index da1cc166..12a76068 100644 --- a/toonz/sources/toonz/menubar.cpp +++ b/toonz/sources/toonz/menubar.cpp @@ -720,6 +720,8 @@ QMenuBar *StackedMenuBar::createFullMenuBar() { addMenuItem(windowsMenu, MI_OpenStopMotionPanel); addMenuItem(windowsMenu, MI_StartupPopup); addMenuItem(windowsMenu, MI_OpenGuidedDrawingControls); + // windowsMenu->addSeparator(); + // addMenuItem(windowsMenu, MI_OpenExport); windowsMenu->addSeparator(); addMenuItem(windowsMenu, MI_OpenExport); windowsMenu->addSeparator(); diff --git a/toonz/sources/toonz/tapp.cpp b/toonz/sources/toonz/tapp.cpp index adb1e496..480e6640 100644 --- a/toonz/sources/toonz/tapp.cpp +++ b/toonz/sources/toonz/tapp.cpp @@ -638,10 +638,23 @@ void TApp::onLevelColorStyleSwitched() { static void notifyPaletteChanged(TXshSimpleLevel *simpleLevel) { simpleLevel->onPaletteChanged(); + // palette change can update icons only for ToonzVector / ToonzRaster types + if (simpleLevel->getType() != TZP_XSHLEVEL && + simpleLevel->getType() != PLI_XSHLEVEL) + return; std::vector fids; simpleLevel->getFids(fids); - for (int i = 0; i < (int)fids.size(); i++) - IconGenerator::instance()->invalidate(simpleLevel, fids[i]); + // ToonzRaster level does not need to re-generate icons along with palette + // changes since the icons are cached as color mapped images and the current + // palette is applied just before using it. So here we just emit the signal to + // update related panels. + if (simpleLevel->getType() == TZP_XSHLEVEL) + IconGenerator::instance()->notifyIconGenerated(); + else { // ToonzVecor needs to re-generate icons since it includes colors in + // the cache. + for (int i = 0; i < (int)fids.size(); i++) + IconGenerator::instance()->invalidate(simpleLevel, fids[i]); + } } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/imagebuilders.cpp b/toonz/sources/toonzlib/imagebuilders.cpp index 3e25b73e..57b972e7 100644 --- a/toonz/sources/toonzlib/imagebuilders.cpp +++ b/toonz/sources/toonzlib/imagebuilders.cpp @@ -100,7 +100,10 @@ TImageP ImageLoader::build(int imFlags, void *extData) { (m_path.getType() == "psd")) lr->loadInfo(); - lr->doReadPalette(true); // Allow palette loading + bool isTlvIcon = data->m_icon && m_path.getType() == "tlv"; + + // for TLV icons, palettes will be applied in IconGenerator later + if (!isTlvIcon) lr->doReadPalette(true); // Allow palette loading TImageReaderP ir = lr->getFrameReader(m_fid); @@ -110,7 +113,7 @@ TImageP ImageLoader::build(int imFlags, void *extData) { // Load the image TImageP img; - if (data->m_icon && m_path.getType() == "tlv") + if (isTlvIcon) img = ir->loadIcon(); // TODO: Why just in the tlv case?? else { ir->setShrink(subsampling); diff --git a/toonz/sources/toonzlib/txshsimplelevel.cpp b/toonz/sources/toonzlib/txshsimplelevel.cpp index 69389d4b..85d628af 100644 --- a/toonz/sources/toonzlib/txshsimplelevel.cpp +++ b/toonz/sources/toonzlib/txshsimplelevel.cpp @@ -102,8 +102,8 @@ bool checkCreatorString(const QString &creator) { if (pos >= 0 && len >= 4) { QString v; if (len > 4) v = creator.mid(pos + 3, len - 4); - bool ok = true; - mask = v.toInt(&ok, 16); + bool ok = true; + mask = v.toInt(&ok, 16); } } return (mask & compatibility.neededMask) == compatibility.neededMask && @@ -169,8 +169,8 @@ void getIndexesRangefromFids(TXshSimpleLevel *level, std::set::const_iterator it; for (it = fids.begin(); it != fids.end(); ++it) { - int index = level->guessIndex(*it); - if (index > toIndex) toIndex = index; + int index = level->guessIndex(*it); + if (index > toIndex) toIndex = index; if (index < fromIndex) fromIndex = index; } } @@ -917,13 +917,13 @@ void TXshSimpleLevel::loadData(TIStream &is) { if (is.getTagParam("dpix", v)) xdpi = std::stod(v); if (is.getTagParam("dpiy", v)) ydpi = std::stod(v); if (xdpi != 0 && ydpi != 0) dpiPolicy = LevelProperties::DP_CustomDpi; - std::string dpiType = is.getTagAttribute("dpiType"); - if (dpiType == "image") dpiPolicy = LevelProperties::DP_ImageDpi; - if (is.getTagParam("type", v) && v == "s") type = TZI_XSHLEVEL; - if (is.getTagParam("subsampling", v)) subsampling = std::stoi(v); - if (is.getTagParam("premultiply", v)) doPremultiply = std::stoi(v); + std::string dpiType = is.getTagAttribute("dpiType"); + if (dpiType == "image") dpiPolicy = LevelProperties::DP_ImageDpi; + if (is.getTagParam("type", v) && v == "s") type = TZI_XSHLEVEL; + if (is.getTagParam("subsampling", v)) subsampling = std::stoi(v); + if (is.getTagParam("premultiply", v)) doPremultiply = std::stoi(v); if (is.getTagParam("antialias", v)) antialiasSoftness = std::stoi(v); - if (is.getTagParam("whiteTransp", v)) whiteTransp = std::stoi(v); + if (is.getTagParam("whiteTransp", v)) whiteTransp = std::stoi(v); if (is.getTagParam("isStopMotionLevel", v)) isStopMotionLevel = std::stoi(v); @@ -1094,9 +1094,8 @@ static TFilePath getLevelPathAndSetNameWithPsdLevelName( if (removeFileName) wLevelName = list[1].toStdWString(); TLevelSet *levelSet = xshLevel->getScene()->getLevelSet(); - if (levelSet && - levelSet->hasLevel( - wLevelName)) // levelSet should be asserted instead + if (levelSet && levelSet->hasLevel( + wLevelName)) // levelSet should be asserted instead levelSet->renameLevel(xshLevel, wLevelName); xshLevel->setName(wLevelName); @@ -1621,6 +1620,7 @@ void TXshSimpleLevel::save(const TFilePath &fp, const TFilePath &oldFp, overwritePalette = false; TFilePath palettePath = dDstPath.withNoFrame().withType("tpl"); StudioPalette::instance()->save(palettePath, getPalette()); + getPalette()->setDirtyFlag(false); } saveSimpleLevel(dDstPath, overwritePalette); @@ -1653,8 +1653,8 @@ void TXshSimpleLevel::saveSimpleLevel(const TFilePath &decodedFp, std::vector fids; getFids(fids); - bool isLevelModified = getProperties()->getDirtyFlag(); - bool isPaletteModified = false; + bool isLevelModified = getProperties()->getDirtyFlag(); + bool isPaletteModified = false; if (getPalette()) isPaletteModified = getPalette()->getDirtyFlag(); if (isLevelModified || isPaletteModified) { @@ -1900,11 +1900,11 @@ void TXshSimpleLevel::saveSimpleLevel(const TFilePath &decodedFp, std::string TXshSimpleLevel::getImageId(const TFrameId &fid, int frameStatus) const { if (frameStatus < 0) frameStatus = getFrameStatus(fid); - std::string prefix = "L"; + std::string prefix = "L"; if (frameStatus & CleanupPreview) prefix = "P"; else if ((frameStatus & (Scanned | Cleanupped)) == Scanned) - prefix = "S"; + prefix = "S"; std::string imageId = m_idBase + "_" + prefix + fid.expand(); return imageId; } @@ -2330,13 +2330,14 @@ TFilePath TXshSimpleLevel::getExistingHookFile( int f, fCount = hookFiles.size(); for (f = 0; f != fCount; ++f) { - fPattern = locals::getPattern(hookFiles[f]); + fPattern = locals::getPattern(hookFiles[f]); if (fPattern < p) p = fPattern, h = f; } assert(h >= 0); - return (h < 0) ? TFilePath() : decodedLevelPath.getParentDir() + - TFilePath(hookFiles[h].toStdWString()); + return (h < 0) ? TFilePath() + : decodedLevelPath.getParentDir() + + TFilePath(hookFiles[h].toStdWString()); } //----------------------------------------------------------------------------- diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp index b574596a..3bb9969f 100644 --- a/toonz/sources/toonzqt/styleeditor.cpp +++ b/toonz/sources/toonzqt/styleeditor.cpp @@ -3532,7 +3532,7 @@ void StyleEditor::onStyleChanged(bool isDragging) { m_settingsPage->setStyle(m_editedStyle); m_newColor->setStyle(*m_editedStyle); int tag = m_editedStyle->getTagId(); - if (tag == 4 || tag == 2000 || tag == 2800) { + if (tag == 4 || tag == 2000 || tag == 2800 || getStyleIndex() == 0) { m_fillColorWidget->hide(); } else { m_fillColorWidget->show(); @@ -3648,7 +3648,7 @@ void StyleEditor::onColorChanged(const ColorModel &color, bool isDragging) { m_newColor->setStyle(*m_editedStyle); int tag = m_editedStyle->getTagId(); - if (tag == 4 || tag == 2000 || tag == 2800) { + if (tag == 4 || tag == 2000 || tag == 2800 || getStyleIndex() == 0) { m_fillColorWidget->hide(); } else { m_fillColorWidget->show(); @@ -3808,7 +3808,7 @@ bool StyleEditor::setStyle(TColorStyle *currentStyle) { m_newColor->setStyle(*currentStyle); int tag = currentStyle->getTagId(); - if (tag == 4 || tag == 2000 || tag == 2800) { + if (tag == 4 || tag == 2000 || tag == 2800 || getStyleIndex() == 0) { m_fillColorWidget->hide(); } else { m_fillColorWidget->show(); @@ -3891,7 +3891,7 @@ void StyleEditor::selectStyle(const TColorStyle &newStyle) { // Update editor widgets m_newColor->setStyle(*m_editedStyle); int tag = m_editedStyle->getTagId(); - if (tag == 4 || tag == 2000 || tag == 2800) { + if (tag == 4 || tag == 2000 || tag == 2800 || getStyleIndex() == 0) { m_fillColorWidget->hide(); } else { m_fillColorWidget->show(); @@ -3931,7 +3931,7 @@ void StyleEditor::onColorParamChanged() { m_settingsPage->setStyle(m_editedStyle); } int tag = m_editedStyle->getTagId(); - if (tag == 4 || tag == 2000 || tag == 2800) { + if (tag == 4 || tag == 2000 || tag == 2800 || getStyleIndex() == 0) { m_fillColorWidget->hide(); } else { m_fillColorWidget->show(); @@ -3966,7 +3966,7 @@ void StyleEditor::onParamStyleChanged(bool isDragging) { m_newColor->setStyle(*m_editedStyle); // int tag = m_editedStyle->getTagId(); - if (tag == 4 || tag == 2000 || tag == 2800) { + if (tag == 4 || tag == 2000 || tag == 2800 || getStyleIndex() == 0) { m_fillColorWidget->hide(); } else { TPixel32 color = m_editedStyle->getColorParamValue(getColorParam());