diff --git a/LICENSE.txt b/LICENSE.txt index c17819d..7bc1dfc 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,27 @@ -Copyright (c) 2016, DWANGO Co., Ltd. +Some of code in this repository is derived from thirdparty libralies. +For files in the "thirdparty" directory: Please consult with the licenses in the appropriate READMEs or source codes. +For files in the "stuff/library/mypaint brushes" directory: Please see the licenses in stuff/library/mypaint brushes/Licenses.txt. + +- - - - - - - - - - - - - - - - + +OpenToonz + +All contributions by DWANGO: +Copyright (c) 2016 - 2018, DWANGO Co., Ltd. +All rights reserved. + +All other contributions: +Copyright (c) 2016 - 2018, the respective contributors. All rights reserved. +Each contributor holds copyright over their respective contributions. +The project versioning (Git) records all such contribution source information. + + +LICENSE + +BSD 3-Clause "New" or "Revised" License + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. diff --git a/README.md b/README.md index 469054b..d5a7d2b 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ Older versions and unstable nightly build are also available at +Copyright (C) 2002-2007, Marcelo E. Magallon +Copyright (C) 2002, Lev Povalahev +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +* The name of the author may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + + +Mesa 3-D graphics library +Version: 7.0 + +Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +Copyright (c) 2007 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and/or associated documentation files (the +"Materials"), to deal in the Materials without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Materials, and to +permit persons to whom the Materials are furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Materials. + +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. \ No newline at end of file diff --git a/stuff/doc/LICENSE/LICENSE_gotoblas.txt b/stuff/doc/LICENSE/LICENSE_gotoblas.txt new file mode 100644 index 0000000..c9f8ac3 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_gotoblas.txt @@ -0,0 +1,32 @@ +GotoBLAS2 (Version 1.13) +Copyright 2009, 2010 The University of Texas at Austin. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT AUSTIN ``AS IS'' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT +AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation +are those of the authors and should not be interpreted as representing +official policies, either expressed or implied, of The University of +Texas at Austin. diff --git a/stuff/doc/LICENSE/LICENSE_kissfft.txt b/stuff/doc/LICENSE/LICENSE_kissfft.txt new file mode 100644 index 0000000..69afea2 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_kissfft.txt @@ -0,0 +1,12 @@ +Kiss FFT +Copyright (c) 2003-2010, Mark Borgerding + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/stuff/doc/LICENSE/LICENSE_libjpeg.txt b/stuff/doc/LICENSE/LICENSE_libjpeg.txt new file mode 100644 index 0000000..62af885 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_libjpeg.txt @@ -0,0 +1,3 @@ +libjpeg : The Independent JPEG Group's JPEG software + +this software is based in part on the work of the Independent JPEG Group \ No newline at end of file diff --git a/stuff/doc/LICENSE/LICENSE_libtiff.txt b/stuff/doc/LICENSE/LICENSE_libtiff.txt new file mode 100644 index 0000000..458fb98 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_libtiff.txt @@ -0,0 +1,22 @@ +LibTIFF : TIFF Software Distribution +Copyright (c) 1988-1997 Sam Leffler +Copyright (c) 1991-1997 Silicon Graphics, Inc. + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, provided +that (i) the above copyright notices and this permission notice appear in +all copies of the software and related documentation, and (ii) the names of +Sam Leffler and Silicon Graphics may not be used in any advertising or +publicity relating to the software without the specific, prior written +permission of Sam Leffler and Silicon Graphics. + +THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +OF THIS SOFTWARE. \ No newline at end of file diff --git a/stuff/doc/LICENSE/LICENSE_lz4.txt b/stuff/doc/LICENSE/LICENSE_lz4.txt new file mode 100644 index 0000000..74c2cdd --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_lz4.txt @@ -0,0 +1,24 @@ +LZ4 Library +Copyright (c) 2011-2016, Yann Collet +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/stuff/doc/LICENSE/LICENSE_openblas.txt b/stuff/doc/LICENSE/LICENSE_openblas.txt new file mode 100644 index 0000000..2fd9e42 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_openblas.txt @@ -0,0 +1,29 @@ +OpenBLAS (Version 0.1.1) +Copyright (c) 2011,2012 Lab of Parallel Software and Computational Science,ISCAS +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + 3. Neither the name of the ISCAS nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/stuff/doc/LICENSE/LICENSE_qt.txt b/stuff/doc/LICENSE/LICENSE_qt.txt new file mode 100644 index 0000000..9c91b78 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_qt.txt @@ -0,0 +1,169 @@ +The Qt Toolkit +Copyright (C) 2018 The Qt Company Ltd. and other contributors. +Contact: https://www.qt.io/licensing/ + + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/stuff/doc/LICENSE/LICENSE_superlu.txt b/stuff/doc/LICENSE/LICENSE_superlu.txt new file mode 100644 index 0000000..2a8a201 --- /dev/null +++ b/stuff/doc/LICENSE/LICENSE_superlu.txt @@ -0,0 +1,30 @@ +SuperLU +Copyright (c) 2003, The Regents of the University of California, through +Lawrence Berkeley National Laboratory (subject to receipt of any required +approvals from U.S. Dept. of Energy) + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +(1) Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +(2) Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +(3) Neither the name of Lawrence Berkeley National Laboratory, U.S. Dept. of +Energy nor the names of its contributors may be used to endorse or promote +products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/stuff/profiles/layouts/shortcuts/defopentoonz.ini b/stuff/profiles/layouts/shortcuts/defopentoonz.ini index 27ec312..786fa9b 100644 --- a/stuff/profiles/layouts/shortcuts/defopentoonz.ini +++ b/stuff/profiles/layouts/shortcuts/defopentoonz.ini @@ -1,6 +1,4 @@ [shortcuts] -MI_Clear=Del -MI_OnionSkin=/ A_DecreaseBrushHardness= A_DecreaseMaxBrushThickness=U A_DecreaseMinBrushThickness=H @@ -8,20 +6,23 @@ A_FxSchematicToggle= A_IncreaseBrushHardness= A_IncreaseMaxBrushThickness=I A_IncreaseMinBrushThickness=J +A_ToolOption_Autofill= A_ToolOption_AutoGroup= -A_ToolOption_AutoSelect%3AColumn= -A_ToolOption_AutoSelect%3ANone= -A_ToolOption_AutoSelect%3APegbar= +A_ToolOption_AutopaintLines= +A_ToolOption_AutoSelect:Column= +A_ToolOption_AutoSelect:None= +A_ToolOption_AutoSelect:Pegbar= A_ToolOption_AutoSelectDrawing= -A_ToolOption_Autofill= A_ToolOption_BreakSharpAngles= A_ToolOption_BrushPreset= +A_ToolOption_DrawOrder= +A_ToolOption_EditToolActiveAxis:All= +A_ToolOption_EditToolActiveAxis:Center= +A_ToolOption_EditToolActiveAxis:Position= +A_ToolOption_EditToolActiveAxis:Rotation= +A_ToolOption_EditToolActiveAxis:Scale= +A_ToolOption_EditToolActiveAxis:Shear= A_ToolOption_EditToolActiveAxis= -A_ToolOption_EditToolActiveAxis%3ACenter= -A_ToolOption_EditToolActiveAxis%3APosition= -A_ToolOption_EditToolActiveAxis%3ARotation= -A_ToolOption_EditToolActiveAxis%3AScale= -A_ToolOption_EditToolActiveAxis%3AShear= A_ToolOption_FrameRange=F6 A_ToolOption_GeometricEdge= A_ToolOption_GeometricShape= @@ -31,10 +32,10 @@ A_ToolOption_Invert= A_ToolOption_JoinVectors= A_ToolOption_Manual= A_ToolOption_Meshify= +A_ToolOption_Mode:Areas= +A_ToolOption_Mode:Lines & Areas= +A_ToolOption_Mode:Lines= A_ToolOption_Mode= -A_ToolOption_Mode%3AAreas= -A_ToolOption_Mode%3ALines= -A_ToolOption_Mode%3ALines%20%26%20Areas= A_ToolOption_OnionSkin= A_ToolOption_Orientation= A_ToolOption_PencilMode= @@ -44,21 +45,22 @@ A_ToolOption_PressureSensitivity=Shift+P A_ToolOption_SegmentInk=F8 A_ToolOption_Selective=F7 A_ToolOption_ShowOnlyActiveSkeleton= -A_ToolOption_SkeletonMode%3AAnimate= -A_ToolOption_SkeletonMode%3ABuild%20Skeleton= -A_ToolOption_SkeletonMode%3AInverse%20Kinematics= +A_ToolOption_SkeletonMode:Animate= +A_ToolOption_SkeletonMode:Build Skeleton= +A_ToolOption_SkeletonMode:Inverse Kinematics= A_ToolOption_Smooth= A_ToolOption_Snap= +A_ToolOption_SnapSensitivity= +A_ToolOption_Type:Freehand= +A_ToolOption_Type:Normal= +A_ToolOption_Type:Polyline= +A_ToolOption_Type:Rectangular=F5 A_ToolOption_Type= -A_ToolOption_Type%3AFreehand= -A_ToolOption_Type%3ANormal= -A_ToolOption_Type%3APolyline= -A_ToolOption_Type%3ARectangular=F5 A_ToolOption_TypeFont= A_ToolOption_TypeSize= A_ToolOption_TypeStyle= -MI_ACheck= MI_About= +MI_ACheck= MI_ActivateAllColumns= MI_ActivateSelectedColumns= MI_ActivateThisColumnOnly= @@ -69,8 +71,10 @@ MI_AdjustLevels= MI_AdjustThickness= MI_Antialias= MI_ApplyMatchLines= -MI_AutoFillToggle=Shift+A +MI_AudioRecording=Alt+A MI_Autocenter= +MI_AutoFillToggle=Shift+A +MI_AutoInputCellNumber= MI_Autorenumber= MI_BCheck= MI_Binarize= @@ -87,6 +91,7 @@ MI_CanvasSize= MI_Cleanup= MI_CleanupPreview= MI_CleanupSettings= +MI_Clear=Del MI_ClearRecentImage= MI_ClearRecentLevel= MI_ClearRecentScene= @@ -97,10 +102,13 @@ MI_CloseChild= MI_Collapse= MI_CollectAssets= MI_CompareToSnapshot= -MI_ConvertFileWithInput= MI_ConvertFiles= +MI_ConvertFileWithInput= +MI_ConvertToToonzRaster= MI_ConvertToVectors= +MI_ConvertVectorToVector= MI_Copy=Ctrl+C +MI_CursorOutline= MI_Cut=Ctrl+X MI_DeactivateAllColumns= MI_DeactivateSelectedColumns= @@ -134,9 +142,11 @@ MI_ExplodeChild= MI_ExportLevel= MI_ExportScenes= MI_ExposeResource= +MI_FastRender=Alt+R MI_FieldGuide=Shift+G MI_FileInfo= MI_FillAreas= +MI_FillEmptyCell= MI_FillLines= MI_FirstFrame="Alt+," MI_FoldColumns= @@ -150,25 +160,28 @@ MI_GreenChannelGreyscale= MI_Group=Ctrl+G MI_Histogram= MI_ICheck= -MI_IOnly= MI_ImportMagpieFile= MI_ImportScenes= MI_IncreaseStep="'" MI_Increment= MI_Ink1Check= MI_Insert=Ins -MI_InsertFx=Ctrl+F +MI_InsertAbove=Shift+Ins +MI_InsertFx= MI_InsertGlobalKeyframe= MI_InsertSceneFrame= MI_InvertKeyframeSelection= MI_InvertSelection= +MI_IOnly= MI_LastFrame=Alt+. MI_LevelSettings= MI_LinesFade= MI_Link= +MI_LipSyncPopup=Alt+L MI_LoadColorModel= MI_LoadFolder= MI_LoadLevel= +MI_LoadRecentImage= MI_LoadScene=Ctrl+L MI_LoadSubSceneFile= MI_LockAllColumns=Ctrl+Alt+Shift+L @@ -181,19 +194,25 @@ MI_MergeCmapped= MI_MergeColumns= MI_MergeFrames= MI_NewLevel=Alt+N -MI_NewOutputFx= +MI_NewNoteLevel= +MI_NewOutputFx=Ctrl+F MI_NewProject= +MI_NewRasterLevel= MI_NewScene=Ctrl+N +MI_NewToonzRasterLevel= +MI_NewVectorLevel= MI_NextDrawing=. MI_NextFrame=Shift+. MI_NextStep= MI_NoShift= +MI_OnionSkin=/ MI_OpacityCheck=Alt+1 MI_OpenBatchServers= MI_OpenChild= MI_OpenCleanupSettings= MI_OpenColorModel= MI_OpenComboViewer= +MI_OpenCommandToolbar= MI_OpenFileBrowser= MI_OpenFileBrowser2= MI_OpenFileViewer= @@ -209,20 +228,23 @@ MI_OpenSchematic= MI_OpenScriptConsole= MI_OpenStudioPalette= MI_OpenStyleControl= -MI_OpenTMessage= MI_OpenTasks= -MI_OpenToolOptionBar= +MI_OpenTimelineView= +MI_OpenTMessage= MI_OpenToolbar= +MI_OpenToolOptionBar= MI_OpenXshView= MI_OutputSettings=Ctrl+O MI_OverwritePalette= -MI_PCheck= MI_Paste=Ctrl+V +MI_PasteAbove=Ctrl+Shift+V MI_PasteColors= MI_PasteInto= MI_PasteNames= +MI_PasteNumbers= MI_PasteValues= MI_Pause= +MI_PCheck= MI_PencilTest= MI_PickStyleAreas= MI_PickStyleLines= @@ -230,10 +252,10 @@ MI_Play=P MI_Preferences=Ctrl+U MI_PrevDrawing="," MI_PrevFrame="Shift+," -MI_PrevStep= MI_Preview=Ctrl+R MI_PreviewFx= MI_PreviewSettings= +MI_PrevStep= MI_Print=Ctrl+P MI_PrintXsheet= MI_ProjectSettings= @@ -247,13 +269,16 @@ MI_Reframe1= MI_Reframe2= MI_Reframe3= MI_Reframe4= +MI_ReframeWithEmptyInbetweens= MI_RefreshTree= MI_RegenerateFramePr= MI_RegeneratePreview= MI_ReloadStyle= +MI_RemoveEmptyColumns= MI_RemoveEndpoints= MI_RemoveGlobalKeyframe= MI_RemoveLevel= +MI_RemoveReferenceToStudioPalette= MI_RemoveSceneFrame= MI_RemoveUnused= MI_Render=Ctrl+Shift+R @@ -275,6 +300,7 @@ MI_Rollup= MI_RunScript= MI_SafeArea= MI_SaveAll=Ctrl+S +MI_SaveAllLevels= MI_SaveDefaultSettings= MI_SaveLevel= MI_SaveLevelAs= @@ -307,6 +333,8 @@ MI_SetScanCropbox= MI_ShiftTrace= MI_ShortcutPopup= MI_ShowFolderContents= +MI_SoundTrack= +MI_StartupPopup=Alt+S MI_Step2= MI_Step3= MI_Step4= @@ -316,7 +344,11 @@ MI_TCheck= MI_TimeStretch= MI_ToggleColumnLocks= MI_ToggleColumnsActivation= +MI_ToggleCurrentTimeIndicator= MI_ToggleEditInPlace= +MI_ToggleLinkToStudioPalette= +MI_ToggleXSheetToolbar= +MI_TouchGestureControl= MI_Tracking= MI_Undo=Ctrl+Z MI_Ungroup=Ctrl+Shift+G @@ -335,10 +367,12 @@ T_Bender= T_Brush=B T_ControlPointEditor=C T_Cutter= -T_Edit=E -T_Eraser=A +T_Edit=A +T_Eraser=E T_Fill=F T_Finger= +T_FlipX= +T_FlipY= T_Geometric=G T_Hand=Space T_Hook=O @@ -360,7 +394,6 @@ T_Tracker= T_Type=Y T_Zoom=Shift+Space T_ZoomFit=Alt+9 -T_ZoomReset=Alt+0 T_Zoomin=+ T_Zoomout=- -MI_LoadRecentImage= +T_ZoomReset=Alt+0 diff --git a/toonz/sources/common/tapptools/tenv.cpp b/toonz/sources/common/tapptools/tenv.cpp index 9151016..47bb8af 100644 --- a/toonz/sources/common/tapptools/tenv.cpp +++ b/toonz/sources/common/tapptools/tenv.cpp @@ -32,6 +32,11 @@ using namespace TEnv; //========================================================= namespace { +const std::map systemPathMap{ + {"LIBRARY", "library"}, {"STUDIOPALETTE", "studiopalette"}, + {"FXPRESETS", "fxs"}, {"CACHEROOT", "cache"}, + {"PROFILES", "profiles"}, {"CONFIG", "config"}, + {"PROJECTS", "projects"}}; class EnvGlobals { // singleton @@ -49,6 +54,9 @@ class EnvGlobals { // singleton TFilePath *m_dllRelativeDir; bool m_isPortable = false; + // path values specified with command line arguments + std::map m_argPathValues; + EnvGlobals() : m_stuffDir(0) { setWorkingDirectory(); } public: @@ -91,6 +99,7 @@ public: TFilePath getRootVarPath() { return getSystemVarPath(m_rootVarName); } std::string getSystemVarValue(std::string varName) { + if (getIsPortable()) return ""; #ifdef _WIN32 return TSystem::getSystemValue(getSystemVarPath(varName)).toStdString(); #else @@ -138,7 +147,8 @@ public: void updateEnvFile() { TFilePath profilesDir = getSystemVarPathValue(getSystemVarPrefix() + "PROFILES"); - if (profilesDir == TFilePath()) profilesDir = getStuffDir() + "profiles"; + if (profilesDir == TFilePath()) + profilesDir = getStuffDir() + systemPathMap.at("PROFILES"); m_envFile = profilesDir + "env" + (TSystem::getUserName().toStdString() + ".env"); } @@ -193,10 +203,7 @@ public: m_systemVarPrefix = prefix; updateEnvFile(); } - std::string getSystemVarPrefix() { - if (getIsPortable()) return ""; - return m_systemVarPrefix; - } + std::string getSystemVarPrefix() { return m_systemVarPrefix; } void setWorkingDirectory() { QString workingDirectoryTmp = QDir::currentPath(); @@ -223,6 +230,19 @@ public: if (m_dllRelativeDir) return *m_dllRelativeDir; return TFilePath("."); } + + void setArgPathValue(std::string key, std::string value) { + m_argPathValues.emplace(key, value); + if (key == m_systemVarPrefix + "PROFILES") updateEnvFile(); + } + + std::string getArgPathValue(std::string key) { + decltype(m_argPathValues)::iterator it = m_argPathValues.find(key); + if (it != m_argPathValues.end()) + return it->second; + else + return ""; + } }; /* @@ -502,15 +522,21 @@ std::string TEnv::getSystemVarStringValue(std::string varName) { TFilePath TEnv::getSystemVarPathValue(std::string varName) { EnvGlobals *eg = EnvGlobals::instance(); + // return if the path is registered by command line argument + std::string argVar = eg->getArgPathValue(varName); + if (argVar != "") return TFilePath(argVar); return TFilePath(eg->getSystemVarValue(varName)); } TFilePathSet TEnv::getSystemVarPathSetValue(std::string varName) { TFilePathSet lst; - std::string value = EnvGlobals::instance()->getSystemVarValue(varName); - int len = (int)value.size(); - int i = 0; - int j = value.find(';'); + EnvGlobals *eg = EnvGlobals::instance(); + // if the path is registered by command line argument, then use it + std::string value = eg->getArgPathValue(varName); + if (value == "") value = eg->getSystemVarValue(varName); + int len = (int)value.size(); + int i = 0; + int j = value.find(';'); while (j != std::string::npos) { std::string s = value.substr(i, j - i); lst.push_back(TFilePath(s)); @@ -542,7 +568,8 @@ bool TEnv::getIsPortable() { return EnvGlobals::instance()->getIsPortable(); } TFilePath TEnv::getConfigDir() { TFilePath configDir = getSystemVarPathValue(getSystemVarPrefix() + "CONFIG"); - if (configDir == TFilePath()) configDir = getStuffDir() + "config"; + if (configDir == TFilePath()) + configDir = getStuffDir() + systemPathMap.at("CONFIG"); return configDir; } @@ -566,6 +593,36 @@ void TEnv::setDllRelativeDir(const TFilePath &dllRelativeDir) { void TEnv::saveAllEnvVariables() { VariableSet::instance()->save(); } +bool TEnv::setArgPathValue(std::string key, std::string value) { + EnvGlobals *eg = EnvGlobals::instance(); + // in case of "-TOONZROOT" , set the all unregistered paths + if (key == getRootVarName()) { + TFilePath rootPath(value); + eg->setStuffDir(rootPath); + for (auto itr = systemPathMap.begin(); itr != systemPathMap.end(); ++itr) { + std::string k = getSystemVarPrefix() + (*itr).first; + std::string val = value + "\\" + (*itr).second; + // set all unregistered values + if (eg->getArgPathValue(k) == "") eg->setArgPathValue(k, val); + } + return true; + } else { + for (auto itr = systemPathMap.begin(); itr != systemPathMap.end(); ++itr) { + // found the corresponding registry key + if (key == getSystemVarPrefix() + (*itr).first) { + eg->setArgPathValue(key, value); + return true; + } + } + // registry key not found. failed to register + return false; + } +} + +const std::map &TEnv::getSystemPathMap() { + return systemPathMap; +} + /* void TEnv::defineSystemPath(SystemFileId id, const TFilePath ®istryName) { diff --git a/toonz/sources/include/tcli.h b/toonz/sources/include/tcli.h index 02f1796..f65b376 100644 --- a/toonz/sources/include/tcli.h +++ b/toonz/sources/include/tcli.h @@ -45,11 +45,11 @@ inline bool fromStr(double &value, std::string s) { return false; } inline bool fromStr(std::string &value, std::string s) { - value = s; + value = QString::fromLocal8Bit(s.c_str()).toStdString(); return true; } inline bool fromStr(TFilePath &value, std::string s) { - value = TFilePath(s); + value = TFilePath(QString::fromLocal8Bit(s.c_str())); return true; } diff --git a/toonz/sources/include/tenv.h b/toonz/sources/include/tenv.h index 5c97cf3..155044c 100644 --- a/toonz/sources/include/tenv.h +++ b/toonz/sources/include/tenv.h @@ -142,6 +142,12 @@ DVAPI void setDllRelativeDir(const TFilePath &dllRelativeDir); DVAPI void saveAllEnvVariables(); +// register command line argument paths. +// returns true on success +DVAPI bool setArgPathValue(std::string key, std::string value); + +DVAPI const std::map &getSystemPathMap(); + /* enum SystemFileId { diff --git a/toonz/sources/include/tfxparam.h b/toonz/sources/include/tfxparam.h index a698c73..909262b 100644 --- a/toonz/sources/include/tfxparam.h +++ b/toonz/sources/include/tfxparam.h @@ -11,7 +11,14 @@ template void bindParam(TFx *fx, std::string name, T &var, bool hidden = false, bool obsolete = false) { - fx->getParams()->add(new TParamVarT(name, var, hidden, obsolete)); + fx->getParams()->add(new TParamVarT(name, &var, 0, hidden, obsolete)); + var->addObserver(fx); +} + +template +void bindPluginParam(TFx *fx, std::string name, T &var, bool hidden = false, + bool obsolete = false) { + fx->getParams()->add(new TParamVarT(name, nullptr, var, hidden, obsolete)); var->addObserver(fx); } diff --git a/toonz/sources/include/toonzqt/fxschematicnode.h b/toonz/sources/include/toonzqt/fxschematicnode.h index cf69b8c..0c5a299 100644 --- a/toonz/sources/include/toonzqt/fxschematicnode.h +++ b/toonz/sources/include/toonzqt/fxschematicnode.h @@ -4,6 +4,8 @@ #define FXSCHEMATICNODE_H // TnzQt includes +#include "fxtypes.h" + #include "schematicnode.h" // Qt includes @@ -31,29 +33,6 @@ class FxSchematicNormalFxNode; class FxSchematicXSheetNode; class FxSchematicOutputNode; -//============================================================== - -enum eFxSchematicPortType { - eFxOutputPort = 200, - eFxInputPort = 201, - eFxLinkPort = 202, - eFxGroupedInPort = 203, - eFxGroupedOutPort = 204 -}; - -enum eFxType { - eNormalFx = 100, - eZeraryFx = 101, - eMacroFx = 102, - eColumnFx = 103, - eOutpuFx = 104, - eXSheetFx = 106, - eGroupedFx = 107, - eNormalImageAdjustFx = 108, - eNormalLayerBlendingFx = 109, - eNormalMatteFx = 110 -}; - //***************************************************** // FxColumnPainter //***************************************************** @@ -77,8 +56,6 @@ public: QWidget *widget = 0) override; void setName(const QString &name) { m_name = name; } - QLinearGradient getGradientByLevelType(int type); - public slots: void onIconGenerated(); @@ -126,7 +103,6 @@ class FxPainter final : public QObject, public QGraphicsItem { // to obtain the fx icons for zoom out view of the schematic std::string m_fxType; - QLinearGradient getGradientByLevelType(eFxType); void paint_small(QPainter *painter); public: @@ -297,7 +273,7 @@ protected: eFxType m_type; bool m_isCurrentFxLinked; - bool m_isLargeScaled; + bool m_isNormalIconView; protected: //! If the fx has dynamic port groups, ensures that each group always has at @@ -360,7 +336,8 @@ public: virtual bool isCached() const; virtual void resize(bool maximizeNode) {} - bool isLargeScaled() { return m_isLargeScaled; } + void toggleNormalIconView() { m_isNormalIconView = !m_isNormalIconView; } + bool isNormalIconView() { return m_isNormalIconView; } signals: void switchCurrentFx(TFx *fx); @@ -466,6 +443,7 @@ protected: protected slots: void onRenderToggleClicked(bool); + void onCameraStandToggleClicked(int); void onNameChanged(); }; diff --git a/toonz/sources/include/toonzqt/fxschematicscene.h b/toonz/sources/include/toonzqt/fxschematicscene.h index cd35c45..87c071a 100644 --- a/toonz/sources/include/toonzqt/fxschematicscene.h +++ b/toonz/sources/include/toonzqt/fxschematicscene.h @@ -98,10 +98,12 @@ class FxSchematicScene final : public SchematicScene { FxSchematicNode *m_currentFxNode; int m_gridDimension; - bool m_isLargeScaled; + bool m_isNormalIconView; QMap> m_nodesToPlace; + SchematicViewer *m_viewer; + public: FxSchematicScene(QWidget *parent); ~FxSchematicScene(); @@ -145,7 +147,10 @@ public: m_addFxContextMenu.setCurrentCursorScenePos(QPointF(0, 0)); } void selectNodes(QList &fxs); - bool isLargeScaled() { return m_isLargeScaled; } + void toggleNormalIconView() { m_isNormalIconView = !m_isNormalIconView; } + bool isNormalIconView() { return m_isNormalIconView; } + + SchematicViewer *getSchematicViewer() { return m_viewer; } protected: void contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) override; @@ -206,7 +211,6 @@ protected slots: void onCacheFx(); void onUncacheFx(); void onCollapse(const QList &); - void onOpenSubxsheet(); void onXsheetChanged(); void onSceneChanged(); @@ -222,6 +226,8 @@ protected slots: void onAltModifierChanged(bool); void onEditGroup(); + void onIconifyNodesToggled(bool iconified); + private: void setEnableCache(bool toggle); diff --git a/toonz/sources/include/toonzqt/fxtypes.h b/toonz/sources/include/toonzqt/fxtypes.h new file mode 100644 index 0000000..b268491 --- /dev/null +++ b/toonz/sources/include/toonzqt/fxtypes.h @@ -0,0 +1,27 @@ +#pragma once + +#ifndef TFXTYPES_INCLUDED +#define TFXTYPES_INCLUDED + +enum eFxSchematicPortType { + eFxOutputPort = 200, + eFxInputPort = 201, + eFxLinkPort = 202, + eFxGroupedInPort = 203, + eFxGroupedOutPort = 204 +}; + +enum eFxType { + eNormalFx = 100, + eZeraryFx = 101, + eMacroFx = 102, + eColumnFx = 103, + eOutpuFx = 104, + eXSheetFx = 106, + eGroupedFx = 107, + eNormalImageAdjustFx = 108, + eNormalLayerBlendingFx = 109, + eNormalMatteFx = 110 +}; + +#endif diff --git a/toonz/sources/include/toonzqt/imageutils.h b/toonz/sources/include/toonzqt/imageutils.h index e7fab92..863e088 100644 --- a/toonz/sources/include/toonzqt/imageutils.h +++ b/toonz/sources/include/toonzqt/imageutils.h @@ -116,6 +116,16 @@ void DVAPI convertNaa2Tlv( bool removeUnusedStyles = false, double dpi = 0.0); //! Remove unused styles from input palette. +// convert old levels (tzp / tzu) to tlv +void DVAPI convertOldLevel2Tlv( + const TFilePath &source, //!< Level path to convert from. + const TFilePath &dest, //!< Level path to convert to. + const TFrameId &from, //!< First source frame to convert. + const TFrameId &to, //!< Last source frame to convert. + FrameTaskNotifier + *frameNotifier //!< Observer class for frame success notifications. + ); + double DVAPI getQuantizedZoomFactor(double zf, bool forward); void DVAPI getFillingInformationOverlappingArea( diff --git a/toonz/sources/include/toonzqt/schematicnode.h b/toonz/sources/include/toonzqt/schematicnode.h index 709efef..d50a859 100644 --- a/toonz/sources/include/toonzqt/schematicnode.h +++ b/toonz/sources/include/toonzqt/schematicnode.h @@ -83,7 +83,8 @@ class SchematicToggle : public QObject, public QGraphicsItem { Q_INTERFACES(QGraphicsItem) #endif protected: - QPixmap m_pixmap1, m_pixmap2; + QIcon m_imageOn, m_imageOn2, m_imageOff; + QColor m_colorOn, m_colorOff; int m_state; int m_flags; int m_width, m_height; @@ -91,12 +92,21 @@ protected: public: enum { eIsParentColumn = 0x01, eEnableNullState = 0x02 }; - SchematicToggle(SchematicNode *parent, const QPixmap &pixmap, int flags, - bool isLargeScaled = true); + SchematicToggle(SchematicNode *parent, const QIcon &imageOn, QColor colorOn, + int flags, bool isNormalIconView = true); + + SchematicToggle(SchematicNode *parent, const QIcon &imageOn, QColor colorOn, + const QIcon &imageOff, QColor colorOff, int flags, + bool isNormalIconView = true); //! the schematic toggle can be a 3-state or a 2-state toggle! - SchematicToggle(SchematicNode *parent, const QPixmap &pixmap1, - const QPixmap &pixmap2, int flags, bool isLargeScaled = true); + SchematicToggle(SchematicNode *parent, const QIcon &imageOn, + const QIcon &imageOn2, QColor colorOn, int flags, + bool isNormalIconView = true); + + SchematicToggle(SchematicNode *parent, const QIcon &imageOn, + const QIcon &imageOn2, QColor colorOn, const QIcon &imageOff, + QColor colorOff, int flags, bool isNormalIconView = true); ~SchematicToggle(); @@ -136,10 +146,11 @@ class SchematicToggle_SplineOptions final : public SchematicToggle { public: SchematicToggle_SplineOptions(SchematicNode *parent, const QPixmap &pixmap, int flags) - : SchematicToggle(parent, pixmap, flags) {} + : SchematicToggle(parent, QIcon(pixmap), QColor(0, 0, 0, 0), flags) {} SchematicToggle_SplineOptions(SchematicNode *parent, const QPixmap &pixmap1, const QPixmap &pixmap2, int flags) - : SchematicToggle(parent, pixmap1, pixmap2, flags) {} + : SchematicToggle(parent, QIcon(pixmap1), QIcon(pixmap2), + QColor(0, 0, 0, 0), flags) {} void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) override; diff --git a/toonz/sources/include/toonzqt/schematicviewer.h b/toonz/sources/include/toonzqt/schematicviewer.h index 2342355..d26e1f8 100644 --- a/toonz/sources/include/toonzqt/schematicviewer.h +++ b/toonz/sources/include/toonzqt/schematicviewer.h @@ -14,6 +14,8 @@ #include #include +#include + // STD includes #include @@ -181,6 +183,139 @@ private: class DVAPI SchematicViewer final : public QWidget { Q_OBJECT + QColor m_textColor; // text color (black) + Q_PROPERTY(QColor TextColor READ getTextColor WRITE setTextColor) + + QColor m_verticalLineColor; + Q_PROPERTY(QColor VerticalLineColor READ getVerticalLineColor WRITE + setVerticalLineColor) + + // TZP column + QColor m_levelColumnColor; //(127,219,127) + Q_PROPERTY(QColor LevelColumnColor READ getLevelColumnColor WRITE + setLevelColumnColor) + + // PLI column + QColor m_vectorColumnColor; //(212,212,133) + Q_PROPERTY(QColor VectorColumnColor READ getVectorColumnColor WRITE + setVectorColumnColor) + + // subXsheet column + QColor m_childColumnColor; //(214,154,219) + Q_PROPERTY(QColor ChildColumnColor READ getChildColumnColor WRITE + setChildColumnColor) + + // Raster image column + QColor m_fullcolorColumnColor; //(154,214,219) + Q_PROPERTY(QColor FullcolorColumnColor READ getFullcolorColumnColor WRITE + setFullcolorColumnColor) + + // Fx column + QColor m_fxColumnColor; //(130,129,93) + Q_PROPERTY(QColor FxColumnColor READ getFxColumnColor WRITE setFxColumnColor) + + // Palette column + QColor m_paletteColumnColor; //(42,171,154) + Q_PROPERTY(QColor PaletteColumnColor READ getPaletteColumnColor WRITE + setPaletteColumnColor) + + // Mesh column + QColor m_meshColumnColor; + Q_PROPERTY( + QColor MeshColumnColor READ getMeshColumnColor WRITE setMeshColumnColor) + + // Table node + QColor m_tableColor; + Q_PROPERTY(QColor TableColor READ getTableColor WRITE setTableColor) + + // Camera nodes + QColor m_activeCameraColor, m_otherCameraColor; + Q_PROPERTY(QColor ActiveCameraColor READ getActiveCameraColor WRITE + setActiveCameraColor) + Q_PROPERTY(QColor OtherCameraColor READ getOtherCameraColor WRITE + setOtherCameraColor) + + // Group node + QColor m_groupColor; + Q_PROPERTY(QColor GroupColor READ getGroupColor WRITE setGroupColor) + + // Peg node + QColor m_pegColor; + Q_PROPERTY(QColor PegColor READ getPegColor WRITE setPegColor) + + // Path node + QColor m_splineColor; + Q_PROPERTY(QColor SplineColor READ getSplineColor WRITE setSplineColor) + + // Output nodes + QColor m_activeOutputColor, m_otherOutputColor; + Q_PROPERTY(QColor ActiveOutputColor READ getActiveOutputColor WRITE + setActiveOutputColor) + Q_PROPERTY(QColor OtherOutputColor READ getOtherOutputColor WRITE + setOtherOutputColor) + + // Xsheet node + QColor m_xsheetColor; + Q_PROPERTY(QColor XsheetColor READ getXsheetColor WRITE setXsheetColor) + + // Fx nodes + QColor m_normalFx; + Q_PROPERTY(QColor NormalFxColor READ getNormalFxColor WRITE setNormalFxColor) + + QColor m_macroFx; + Q_PROPERTY(QColor MacroFxColor READ getMacroFxColor WRITE setMacroFxColor) + + QColor m_imageAdjustFx; + Q_PROPERTY(QColor ImageAdjustFxColor READ getImageAdjustFxColor WRITE + setImageAdjustFxColor) + + QColor m_layerBlendingFx; + Q_PROPERTY(QColor LayerBlendingFxColor READ getLayerBlendingFxColor WRITE + setLayerBlendingFxColor) + + QColor m_matteFx; + Q_PROPERTY(QColor MatteFxColor READ getMatteFxColor WRITE setMatteFxColor) + + // Schematic Preview Button + QColor m_schematicPreviewButtonBgOnColor; + QIcon m_schematicPreviewButtonOnImage; + QColor m_schematicPreviewButtonBgOffColor; + QIcon m_schematicPreviewButtonOffImage; + Q_PROPERTY(QColor SchematicPreviewButtonBgOnColor READ + getSchematicPreviewButtonBgOnColor WRITE + setSchematicPreviewButtonBgOnColor) + Q_PROPERTY( + QIcon SchematicPreviewButtonOnImage READ getSchematicPreviewButtonOnImage + WRITE setSchematicPreviewButtonOnImage) + Q_PROPERTY(QColor SchematicPreviewButtonBgOffColor READ + getSchematicPreviewButtonBgOffColor WRITE + setSchematicPreviewButtonBgOffColor) + Q_PROPERTY(QIcon SchematicPreviewButtonOffImage READ + getSchematicPreviewButtonOffImage WRITE + setSchematicPreviewButtonOffImage) + + // Schematic Camstand Button + QColor m_schematicCamstandButtonBgOnColor; + QIcon m_schematicCamstandButtonOnImage; + QIcon m_schematicCamstandButtonTranspImage; + QColor m_schematicCamstandButtonBgOffColor; + QIcon m_schematicCamstandButtonOffImage; + Q_PROPERTY(QColor SchematicCamstandButtonBgOnColor READ + getSchematicCamstandButtonBgOnColor WRITE + setSchematicCamstandButtonBgOnColor) + Q_PROPERTY(QIcon SchematicCamstandButtonOnImage READ + getSchematicCamstandButtonOnImage WRITE + setSchematicCamstandButtonOnImage) + Q_PROPERTY(QIcon SchematicCamstandButtonTranspImage READ + getSchematicCamstandButtonTranspImage WRITE + setSchematicCamstandButtonTranspImage) + Q_PROPERTY(QColor SchematicCamstandButtonBgOffColor READ + getSchematicCamstandButtonBgOffColor WRITE + setSchematicCamstandButtonBgOffColor) + Q_PROPERTY(QIcon SchematicCamstandButtonOffImage READ + getSchematicCamstandButtonOffImage WRITE + setSchematicCamstandButtonOffImage) + public: SchematicViewer(QWidget *parent); ~SchematicViewer(); @@ -190,6 +325,164 @@ public: bool isStageSchematicViewed(); void setStageSchematicViewed(bool isStageSchematic); + void setTextColor(const QColor &color) { m_textColor = color; } + QColor getTextColor() const { return m_textColor; } + + void setVerticalLineColor(const QColor &color) { + m_verticalLineColor = color; + } + QColor getVerticalLineColor() const { return m_verticalLineColor; } + + // TZP column + void setLevelColumnColor(const QColor &color) { m_levelColumnColor = color; } + QColor getLevelColumnColor() const { return m_levelColumnColor; } + + // PLI column + void setVectorColumnColor(const QColor &color) { + m_vectorColumnColor = color; + } + QColor getVectorColumnColor() const { return m_vectorColumnColor; } + + // subXsheet column + void setChildColumnColor(const QColor &color) { m_childColumnColor = color; } + QColor getChildColumnColor() const { return m_childColumnColor; } + + // Raster image column + void setFullcolorColumnColor(const QColor &color) { + m_fullcolorColumnColor = color; + } + QColor getFullcolorColumnColor() const { return m_fullcolorColumnColor; } + + // Fx column + void setFxColumnColor(const QColor &color) { m_fxColumnColor = color; } + QColor getFxColumnColor() const { return m_fxColumnColor; } + + // Palette column + void setPaletteColumnColor(const QColor &color) { + m_paletteColumnColor = color; + } + QColor getPaletteColumnColor() const { return m_paletteColumnColor; } + + // Mesh column + void setMeshColumnColor(const QColor &color) { m_meshColumnColor = color; } + QColor getMeshColumnColor() const { return m_meshColumnColor; } + + // Table node + void setTableColor(const QColor &color) { m_tableColor = color; } + QColor getTableColor() const { return m_tableColor; } + + // Camera nodes + void setActiveCameraColor(const QColor &color) { + m_activeCameraColor = color; + } + void setOtherCameraColor(const QColor &color) { m_otherCameraColor = color; } + QColor getActiveCameraColor() const { return m_activeCameraColor; } + QColor getOtherCameraColor() const { return m_otherCameraColor; } + + // Group node + void setGroupColor(const QColor &color) { m_groupColor = color; } + QColor getGroupColor() const { return m_groupColor; } + + // Peg node + void setPegColor(const QColor &color) { m_pegColor = color; } + QColor getPegColor() const { return m_pegColor; } + + // Path node + void setSplineColor(const QColor &color) { m_splineColor = color; } + QColor getSplineColor() const { return m_splineColor; } + + // Output nodes + void setActiveOutputColor(const QColor &color) { + m_activeOutputColor = color; + } + void setOtherOutputColor(const QColor &color) { m_otherOutputColor = color; } + QColor getActiveOutputColor() const { return m_activeOutputColor; } + QColor getOtherOutputColor() const { return m_otherOutputColor; } + + // Xsheet node + void setXsheetColor(const QColor &color) { m_xsheetColor = color; } + QColor getXsheetColor() const { return m_xsheetColor; } + + // Fx nodes + QColor getNormalFxColor() const { return m_normalFx; } + void setNormalFxColor(const QColor &color) { m_normalFx = color; } + + QColor getMacroFxColor() const { return m_macroFx; } + void setMacroFxColor(const QColor &color) { m_macroFx = color; } + + QColor getImageAdjustFxColor() const { return m_imageAdjustFx; } + void setImageAdjustFxColor(const QColor &color) { m_imageAdjustFx = color; } + + QColor getLayerBlendingFxColor() const { return m_layerBlendingFx; } + void setLayerBlendingFxColor(const QColor &color) { + m_layerBlendingFx = color; + } + + QColor getMatteFxColor() const { return m_matteFx; } + void setMatteFxColor(const QColor &color) { m_matteFx = color; } + + // Schematic Preview Button + void setSchematicPreviewButtonBgOnColor(const QColor &color) { + m_schematicPreviewButtonBgOnColor = color; + } + void setSchematicPreviewButtonOnImage(const QIcon &image) { + m_schematicPreviewButtonOnImage = image; + } + void setSchematicPreviewButtonBgOffColor(const QColor &color) { + m_schematicPreviewButtonBgOffColor = color; + } + void setSchematicPreviewButtonOffImage(const QIcon &image) { + m_schematicPreviewButtonOffImage = image; + } + QColor getSchematicPreviewButtonBgOnColor() const { + return m_schematicPreviewButtonBgOnColor; + } + QIcon getSchematicPreviewButtonOnImage() const { + return m_schematicPreviewButtonOnImage; + } + QColor getSchematicPreviewButtonBgOffColor() const { + return m_schematicPreviewButtonBgOffColor; + } + QIcon getSchematicPreviewButtonOffImage() const { + return m_schematicPreviewButtonOffImage; + } + + // Schematic Camstand Button + void setSchematicCamstandButtonBgOnColor(const QColor &color) { + m_schematicCamstandButtonBgOnColor = color; + } + void setSchematicCamstandButtonOnImage(const QIcon &image) { + m_schematicCamstandButtonOnImage = image; + } + void setSchematicCamstandButtonTranspImage(const QIcon &image) { + m_schematicCamstandButtonTranspImage = image; + } + void setSchematicCamstandButtonBgOffColor(const QColor &color) { + m_schematicCamstandButtonBgOffColor = color; + } + void setSchematicCamstandButtonOffImage(const QIcon &image) { + m_schematicCamstandButtonOffImage = image; + } + QColor getSchematicCamstandButtonBgOnColor() const { + return m_schematicCamstandButtonBgOnColor; + } + QIcon getSchematicCamstandButtonOnImage() const { + return m_schematicCamstandButtonOnImage; + } + QIcon getSchematicCamstandButtonTranspImage() const { + return m_schematicCamstandButtonTranspImage; + } + QColor getSchematicCamstandButtonBgOffColor() const { + return m_schematicCamstandButtonBgOffColor; + } + QIcon getSchematicCamstandButtonOffImage() const { + return m_schematicCamstandButtonOffImage; + } + + void getNodeColor(int ltype, QColor &nodeColor); + + QColor getSelectedNodeTextColor(); + void setCursorMode(CursorMode mode); public slots: diff --git a/toonz/sources/include/toonzqt/stageschematicscene.h b/toonz/sources/include/toonzqt/stageschematicscene.h index 6b04414..b39aa9f 100644 --- a/toonz/sources/include/toonzqt/stageschematicscene.h +++ b/toonz/sources/include/toonzqt/stageschematicscene.h @@ -101,6 +101,8 @@ class StageSchematicScene final : public SchematicScene { bool m_showLetterOnPortFlag; + SchematicViewer *m_viewer; + public: StageSchematicScene(QWidget *parent); ~StageSchematicScene(); @@ -135,6 +137,8 @@ public: bool isShowLetterOnPortFlagEnabled() { return m_showLetterOnPortFlag; } + SchematicViewer *getSchematicViewer() { return m_viewer; } + private: StageSchematicNode *addStageSchematicNode(TStageObject *pegbar); StageSchematicGroupNode *addStageGroupNode(QList objs); @@ -210,7 +214,6 @@ protected slots: void onCurrentColumnChanged(int); void onSelectionChanged(); void onCollapse(QList); - void onOpenSubxsheet(); void onEditGroup(); void onSwitchPortModeToggled(bool withLetter); diff --git a/toonz/sources/include/tparamcontainer.h b/toonz/sources/include/tparamcontainer.h index a44c3a2..899a4c2 100644 --- a/toonz/sources/include/tparamcontainer.h +++ b/toonz/sources/include/tparamcontainer.h @@ -54,20 +54,33 @@ public: template class TParamVarT final : public TParamVar { - TParamP m_var; + // Very dirty fix for link fx, separating the variable between the plugin fx + // and the built-in fx. + // Note that for now link fx is available only with built-in fx, since m_var + // must be "pointer to pointer" of parameter to make the link fx to work + // properly. + T *m_var = nullptr; + TParamP m_pluginVar = 0; public: - TParamVarT(std::string name, TParamP var, bool hidden = false, - bool obsolete = false) - : TParamVar(name, hidden, obsolete), m_var(var) {} - TParamVarT(std::string name, T *var, bool hidden = false, - bool obsolete = false) - : TParamVar(name, hidden, obsolete), m_var(var) {} - void setParam(TParam *param) override { m_var = TParamP(param); } - - TParam *getParam() const override { return m_var.getPointer(); } - TParamVar *clone() const override { - return new TParamVarT(getName(), m_var, isHidden(), isObsolete()); + TParamVarT(std::string name, T *var = nullptr, TParamP pluginVar = 0, + bool hidden = false, bool obsolete = false) + : TParamVar(name, hidden), m_var(var), m_pluginVar(pluginVar) {} + TParamVarT() = delete; + void setParam(TParam *param) { + if (m_var) + *m_var = TParamP(param); + else + m_pluginVar = TParamP(param); + } + virtual TParam *getParam() const { + if (m_var) + return m_var->getPointer(); + else + return m_pluginVar.getPointer(); + } + TParamVar *clone() const { + return new TParamVarT(getName(), m_var, m_pluginVar, isHidden()); } }; diff --git a/toonz/sources/tnztools/brushtool.cpp b/toonz/sources/tnztools/brushtool.cpp index 19bdf52..6b51831 100644 --- a/toonz/sources/tnztools/brushtool.cpp +++ b/toonz/sources/tnztools/brushtool.cpp @@ -1484,10 +1484,16 @@ void BrushTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) { TRectD invalidateRect; TPointD halfThick(m_maxThick * 0.5, m_maxThick * 0.5); + TPointD snapThick(6.0 * m_pixelSize, 6.0 * m_pixelSize); // In order to clear the previous brush tip invalidateRect += TRectD(m_brushPos - halfThick, m_brushPos + halfThick); + // In order to clear the previous snap indicator + if (m_foundLastSnap) + invalidateRect += + TRectD(m_lastSnapPoint - snapThick, m_lastSnapPoint + snapThick); + m_currThickness = thickness; m_mousePos = pos; @@ -1503,7 +1509,7 @@ void BrushTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) { if (m_foundLastSnap) invalidateRect += - TRectD(m_lastSnapPoint - halfThick, m_lastSnapPoint + halfThick); + TRectD(m_lastSnapPoint - snapThick, m_lastSnapPoint + snapThick); if (e.isShiftPressed()) { m_smoothStroke.clearPoints(); @@ -1746,8 +1752,8 @@ bool BrushTool::doFrameRangeStrokes(TFrameId firstFrameId, TStroke *firstStroke, swapped = true; } - firstImage->addStroke(first); - lastImage->addStroke(last); + firstImage->addStroke(first, false); + lastImage->addStroke(last, false); assert(firstFrameId <= lastFrameId); std::vector allFids; @@ -2097,12 +2103,22 @@ void BrushTool::mouseMove(const TPointD &pos, const TMouseEvent &e) { m_brushPos = pos; if (m_targetType & TTool::Vectors) { + TPointD snapThick(6.0 * m_pixelSize, 6.0 * m_pixelSize); + // In order to clear the previous snap indicator + if (m_foundFirstSnap) + invalidateRect += + TRectD(m_firstSnapPoint - snapThick, m_firstSnapPoint + snapThick); + m_firstSnapPoint = pos; m_foundFirstSnap = false; m_altPressed = e.isAltPressed() && !e.isCtrlPressed(); checkStrokeSnapping(true, m_altPressed); checkGuideSnapping(true, m_altPressed); m_brushPos = m_firstSnapPoint; + // In order to draw the snap indicator + if (m_foundFirstSnap) + invalidateRect += + TRectD(m_firstSnapPoint - snapThick, m_firstSnapPoint + snapThick); } invalidateRect += TRectD(pos - halfThick, pos + halfThick); } diff --git a/toonz/sources/toonz/convertpopup.cpp b/toonz/sources/toonz/convertpopup.cpp index 8417cb7..7a3cf64 100644 --- a/toonz/sources/toonz/convertpopup.cpp +++ b/toonz/sources/toonz/convertpopup.cpp @@ -75,6 +75,7 @@ QMap ConvertPopup::m_formatProperties; // const QString CreateNewPalette(QObject::tr("Create new palette")); const QString TlvExtension("tlv"); +const QString OldLevelToTlvExtension("Old Level to TLV"); /* const QString TlvMode_Unpainted(QObject::tr("Unpainted tlv")); const QString TlvMode_PaintedFromTwoImages(QObject::tr("Painted tlv from two @@ -213,6 +214,10 @@ void ConvertPopup::Converter::convertLevel( } else { convertLevelWithConvert2Tlv(sourceFileFullPath); } + } else if (popup->m_fileFormat->currentText() == OldLevelToTlvExtension) { + // convert old levels (tzp/tzu) to tlv + ImageUtils::convertOldLevel2Tlv(sourceFileFullPath, dstFileFullPath, from, + to, m_parent->m_notifier); } else { // convert to full-color TPixel32 bgColor = m_parent->m_bgColorField->getColor(); @@ -727,12 +732,13 @@ void ConvertPopup::onTlvModeSelected(const QString &tlvMode) { void ConvertPopup::onFormatSelected(const QString &format) { onFormatChanged(format); - bool isTlv = format == TlvExtension; - bool isPli = format == "svg"; + bool isTlv = format == TlvExtension; + bool isOldLevel2Tlv = format == OldLevelToTlvExtension; + bool isPli = format == "svg"; - m_formatOptions->setVisible(!isTlv); - m_bgColorField->setVisible(!isTlv && !isPli); - m_bgColorLabel->setVisible(!isTlv && !isPli); + m_formatOptions->setVisible(!isTlv && !isOldLevel2Tlv); + m_bgColorField->setVisible(!isTlv && !isPli && !isOldLevel2Tlv); + m_bgColorLabel->setVisible(!isTlv && !isPli && !isOldLevel2Tlv); m_tlvFrame->setVisible(isTlv); // m_svgFrame->setVisible(isPli); @@ -755,14 +761,27 @@ void ConvertPopup::setFiles(const std::vector &fps) { m_okBtn->setEnabled(true); m_fileFormat->setEnabled(true); m_fileFormat->removeItem(m_fileFormat->findText("svg")); + m_fileFormat->removeItem(m_fileFormat->findText(OldLevelToTlvExtension)); + // true if the ALL files are full color raster bool areFullcolor = true; - bool areVector = false; + + // true if AT LEAST ONE file is vector. Since the popup will never open if the + // file selection contains both raster and vector file types, we can assume + // ALL files are vector if areVector == true. + bool areVector = false; + // For the same logic as the above, true if all files are old levels + // (tzp/tzu). + bool areOldLevel = false; + for (int i = 0; i < (int)fps.size(); i++) { TFileType::Type type = TFileType::getInfo(fps[i]); if (!TFileType::isFullColor(type)) { - areFullcolor = false; - if (TFileType::isVector(type)) areVector = true; + areFullcolor = false; + if (TFileType::isVector(type)) + areVector = true; + else if (fps[i].getType() == "tzp" || fps[i].getType() == "tzu") + areOldLevel = true; break; } } @@ -779,9 +798,13 @@ void ConvertPopup::setFiles(const std::vector &fps) { m_fileFormat->setCurrentIndex(m_fileFormat->findText("svg")); m_fileFormat->setEnabled(false); onFormatSelected("svg"); - } else - - { + } else if (areOldLevel) { + if (tlvIndex < 0) m_fileFormat->addItem(OldLevelToTlvExtension); + m_fileFormat->setCurrentIndex( + m_fileFormat->findText(OldLevelToTlvExtension)); + m_fileFormat->setEnabled(false); + onFormatSelected(OldLevelToTlvExtension); + } else { if (tlvIndex >= 0) { int index = m_fileFormat->currentIndex(); m_fileFormat->removeItem(tlvIndex); @@ -1014,7 +1037,10 @@ TFilePath ConvertPopup::getDestinationFilePath( // Build the output level name const QString &fldName = m_fileNameFld->text(); - const std::string &ext = m_fileFormat->currentText().toStdString(); + const std::string &ext = + (m_fileFormat->currentText() == OldLevelToTlvExtension) + ? "tlv" + : m_fileFormat->currentText().toStdString(); const std::wstring &name = fldName.isEmpty() ? sourceFilePath.getWideName() : fldName.toStdWString(); @@ -1243,7 +1269,8 @@ void ConvertPopup::onOptionsClicked() { //------------------------------------------------------------------- void ConvertPopup::onFormatChanged(const QString &ext) { - if (ext == QString("avi") || ext == QString("tzp") || ext == TlvExtension) { + if (ext == QString("avi") || ext == QString("tzp") || ext == TlvExtension || + ext == OldLevelToTlvExtension) { m_removeDotBeforeFrameNumber->setChecked(false); m_removeDotBeforeFrameNumber->setEnabled(false); } else { diff --git a/toonz/sources/toonz/filebrowser.cpp b/toonz/sources/toonz/filebrowser.cpp index a14fe8a..4d2c576 100644 --- a/toonz/sources/toonz/filebrowser.cpp +++ b/toonz/sources/toonz/filebrowser.cpp @@ -1086,6 +1086,10 @@ TSystem::renameFile(newFolder, folder); //----------------------------------------------------------------------------- QMenu *FileBrowser::getContextMenu(QWidget *parent, int index) { + auto isOldLevelType = [](TFilePath &path) -> bool { + return path.getType() == "tzp" || path.getType() == "tzu"; + }; + bool ret = true; // TODO: spostare in questa classe anche la definizione delle azioni? @@ -1180,12 +1184,17 @@ QMenu *FileBrowser::getContextMenu(QWidget *parent, int index) { if (i == files.size()) { std::string type = files[0].getType(); for (j = 0; j < files.size(); j++) - if (files[j].getType() == "tzp" || files[j].getType() == "tzu") break; + if (isOldLevelType(files[j])) break; if (j == files.size()) menu->addAction(cm->getAction(MI_ViewFile)); - for (j = 0; j < files.size(); j++) + + for (j = 0; j < files.size(); j++) { if ((files[0].getType() == "pli" && files[j].getType() != "pli") || (files[0].getType() != "pli" && files[j].getType() == "pli")) break; + else if ((isOldLevelType(files[0]) && !isOldLevelType(files[j])) || + (!isOldLevelType(files[0]) && isOldLevelType(files[j]))) + break; + } if (j == files.size()) { menu->addAction(cm->getAction(MI_ConvertFiles)); // iwsw commented out temporarily diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index 9561e51..4ddea24 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -77,6 +77,7 @@ #include #include #include +#include using namespace DVGui; #if defined LINETEST @@ -97,9 +98,10 @@ const char *dllRelativePath = "./toonz6.app/Contents/Frameworks"; TEnv::IntVar EnvSoftwareCurrentFontSize("SoftwareCurrentFontSize", 12); -const char *applicationFullName = "OpenToonz 1.2.1"; // next will be 1.3 (not 1.3.0) -const char *rootVarName = "TOONZROOT"; -const char *systemVarPrefix = "TOONZ"; +const char *applicationFullName = + "OpenToonz 1.2.1"; // next will be 1.3 (not 1.3.0) +const char *rootVarName = "TOONZROOT"; +const char *systemVarPrefix = "TOONZ"; #ifdef MACOSX #include "tthread.h" @@ -150,7 +152,7 @@ DV_IMPORT_API void initColorFx(); la stuffDir, controlla se la directory di outputs esiste (e provvede a crearla in caso contrario) verifica inoltre che stuffDir esista. */ -static void initToonzEnv() { +static void initToonzEnv(QHash &argPathValues) { StudioPalette::enable(true); TEnv::setApplication(applicationName, applicationVersion, @@ -159,6 +161,15 @@ static void initToonzEnv() { TEnv::setSystemVarPrefix(systemVarPrefix); TEnv::setDllRelativeDir(TFilePath(dllRelativePath)); + QHash::const_iterator i = argPathValues.constBegin(); + while (i != argPathValues.constEnd()) { + if (!TEnv::setArgPathValue(i.key().toStdString(), i.value().toStdString())) + DVGui::error( + QObject::tr("The qualifier %1 is not a valid key name. Skipping.") + .arg(i.key())); + ++i; + } + QCoreApplication::setOrganizationName("OpenToonz"); QCoreApplication::setOrganizationDomain(""); QString fullApplicationNameQStr = @@ -244,18 +255,63 @@ int main(int argc, char *argv[]) { } #endif - /*-- "-layout [レイアウト設定ファイル名]" - * で、必要なモジュールのPageだけのレイアウトで起動することを可能にする --*/ - QString argumentLayoutFileName = ""; + // parsing arguments and qualifiers TFilePath loadScenePath; + QString argumentLayoutFileName = ""; + QHash argumentPathValues; if (argc > 1) { - for (int a = 1; a < argc; a++) { - if (QString(argv[a]) == "-layout") { - argumentLayoutFileName = QString(argv[a + 1]); - a++; - } else - loadScenePath = TFilePath(argv[a]); + TCli::Usage usage(argv[0]); + TCli::UsageLine usageLine; + TCli::FilePathArgument loadSceneArg("scenePath", "Source scene file"); + TCli::StringQualifier layoutFileQual( + "-layout filename", + "Custom layout file to be used, it should be saved in " + "$TOONZPROFILES\\layouts\\personal\\[CurrentLayoutName].[UserName]\\. " + "layouts.txt is used by default."); + usageLine = usageLine + layoutFileQual; + + // system path qualifiers + std::map>> + systemPathQualMap; + QString qualKey = QString("%1ROOT").arg(systemVarPrefix); + QString qualName = QString("-%1 folderpath").arg(qualKey); + QString qualHelp = + QString( + "%1 path. It will automatically set other system paths to %1 " + "unless individually specified with other qualifiers.") + .arg(qualKey); + systemPathQualMap[qualKey].reset(new TCli::QualifierT( + qualName.toStdString(), qualHelp.toStdString())); + usageLine = usageLine + *systemPathQualMap[qualKey]; + + const std::map &spm = TEnv::getSystemPathMap(); + for (auto itr = spm.begin(); itr != spm.end(); ++itr) { + qualKey = QString("%1%2") + .arg(systemVarPrefix) + .arg(QString::fromStdString((*itr).first)); + qualName = QString("-%1 folderpath").arg(qualKey); + qualHelp = QString("%1 path.").arg(qualKey); + systemPathQualMap[qualKey].reset(new TCli::QualifierT( + qualName.toStdString(), qualHelp.toStdString())); + usageLine = usageLine + *systemPathQualMap[qualKey]; } + usage.add(usageLine); + usage.add(usageLine + loadSceneArg); + + if (!usage.parse(argc, argv)) exit(1); + + loadScenePath = loadSceneArg.getValue(); + if (layoutFileQual.isSelected()) + argumentLayoutFileName = + QString::fromStdString(layoutFileQual.getValue()); + for (auto q_itr = systemPathQualMap.begin(); + q_itr != systemPathQualMap.end(); ++q_itr) { + if (q_itr->second->isSelected()) + argumentPathValues.insert(q_itr->first, + q_itr->second->getValue().getQString()); + } + + argc = 1; } // Enables high-DPI scaling. This attribute must be set before QApplication is @@ -409,7 +465,7 @@ int main(int argc, char *argv[]) { &toonzRunOutOfContMemHandler); // Toonz environment - initToonzEnv(); + initToonzEnv(argumentPathValues); // Initialize thread components TThread::init(); @@ -521,6 +577,10 @@ int main(int argc, char *argv[]) { // Apply translation to file writers properties Tiio::updateFileWritersPropertiesTranslation(); + // Force to have left-to-right layout direction in any language environment. + // This function has to be called after installTranslator(). + a.setLayoutDirection(Qt::LeftToRight); + splash.showMessage(offsetStr + "Loading styles ...", Qt::AlignCenter, Qt::white); a.processEvents(); @@ -571,7 +631,6 @@ int main(int argc, char *argv[]) { QString currentStyle = Preferences::instance()->getCurrentStyleSheetPath(); a.setStyleSheet(currentStyle); - TApp::instance()->setMainWindow(&w); w.setWindowTitle(applicationFullName); if (TEnv::getIsPortable()) { splash.showMessage(offsetStr + "Starting OpenToonz Portable ...", diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 9388982..26e4b63 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -377,6 +377,9 @@ MainWindow::MainWindow(const QString &argumentLayoutFileName, QWidget *parent, , m_saveSettingsOnQuit(true) , m_oldRoomIndex(0) , m_layoutName("") { + // store a main window pointer in advance of making its contents + TApp::instance()->setMainWindow(this); + m_toolsActionGroup = new QActionGroup(this); m_toolsActionGroup->setExclusive(true); m_currentRoomsChoice = Preferences::instance()->getCurrentRoomChoice(); @@ -2416,9 +2419,9 @@ RecentFiles::~RecentFiles() {} void RecentFiles::addFilePath(QString path, FileType fileType) { QList files = - (fileType == Scene) ? m_recentScenes : (fileType == Level) - ? m_recentLevels - : m_recentFlipbookImages; + (fileType == Scene) + ? m_recentScenes + : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages; int i; for (i = 0; i < files.size(); i++) if (files.at(i) == path) files.removeAt(i); @@ -2543,9 +2546,9 @@ void RecentFiles::saveRecentFiles() { QList RecentFiles::getFilesNameList(FileType fileType) { QList files = - (fileType == Scene) ? m_recentScenes : (fileType == Level) - ? m_recentLevels - : m_recentFlipbookImages; + (fileType == Scene) + ? m_recentScenes + : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages; QList names; int i; for (i = 0; i < files.size(); i++) { @@ -2572,9 +2575,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) { menu->setEnabled(false); else { CommandId clearActionId = - (fileType == Scene) ? MI_ClearRecentScene : (fileType == Level) - ? MI_ClearRecentLevel - : MI_ClearRecentImage; + (fileType == Scene) + ? MI_ClearRecentScene + : (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage; menu->setActions(names); menu->addSeparator(); QAction *clearAction = CommandManager::instance()->getAction(clearActionId); diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index 0495f07..0cd90ed 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -83,6 +83,7 @@ #endif #include #include +#include #include "sceneviewer.h" @@ -92,6 +93,19 @@ void drawSpline(const TAffine &viewMatrix, const TRect &clipRect, bool camera3d, //------------------------------------------------------------------------------- namespace { +int l_mainDisplayListsSpaceId = + -1; //!< Display lists space id associated with SceneViewers +std::set + l_contexts; //!< Stores every SceneViewer context (see ~SceneViewer) + +//------------------------------------------------------------------------------- + +struct DummyProxy : public TGLDisplayListsProxy { + ~DummyProxy() {} + void makeCurrent() {} + void doneCurrent() {} +}; + //------------------------------------------------------------------------------- double getActualFrameRate() { @@ -532,6 +546,12 @@ void SceneViewer::setVisual(const ImagePainter::VisualSettings &settings) { SceneViewer::~SceneViewer() { if (m_fbo) delete m_fbo; + + // release all the registered context (once when exit the software) + std::set::iterator ct, cEnd(l_contexts.end()); + for (ct = l_contexts.begin(); ct != cEnd; ++ct) + TGLDisplayListsManager::instance()->releaseContext(*ct); + l_contexts.clear(); } //------------------------------------------------------------------------------- @@ -724,7 +744,7 @@ void SceneViewer::showEvent(QShowEvent *) { SLOT(update())); connect(app->getCurrentOnionSkin(), SIGNAL(onionSkinMaskChanged()), this, - SLOT(update())); + SLOT(onOnionSkinMaskChanged())); connect(app->getCurrentLevel(), SIGNAL(xshLevelChanged()), this, SLOT(update())); @@ -825,6 +845,8 @@ double SceneViewer::getHGuide(int index) { return m_hRuler->getGuide(index); } void SceneViewer::initializeGL() { initializeOpenGLFunctions(); + registerContext(); + // to be computed once through the software if (m_lutCalibrator) { m_lutCalibrator->initialize(); @@ -2580,3 +2602,45 @@ void SceneViewer::onContextAboutToBeDestroyed() { m_lutCalibrator->cleanup(); doneCurrent(); } + +//----------------------------------------------------------------------------- +// called from SceneViewer::initializeGL() + +void SceneViewer::registerContext() { + // release the old context, if any + // this will be happen when dock / float the viewer panel. + bool hasOldContext; +#ifdef _WIN32 + hasOldContext = + (m_currentContext.first != nullptr && m_currentContext.second != nullptr); +#else + hasOldContext = m_currentContext != nullptr; +#endif + if (hasOldContext) { + int ret = l_contexts.erase(m_currentContext); + if (ret) + TGLDisplayListsManager::instance()->releaseContext(m_currentContext); + } + + // then, register context and the space Id correspondent to it. + int displayListId; + if (TApp::instance()->getMainWindow() && + TApp::instance()->getMainWindow()->isAncestorOf(this) && + QThread::currentThread() == qGuiApp->thread()) { + // obtain displaySpaceId for main thread + if (l_mainDisplayListsSpaceId == -1) + l_mainDisplayListsSpaceId = + TGLDisplayListsManager::instance()->storeProxy(new DummyProxy); + + displayListId = l_mainDisplayListsSpaceId; + } + // for the other cases (such as for floating viewer), it can't share the + // context so + // obtain different id + else + displayListId = + TGLDisplayListsManager::instance()->storeProxy(new DummyProxy); + TGlContext tglContext(tglGetCurrentContext()); + TGLDisplayListsManager::instance()->attachContext(displayListId, tglContext); + l_contexts.insert(tglContext); +} diff --git a/toonz/sources/toonz/sceneviewer.h b/toonz/sources/toonz/sceneviewer.h index 97a3066..05c6a47 100644 --- a/toonz/sources/toonz/sceneviewer.h +++ b/toonz/sources/toonz/sceneviewer.h @@ -168,9 +168,12 @@ class SceneViewer final : public GLWidgetForHighDpi, QMatrix4x4 m_projectionMatrix; + // Used for texture management. + // Changing dock / float state of the panel will alter the context. + // So discarding the resources in old context in initializeGL. + TGlContext m_currentContext; + public: - // iwsw commented out temporarily - // Ghibli3DLutUtil* get3DLutUtil(){ return m_ghibli3DLutUtil; } enum ReferenceMode { NORMAL_REFERENCE = 1, CAMERA3D_REFERENCE = 2, @@ -381,6 +384,8 @@ protected: void setFocus() override { QWidget::setFocus(); }; + void registerContext(); + public slots: void resetSceneViewer(); @@ -398,6 +403,7 @@ public slots: // for Ink&Paint work properly void onLevelSwitched(); void onFrameSwitched(); + void onOnionSkinMaskChanged() { GLInvalidateAll(); } void setReferenceMode(int referenceMode); void enablePreview(int previewMode); diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index 13416e9..6894f3b 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -1853,7 +1853,10 @@ void ColumnArea::mousePressEvent(QMouseEvent *event) { // config button else if (o->rect(PredefinedRect::CONFIG_AREA).contains(mouseInCell) && event->button() == Qt::LeftButton) { - if (column->getSoundColumn() || column->getPaletteColumn() || + TXshZeraryFxColumn *zColumn = + dynamic_cast(column); + + if (zColumn || column->getSoundColumn() || column->getPaletteColumn() || column->getSoundTextColumn()) { // do nothing } else diff --git a/toonz/sources/toonzlib/strokegenerator.cpp b/toonz/sources/toonzlib/strokegenerator.cpp index ff5dd79..9a5c9c7 100644 --- a/toonz/sources/toonzlib/strokegenerator.cpp +++ b/toonz/sources/toonzlib/strokegenerator.cpp @@ -42,8 +42,8 @@ void StrokeGenerator::add(const TThickPoint &point, double pixelSize2) { double d = std::max(point.thick, lastPoint.thick) + 3; TRectD rect(TRectD(lastPoint, point).enlarge(d)); m_modifiedRegion += rect; - m_lastModifiedRegion = m_lastPointRect + rect; - m_lastPointRect = rect; + m_lastModifiedRegion += rect; + m_lastPointRect = rect; } else { m_points.back().thick = std::max(m_points.back().thick, point.thick); } @@ -116,7 +116,6 @@ void StrokeGenerator::drawFragments(int first, int last) { if (m_points.empty()) return; int i = first; if (last >= (int)m_points.size()) last = m_points.size() - 1; - const double h = 0.01; TThickPoint a; TThickPoint b; TThickPoint c; @@ -131,7 +130,6 @@ void StrokeGenerator::drawFragments(int first, int last) { if (b.thick == 0) b.thick = 0.1; } // m_p0 = m_p1 = b; - assert(tdistance(b, a) > h); v = a.thick * normalize(rotate90(b - a)); m_p0 = a + v; m_p1 = a - v; @@ -162,35 +160,44 @@ void StrokeGenerator::drawFragments(int first, int last) { if (b.thick == 0) b.thick = 0.1; if (c.thick == 0) c.thick = 0.1; } - if (a.thick >= h && b.thick >= h && tdistance2(b, a) >= h && - tdistance2(a, c) >= h) { - if (i - 1 == 0) { - assert(tdistance(b, a) > h); - v = a.thick * normalize(rotate90(b - a)); - m_p0 = a + v; - m_p1 = a - v; - } - assert(tdistance(c, a) > h); - v = b.thick * normalize(rotate90(c - a)); - TPointD p0 = b + v; - TPointD p1 = b - v; - glBegin(GL_POLYGON); - tglVertex(m_p0); - tglVertex(m_p1); - tglVertex(p1); - tglVertex(p0); - glEnd(); - m_p0 = p0; - m_p1 = p1; - } else { - m_p0 = m_p1 = b; + if (i - 1 == 0) { + v = a.thick * normalize(rotate90(b - a)); + m_p0 = a + v; + m_p1 = a - v; } + v = b.thick * normalize(rotate90(c - a)); + TPointD p0 = b + v; + TPointD p1 = b - v; + glBegin(GL_POLYGON); + tglVertex(m_p0); + tglVertex(m_p1); + tglVertex(p1); + tglVertex(p0); + glEnd(); + m_p0 = p0; + m_p1 = p1; + glBegin(GL_LINE_STRIP); tglVertex(a); tglVertex(b); glEnd(); i++; } + if (last < 2) return; + v = m_points[last].thick * + normalize(rotate90(m_points[last] - m_points[last - 1])); + TPointD p0 = m_points[last] + v; + TPointD p1 = m_points[last] - v; + glBegin(GL_POLYGON); + tglVertex(m_p0); + tglVertex(m_p1); + tglVertex(p1); + tglVertex(p0); + glEnd(); + glBegin(GL_LINE_STRIP); + tglVertex(m_points[last - 1]); + tglVertex(m_points[last]); + glEnd(); } //------------------------------------------------------------------- @@ -255,7 +262,11 @@ void StrokeGenerator::removeMiddlePoints() { //------------------------------------------------------------------- -TRectD StrokeGenerator::getLastModifiedRegion() { return m_lastModifiedRegion; } +TRectD StrokeGenerator::getLastModifiedRegion() { + TRectD ret = m_lastModifiedRegion; + m_lastModifiedRegion = m_lastPointRect; + return ret; +} //------------------------------------------------------------------- diff --git a/toonz/sources/toonzlib/toonzfolders.cpp b/toonz/sources/toonzlib/toonzfolders.cpp index f699f87..a9bc0cf 100644 --- a/toonz/sources/toonzlib/toonzfolders.cpp +++ b/toonz/sources/toonzlib/toonzfolders.cpp @@ -50,7 +50,9 @@ TFilePathSet ToonzFolder::getProjectsFolders() { fps.push_back(TFilePath(tempPath)); } } - if (tempFps.size() == 0) fps.push_back(TEnv::getStuffDir() + "Projects"); + if (tempFps.size() == 0) + fps.push_back(TEnv::getStuffDir() + + TEnv::getSystemPathMap().at("PROJECTS")); } if (documents) { fps.push_back(getMyDocumentsPath() + "OpenToonz"); @@ -85,31 +87,36 @@ TFilePath ToonzFolder::getFirstProjectsFolder() { TFilePath ToonzFolder::getLibraryFolder() { TFilePath fp = getSystemVarPathValue(getSystemVarPrefix() + "LIBRARY"); - if (fp == TFilePath()) fp = getStuffDir() + "library"; + if (fp == TFilePath()) + fp = getStuffDir() + TEnv::getSystemPathMap().at("LIBRARY"); return fp; } TFilePath ToonzFolder::getStudioPaletteFolder() { TFilePath fp = getSystemVarPathValue(getSystemVarPrefix() + "STUDIOPALETTE"); - if (fp == TFilePath()) fp = getStuffDir() + "studiopalette"; + if (fp == TFilePath()) + fp = getStuffDir() + TEnv::getSystemPathMap().at("STUDIOPALETTE"); return fp; } TFilePath ToonzFolder::getFxPresetFolder() { TFilePath fp = getSystemVarPathValue(getSystemVarPrefix() + "FXPRESETS"); - if (fp == TFilePath()) fp = getStuffDir() + "fxs"; + if (fp == TFilePath()) + fp = getStuffDir() + TEnv::getSystemPathMap().at("FXPRESETS"); return fp; } TFilePath ToonzFolder::getCacheRootFolder() { TFilePath fp = getSystemVarPathValue(getSystemVarPrefix() + "CACHEROOT"); - if (fp == TFilePath()) fp = getStuffDir() + "cache"; + if (fp == TFilePath()) + fp = getStuffDir() + TEnv::getSystemPathMap().at("CACHEROOT"); return fp; } TFilePath ToonzFolder::getProfileFolder() { TFilePath fp = getSystemVarPathValue(getSystemVarPrefix() + "PROFILES"); - if (fp == TFilePath()) fp = getStuffDir() + "profiles"; + if (fp == TFilePath()) + fp = getStuffDir() + TEnv::getSystemPathMap().at("PROFILES"); return fp; } diff --git a/toonz/sources/toonzqt/CMakeLists.txt b/toonz/sources/toonzqt/CMakeLists.txt index 513b5f1..5027e86 100644 --- a/toonz/sources/toonzqt/CMakeLists.txt +++ b/toonz/sources/toonzqt/CMakeLists.txt @@ -28,6 +28,7 @@ set(MOC_HEADERS ../include/toonzqt/fxschematicscene.h ../include/toonzqt/fxselection.h ../include/toonzqt/fxsettings.h + ../include/toonzqt/fxtypes.h ../include/toonzqt/gutil.h ../include/toonzqt/histogram.h ../include/toonzqt/icongenerator.h diff --git a/toonz/sources/toonzqt/Resources/iconifynodes_off.svg b/toonz/sources/toonzqt/Resources/iconifynodes_off.svg new file mode 100644 index 0000000..6237f82 --- /dev/null +++ b/toonz/sources/toonzqt/Resources/iconifynodes_off.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/toonz/sources/toonzqt/Resources/iconifynodes_on.svg b/toonz/sources/toonzqt/Resources/iconifynodes_on.svg new file mode 100644 index 0000000..96801af --- /dev/null +++ b/toonz/sources/toonzqt/Resources/iconifynodes_on.svg @@ -0,0 +1,85 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/toonz/sources/toonzqt/Resources/iconifynodes_over.svg b/toonz/sources/toonzqt/Resources/iconifynodes_over.svg new file mode 100644 index 0000000..2b19dd5 --- /dev/null +++ b/toonz/sources/toonzqt/Resources/iconifynodes_over.svg @@ -0,0 +1,86 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/toonz/sources/toonzqt/Resources/schematic_link.svg b/toonz/sources/toonzqt/Resources/schematic_link.svg index 3aac8f1..f6252e9 100644 --- a/toonz/sources/toonzqt/Resources/schematic_link.svg +++ b/toonz/sources/toonzqt/Resources/schematic_link.svg @@ -1,28 +1,65 @@ - + - - \ No newline at end of file diff --git a/toonz/sources/toonzqt/Resources/schematic_link_small.svg b/toonz/sources/toonzqt/Resources/schematic_link_small.svg new file mode 100644 index 0000000..4c75740 --- /dev/null +++ b/toonz/sources/toonzqt/Resources/schematic_link_small.svg @@ -0,0 +1,75 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/toonz/sources/toonzqt/fxschematicnode.cpp b/toonz/sources/toonzqt/fxschematicnode.cpp index 8b24ebd..b83d8e0 100644 --- a/toonz/sources/toonzqt/fxschematicnode.cpp +++ b/toonz/sources/toonzqt/fxschematicnode.cpp @@ -3,6 +3,7 @@ #include "toonzqt/fxschematicnode.h" // TnzQt includes +#include "toonzqt/fxtypes.h" #include "toonzqt/fxschematicscene.h" #include "toonzqt/icongenerator.h" #include "toonzqt/gutil.h" @@ -133,9 +134,7 @@ FxColumnPainter::FxColumnPainter(FxSchematicColumnNode *parent, double width, TLevelColumnFx *lcfx = dynamic_cast(parent->getFx()); if (lcfx) { - int index = lcfx->getColumnIndex(); - QString id = QString("Col"); - setToolTip(id + QString::number(index + 1)); + int index = lcfx->getColumnIndex(); FxSchematicScene *fxScene = dynamic_cast(scene()); if (!fxScene) return; @@ -156,7 +155,7 @@ FxColumnPainter::~FxColumnPainter() {} //----------------------------------------------------- QRectF FxColumnPainter::boundingRect() const { - if (m_parent->isOpened() && m_parent->isLargeScaled()) + if (m_parent->isOpened() && m_parent->isNormalIconView()) return QRectF(-5, -54, m_width + 10, m_height + 59); else return QRectF(-5, -5, m_width + 10, m_height + 10); @@ -167,19 +166,21 @@ QRectF FxColumnPainter::boundingRect() const { void FxColumnPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; int levelType; QString levelName; m_parent->getLevelTypeAndName(levelType, levelName); - QLinearGradient linearGrad = getGradientByLevelType(levelType); + QColor nodeColor; + SchematicViewer *viewer = sceneFx->getSchematicViewer(); + viewer->getNodeColor(levelType, nodeColor); - if (!m_parent->isLargeScaled()) linearGrad.setFinalStop(0, 50); - - painter->setBrush(QBrush(linearGrad)); + painter->setBrush(nodeColor); painter->setPen(Qt::NoPen); painter->drawRect(0, 0, m_width, m_height); - if (m_parent->isOpened() && m_parent->isLargeScaled()) { + if (m_parent->isOpened() && m_parent->isNormalIconView()) { // Draw the pixmap painter->setBrush(Qt::NoBrush); painter->setPen(QColor(0, 0, 0, 255)); @@ -193,12 +194,12 @@ void FxColumnPainter::paint(QPainter *painter, } } - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); painter->setBrush(Qt::NoBrush); QRectF columnNameRect; QRectF levelNameRect; - if (m_parent->isLargeScaled()) { + if (m_parent->isNormalIconView()) { columnNameRect = QRect(18, 2, 54, 14); levelNameRect = QRectF(18, 16, 54, 14); } else { @@ -212,12 +213,9 @@ void FxColumnPainter::paint(QPainter *painter, // column name if (!m_parent->isNameEditing()) { - FxSchematicScene *sceneFx = dynamic_cast(scene()); - if (!sceneFx) return; - // if this is a current object if (sceneFx->getCurrentFx() == m_parent->getFx()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); QString elidedName = elideText(m_name, painter->font(), columnNameRect.width()); painter->drawText(columnNameRect, Qt::AlignLeft | Qt::AlignVCenter, @@ -232,75 +230,6 @@ void FxColumnPainter::paint(QPainter *painter, } //----------------------------------------------------- - -QLinearGradient FxColumnPainter::getGradientByLevelType(int type) { - QColor col1, col2, col3, col4, col5; - int alpha = 200; - switch (type) { - case TZI_XSHLEVEL: - case OVL_XSHLEVEL: - col1 = QColor(209, 232, 234, alpha); - col2 = QColor(121, 171, 181, alpha); - col3 = QColor(98, 143, 165, alpha); - col4 = QColor(33, 90, 118, alpha); - col5 = QColor(122, 172, 173, alpha); - break; - case PLI_XSHLEVEL: - col1 = QColor(236, 226, 182, alpha); - col2 = QColor(199, 187, 95, alpha); - col3 = QColor(180, 180, 67, alpha); - col4 = QColor(130, 125, 15, alpha); - col5 = QColor(147, 150, 28, alpha); - break; - case TZP_XSHLEVEL: - col1 = QColor(196, 245, 196, alpha); - col2 = QColor(111, 192, 105, alpha); - col3 = QColor(63, 146, 99, alpha); - col4 = QColor(32, 113, 86, alpha); - col5 = QColor(117, 187, 166, alpha); - break; - case ZERARYFX_XSHLEVEL: - col1 = QColor(232, 245, 196, alpha); - col2 = QColor(130, 129, 93, alpha); - col3 = QColor(113, 115, 81, alpha); - col4 = QColor(55, 59, 25, alpha); - col5 = QColor(144, 154, 111, alpha); - break; - case CHILD_XSHLEVEL: - col1 = QColor(247, 208, 241, alpha); - col2 = QColor(214, 154, 219, alpha); - col3 = QColor(170, 123, 169, alpha); - col4 = QColor(92, 52, 98, alpha); - col5 = QColor(132, 111, 154, alpha); - break; - case MESH_XSHLEVEL: - col1 = QColor(210, 140, 255, alpha); - col2 = QColor(200, 130, 255, alpha); - col3 = QColor(150, 80, 180, alpha); - col4 = QColor(150, 80, 180, alpha); - col5 = QColor(180, 120, 220, alpha); - break; - case UNKNOWN_XSHLEVEL: - case NO_XSHLEVEL: - default: - col1 = QColor(227, 227, 227, alpha); - col2 = QColor(174, 174, 174, alpha); - col3 = QColor(123, 123, 123, alpha); - col4 = QColor(61, 61, 61, alpha); - col5 = QColor(127, 138, 137, alpha); - } - - QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, 32)); - linearGrad.setColorAt(0, col1); - linearGrad.setColorAt(0.08, col2); - linearGrad.setColorAt(0.20, col3); - linearGrad.setColorAt(0.23, col4); - linearGrad.setColorAt(0.9, col4); - linearGrad.setColorAt(1, col5); - return linearGrad; -} - -//----------------------------------------------------- void FxColumnPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { FxSchematicScene *fxScene = dynamic_cast(scene()); QMenu menu(fxScene->views()[0]); @@ -357,8 +286,7 @@ void FxColumnPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { QAction *collapse = CommandManager::instance()->getAction("MI_Collapse"); - QAction *openSubxsh = new QAction(tr("&Open Subxsheet"), &menu); - connect(openSubxsh, SIGNAL(triggered()), fxScene, SLOT(onOpenSubxsheet())); + QAction *openSubxsh = CommandManager::instance()->getAction("MI_OpenChild"); QAction *explodeChild = CommandManager::instance()->getAction("MI_ExplodeChild"); @@ -425,9 +353,7 @@ void FxColumnPainter::onIconGenerated() { TLevelColumnFx *lcfx = dynamic_cast(m_parent->getFx()); if (lcfx) { - int index = lcfx->getColumnIndex(); - QString id = QString("Col"); - setToolTip(id + QString::number(index + 1)); + int index = lcfx->getColumnIndex(); FxSchematicScene *fxScene = dynamic_cast(scene()); if (!fxScene) return; @@ -461,12 +387,6 @@ FxPalettePainter::FxPalettePainter(FxSchematicPaletteNode *parent, double width, setFlag(QGraphicsItem::ItemIsMovable, false); setFlag(QGraphicsItem::ItemIsSelectable, false); setFlag(QGraphicsItem::ItemIsFocusable, false); - TLevelColumnFx *lcfx = dynamic_cast(parent->getFx()); - if (lcfx) { - int index = lcfx->getColumnIndex() + 1; - QString id = QString("Col"); - setToolTip(id + QString::number(index)); - } } //----------------------------------------------------- @@ -484,22 +404,20 @@ QRectF FxPalettePainter::boundingRect() const { void FxPalettePainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; + QPixmap palettePm = QPixmap(":Resources/schematic_palette.png"); int alpha = 200; - QLinearGradient paletteLinearGrad( - QPointF(0, 0), QPointF(0, (m_parent->isLargeScaled()) ? 32 : 50)); - paletteLinearGrad.setColorAt(0, QColor(42, 171, 154, alpha)); - paletteLinearGrad.setColorAt(0.2, QColor(15, 62, 56, alpha)); - paletteLinearGrad.setColorAt(0.9, QColor(15, 62, 56, alpha)); - paletteLinearGrad.setColorAt(1, QColor(33, 95, 90, alpha)); + SchematicViewer *viewer = sceneFx->getSchematicViewer(); - painter->setBrush(QBrush(paletteLinearGrad)); + painter->setBrush(viewer->getPaletteColumnColor()); painter->setPen(Qt::NoPen); - if (m_parent->isLargeScaled()) + if (m_parent->isNormalIconView()) painter->drawRoundRect(QRectF(0, 0, m_width, m_height), 35, 99); else painter->drawRoundRect(QRectF(0, 0, m_width, m_height), 10, 30); @@ -508,7 +426,7 @@ void FxPalettePainter::paint(QPainter *painter, QRect paletteRect; QRectF idRect; QRectF palNameRect; - if (m_parent->isLargeScaled()) { + if (m_parent->isNormalIconView()) { paletteRect = QRect(-3, -1, 20, 16); idRect = QRectF(18, 2, 54, 14); palNameRect = QRectF(18, 16, 54, 14); @@ -525,17 +443,15 @@ void FxPalettePainter::paint(QPainter *painter, painter->drawPixmap(paletteRect, palettePm); //! draw the name only if it is not editing - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); if (!m_parent->isNameEditing()) { - FxSchematicScene *sceneFx = dynamic_cast(scene()); - if (!sceneFx) return; if (sceneFx->getCurrentFx() == m_parent->getFx()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); int w = idRect.width(); - if (m_parent->isLargeScaled()) { + if (m_parent->isNormalIconView()) { QString elidedName = elideText(m_name, painter->font(), w); painter->drawText(idRect, Qt::AlignLeft | Qt::AlignVCenter, elidedName); } else @@ -619,7 +535,6 @@ FxPainter::FxPainter(FxSchematicNode *parent, double width, double height, case eNormalImageAdjustFx: m_label = QString::fromStdWString( TStringTable::translate(parent->getFx()->getFxType())); - setToolTip(QString::fromStdWString(parent->getFx()->getFxId())); break; case eZeraryFx: { TZeraryColumnFx *zfx = dynamic_cast(parent->getFx()); @@ -628,17 +543,10 @@ FxPainter::FxPainter(FxSchematicNode *parent, double width, double height, if (zeraryFx) { m_label = QString::fromStdWString( TStringTable::translate(zeraryFx->getFxType())); - setToolTip(QString::fromStdWString(zeraryFx->getFxId())); } } break; } - - case eGroupedFx: - m_label = QString("Group ") + - QString::number(parent->getFx()->getAttributes()->getGroupId()); - setToolTip(m_label); - break; } } @@ -656,8 +564,11 @@ QRectF FxPainter::boundingRect() const { void FxPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; + // if the scale is small, display with fx icons - if (!m_parent->isLargeScaled()) { + if (!m_parent->isNormalIconView()) { paint_small(painter); return; } @@ -676,10 +587,11 @@ void FxPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->restore(); } - // draw base rect - QLinearGradient linearGrad = getGradientByLevelType(m_type); + QColor nodeColor; + SchematicViewer *viewer = sceneFx->getSchematicViewer(); + viewer->getNodeColor(m_type, nodeColor); - painter->setBrush(QBrush(linearGrad)); + painter->setBrush(nodeColor); painter->setPen(Qt::NoPen); painter->drawRect(0, 0, m_width, m_height); @@ -698,10 +610,13 @@ void FxPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, painter->setFont(columnFont); // draw fxId in the bottom part - painter->setPen(Qt::white); - if (m_type != eGroupedFx) { + painter->setPen(viewer->getTextColor()); + QString label; + if (m_type == eGroupedFx) + label = "Group " + + QString::number(m_parent->getFx()->getAttributes()->getGroupId()); + else { // for zerary fx - QString label; if (m_type == eZeraryFx) { TZeraryColumnFx *zcFx = dynamic_cast(m_parent->getFx()); @@ -709,7 +624,10 @@ void FxPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, label = QString::fromStdWString(zcFx->getZeraryFx()->getFxId()); } else label = QString::fromStdWString(m_parent->getFx()->getFxId()); - label = elideText(label, painter->font(), m_width - 21); + } + + if (label != m_name) { + label = elideText(label, painter->font(), m_width - 21); painter->drawText(QRectF(3, 16, m_width - 21, 14), Qt::AlignLeft | Qt::AlignVCenter, label); } @@ -720,91 +638,17 @@ void FxPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, FxSchematicScene *sceneFx = dynamic_cast(scene()); if (!sceneFx) return; if (sceneFx->getCurrentFx() == m_parent->getFx()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); QRectF rect(3, 2, m_width - 21, 14); - int w = rect.width(); + int w = rect.width(); + if (label == m_name) { + rect.adjust(0, 0, 0, 14); + w *= 2; + } QString elidedName = elideText(m_name, painter->font(), w); - painter->drawText(rect, elidedName); + painter->drawText(rect, Qt::TextWrapAnywhere, elidedName); } } -//----------------------------------------------------- -/*! return the gradient pattern according to the type of Fx -*/ -QLinearGradient FxPainter::getGradientByLevelType(eFxType type) { - QColor col1, col2, col3, col4, col5; - int alpha = 200; - switch (type) { - case eNormalFx: - col1 = QColor(129, 162, 188, alpha); - col2 = QColor(109, 138, 166, alpha); - col3 = QColor(94, 120, 150, alpha); - col4 = QColor(94, 120, 150, alpha); - col5 = QColor(52, 63, 104, alpha); - break; - case eZeraryFx: - col1 = QColor(232, 245, 196, alpha); - col2 = QColor(130, 129, 93, alpha); - col3 = QColor(113, 115, 81, alpha); - col4 = QColor(55, 59, 25, alpha); - col5 = QColor(144, 154, 111, alpha); - break; - case eMacroFx: - col1 = QColor(165, 117, 161, alpha); - col2 = QColor(146, 99, 139, alpha); - col3 = QColor(132, 86, 123, alpha); - col4 = QColor(132, 86, 123, alpha); - col5 = QColor(89, 46, 92, alpha); - break; - case eGroupedFx: - col1 = QColor(104, 191, 211, alpha); - col2 = QColor(91, 168, 192, alpha); - col3 = QColor(76, 148, 177, alpha); - col4 = QColor(76, 148, 177, alpha); - col5 = QColor(43, 91, 139, alpha); - break; - case eNormalImageAdjustFx: - col1 = QColor(97, 95, 143, alpha); - col2 = QColor(95, 92, 140, alpha); - col3 = QColor(88, 84, 131, alpha); - col4 = QColor(88, 84, 131, alpha); - col5 = QColor(69, 56, 100, alpha); - break; - case eNormalLayerBlendingFx: - col1 = QColor(75, 127, 133, alpha); - col2 = QColor(65, 112, 122, alpha); - col3 = QColor(60, 108, 118, alpha); - col4 = QColor(60, 108, 118, alpha); - col5 = QColor(38, 71, 91, alpha); - break; - case eNormalMatteFx: - col1 = QColor(195, 117, 116, alpha); - col2 = QColor(188, 111, 109, alpha); - col3 = QColor(181, 103, 103, alpha); - col4 = QColor(181, 103, 103, alpha); - col5 = QColor(161, 86, 84, alpha); - break; - default: - break; - } - - QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, 32)); - linearGrad.setColorAt(0, col1); - linearGrad.setColorAt(0.08, col2); - linearGrad.setColorAt(0.20, col3); - linearGrad.setColorAt(0.23, col4); - linearGrad.setColorAt(0.9, col4); - linearGrad.setColorAt(1, col5); - - if (type == eGroupedFx) { - linearGrad.setColorAt(0.6, col4); - linearGrad.setColorAt(0.699, col5); - linearGrad.setColorAt(0.7, col4); - linearGrad.setColorAt(0.799, col5); - linearGrad.setColorAt(0.8, col4); - linearGrad.setColorAt(0.899, col5); - } - return linearGrad; -} //----------------------------------------------------- @@ -971,6 +815,9 @@ void FxPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { /*! for small-scaled display */ void FxPainter::paint_small(QPainter *painter) { + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; + if (m_type == eGroupedFx) { painter->save(); QPen pen; @@ -985,11 +832,11 @@ void FxPainter::paint_small(QPainter *painter) { painter->restore(); } - QLinearGradient linearGrad = getGradientByLevelType(m_type); - - linearGrad.setFinalStop(QPointF(0, 50)); + QColor nodeColor; + SchematicViewer *viewer = sceneFx->getSchematicViewer(); + viewer->getNodeColor(m_type, nodeColor); - painter->setBrush(QBrush(linearGrad)); + painter->setBrush(nodeColor); painter->setPen(Qt::NoPen); painter->drawRect(0, 0, m_width, m_height); @@ -997,11 +844,11 @@ void FxPainter::paint_small(QPainter *painter) { QFont fnt = painter->font(); fnt.setPixelSize(fnt.pixelSize() * 2); painter->setFont(fnt); - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); FxSchematicScene *sceneFx = dynamic_cast(scene()); if (!sceneFx) return; if (sceneFx->getCurrentFx() == m_parent->getFx()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); } if (m_type == eGroupedFx) { @@ -1075,22 +922,20 @@ QRectF FxXSheetPainter::boundingRect() const { void FxXSheetPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - int alpha = 200; - QLinearGradient xsheetLinearGrad( - QPointF(0, 0), QPointF(0, (m_parent->isLargeScaled()) ? 18 : 36)); - xsheetLinearGrad.setColorAt(0, QColor(152, 146, 188, alpha)); - xsheetLinearGrad.setColorAt(0.14, QColor(107, 106, 148, alpha)); - xsheetLinearGrad.setColorAt(0.35, QColor(96, 96, 138, alpha)); - xsheetLinearGrad.setColorAt(0.4, QColor(63, 67, 99, alpha)); - xsheetLinearGrad.setColorAt(0.8, QColor(63, 67, 99, alpha)); - xsheetLinearGrad.setColorAt(1, QColor(101, 105, 143, alpha)); - - painter->setBrush(QBrush(xsheetLinearGrad)); + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; + + SchematicViewer *viewer = sceneFx->getSchematicViewer(); + + painter->setBrush(viewer->getXsheetColor()); painter->setPen(Qt::NoPen); painter->drawRect(QRectF(0, 0, m_width, m_height)); - painter->setPen(Qt::white); - if (m_parent->isLargeScaled()) { + if (sceneFx->getCurrentFx() == m_parent->getFx()) + painter->setPen(viewer->getSelectedNodeTextColor()); + else + painter->setPen(viewer->getTextColor()); + if (m_parent->isNormalIconView()) { // Draw the name QRectF rect(18, 0, 54, 18); painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, @@ -1179,31 +1024,22 @@ QRectF FxOutputPainter::boundingRect() const { void FxOutputPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - int alpha = 200; - QLinearGradient outputLinearGrad( - QPointF(0, 0), QPointF(0, (m_parent->isLargeScaled()) ? 18 : 36)); - if (m_isActive) { - outputLinearGrad.setColorAt(0, QColor(115, 190, 224, alpha)); - outputLinearGrad.setColorAt(0.14, QColor(51, 132, 208, alpha)); - outputLinearGrad.setColorAt(0.35, QColor(39, 118, 196, alpha)); - outputLinearGrad.setColorAt(0.4, QColor(18, 82, 153, alpha)); - outputLinearGrad.setColorAt(0.8, QColor(18, 82, 153, alpha)); - outputLinearGrad.setColorAt(1, QColor(68, 119, 169, alpha)); - } else { - outputLinearGrad.setColorAt(0, QColor(183, 197, 196, alpha)); - outputLinearGrad.setColorAt(0.14, QColor(138, 157, 160, alpha)); - outputLinearGrad.setColorAt(0.35, QColor(125, 144, 146, alpha)); - outputLinearGrad.setColorAt(0.4, QColor(80, 94, 97, alpha)); - outputLinearGrad.setColorAt(0.8, QColor(80, 94, 97, alpha)); - outputLinearGrad.setColorAt(1, QColor(128, 140, 142, alpha)); - } + FxSchematicScene *sceneFx = dynamic_cast(scene()); + if (!sceneFx) return; + + SchematicViewer *viewer = sceneFx->getSchematicViewer(); + QColor outputColor = m_isActive ? viewer->getActiveOutputColor() + : viewer->getOtherOutputColor(); - painter->setBrush(QBrush(outputLinearGrad)); + painter->setBrush(outputColor); painter->setPen(Qt::NoPen); painter->drawRect(QRectF(0, 0, m_width, m_height)); - painter->setPen(Qt::white); - if (m_parent->isLargeScaled()) { + if (sceneFx->getCurrentFx() == m_parent->getFx()) + painter->setPen(viewer->getSelectedNodeTextColor()); + else + painter->setPen(viewer->getTextColor()); + if (m_parent->isNormalIconView()) { // Draw the name QRectF rect(18, 0, 72, 18); painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, @@ -1315,7 +1151,7 @@ FxSchematicPort::~FxSchematicPort() {} QRectF FxSchematicPort::boundingRect() const { // large scaled - if (getDock()->getNode()->isLargeScaled()) { + if (getDock()->getNode()->isNormalIconView()) { switch (getType()) { case eFxInputPort: case eFxGroupedInPort: @@ -1390,7 +1226,7 @@ void FxSchematicPort::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { // large scaled - if (getDock()->getNode()->isLargeScaled()) { + if (getDock()->getNode()->isNormalIconView()) { switch (getType()) { case eFxInputPort: case eFxGroupedInPort: { @@ -1455,7 +1291,15 @@ void FxSchematicPort::paint(QPainter *painter, } break; case eFxLinkPort: // LinkPort - default: { painter->setBrush(QColor(192, 192, 192, 255)); } break; + { + QRect sourceRect = + scene()->views()[0]->matrix().mapRect(boundingRect()).toRect(); + QPixmap linkPm = QIcon(":Resources/schematic_link_small.svg") + .pixmap(sourceRect.size()); + sourceRect = QRect(0, 0, sourceRect.width() * getDevPixRatio(), + sourceRect.height() * getDevPixRatio()); + painter->drawPixmap(boundingRect(), linkPm, sourceRect); + } break; } painter->drawRect(boundingRect()); } @@ -1974,7 +1818,7 @@ void FxSchematicDock::paint(QPainter *painter, if (m_port->getType() == eFxInputPort || m_port->getType() == eFxGroupedInPort) { // do nothing when small scaled - if (!getNode()->isLargeScaled()) return; + if (!getNode()->isNormalIconView()) return; painter->setPen(Qt::NoPen); painter->setBrush(QColor(0, 0, 0, 192)); @@ -2009,7 +1853,7 @@ FxSchematicNode::FxSchematicNode(FxSchematicScene *scene, TFx *fx, qreal width, , m_fx(fx) , m_type(type) , m_isCurrentFxLinked(false) - , m_isLargeScaled(scene->isLargeScaled()) { + , m_isNormalIconView(scene->isNormalIconView()) { if (m_type == eGroupedFx) m_actualFx = 0; else { @@ -2284,7 +2128,7 @@ void FxSchematicNode::updatePortsPosition() { }; // locals locals::PositionAssigner positioner; - if (m_isLargeScaled) { + if (m_isNormalIconView) { positioner.m_lastYPos = m_height; positioner.isLarge = true; } else { @@ -2330,7 +2174,7 @@ FxSchematicOutputNode::FxSchematicOutputNode(FxSchematicScene *scene, TOutputFx *fx) : FxSchematicNode(scene, fx, 67, 18, eOutpuFx) { // resize if small scaled - if (!m_isLargeScaled) { + if (!m_isNormalIconView) { setWidth(60); setHeight(36); } @@ -2339,7 +2183,7 @@ FxSchematicOutputNode::FxSchematicOutputNode(FxSchematicScene *scene, m_outDock = 0; m_linkDock = 0; FxSchematicDock *inDock = new FxSchematicDock(this, "", 0, eFxInputPort); - if (m_isLargeScaled) + if (m_isNormalIconView) inDock->setPos(0, 2); else inDock->setPos(0, 0); @@ -2348,6 +2192,8 @@ FxSchematicOutputNode::FxSchematicOutputNode(FxSchematicScene *scene, addPort(0, inDock->getPort()); m_outputPainter = new FxOutputPainter(this, m_width, m_height); m_outputPainter->setZValue(1); + + setToolTip(tr("Output")); } //----------------------------------------------------- @@ -2386,7 +2232,7 @@ void FxSchematicOutputNode::mouseDoubleClickEvent( FxSchematicXSheetNode::FxSchematicXSheetNode(FxSchematicScene *scene, TXsheetFx *fx) : FxSchematicNode(scene, fx, 90, 18, eXSheetFx) { - if (!m_isLargeScaled) { + if (!m_isNormalIconView) { setWidth(70); setHeight(36); } @@ -2403,7 +2249,7 @@ FxSchematicXSheetNode::FxSchematicXSheetNode(FxSchematicScene *scene, m_inDocks.push_back(inDock); - if (m_isLargeScaled) { + if (m_isNormalIconView) { m_outDock->setPos(72, 0); inDock->setPos(0, 2); } else { @@ -2414,6 +2260,8 @@ FxSchematicXSheetNode::FxSchematicXSheetNode(FxSchematicScene *scene, m_outDock->setZValue(2); inDock->setZValue(2); m_xsheetPainter->setZValue(1); + + setToolTip(tr("XSheet")); } //----------------------------------------------------- @@ -2495,10 +2343,12 @@ bool isMatteFx(std::string id) { FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, TFx *fx) : FxSchematicNode(scene, fx, 90, 32, eNormalFx) { + SchematicViewer *viewer = scene->getSchematicViewer(); + checkDynamicInputPortSize(); // resize if small scaled - if (!m_isLargeScaled) { + if (!m_isNormalIconView) { setWidth(70); setHeight(50); } @@ -2525,12 +2375,48 @@ FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, else if (isMatteFx(id)) m_type = eNormalMatteFx; + switch (m_type) { + case eNormalFx: + case eMacroFx: + case eNormalLayerBlendingFx: + case eNormalMatteFx: + case eNormalImageAdjustFx: { + QString fxId = QString::fromStdWString(getFx()->getFxId()); + if (m_name != fxId) + setToolTip(QString("%1 : %2").arg(m_name, fxId)); + else + setToolTip(m_name); + } break; + case eZeraryFx: { + TZeraryColumnFx *zfx = dynamic_cast(getFx()); + if (zfx) { + TFx *zeraryFx = zfx->getZeraryFx(); + if (zeraryFx) { + setToolTip(QString("%1 : %2").arg( + m_name, QString::fromStdWString(zeraryFx->getFxId()))); + } + } + break; + } + case eGroupedFx: { + QString fxId = + "Group " + QString::number(getFx()->getAttributes()->getGroupId()); + if (m_name != fxId) + setToolTip(QString("%1 (%2)").arg(m_name, fxId)); + else + setToolTip(m_name); + } + } + m_nameItem = new SchematicName(this, 72, 20); // for rename m_outDock = new FxSchematicDock(this, "", 0, eFxOutputPort); m_linkDock = new FxSchematicDock(this, "", 0, eFxLinkPort); m_renderToggle = new SchematicToggle( - this, QPixmap(":Resources/schematic_prev_eye.png"), 0); + this, viewer->getSchematicPreviewButtonOnImage(), + viewer->getSchematicPreviewButtonBgOnColor(), + viewer->getSchematicPreviewButtonOffImage(), + viewer->getSchematicPreviewButtonBgOffColor(), 0, m_isNormalIconView); m_painter = new FxPainter(this, m_width, m_height, m_name, m_type, fx->getFxType()); @@ -2543,7 +2429,7 @@ FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, addPort(0, m_outDock->getPort()); addPort(-1, m_linkDock->getPort()); - if (m_isLargeScaled) { + if (m_isNormalIconView) { m_nameItem->setPos(1, -1); m_outDock->setPos(72, 14); m_linkDock->setPos(72, 7); @@ -2556,7 +2442,7 @@ FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, m_nameItem->setPos(-1, 0); m_outDock->setPos(60, 0); m_linkDock->setPos(60, -5); - m_renderToggle->setPos(35, -5); + m_renderToggle->setPos(30, -5); } m_nameItem->setZValue(3); @@ -2571,7 +2457,7 @@ FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, m_nameItem->hide(); int i, inputPorts = fx->getInputPortCount(); - double lastPosY = (m_isLargeScaled) ? m_height : 0; + double lastPosY = (m_isNormalIconView) ? m_height : 0; for (i = 0; i < inputPorts; i++) { std::string portName = fx->getInputPortName(i); QString qPortName = QString::fromStdString(portName); @@ -2607,7 +2493,7 @@ FxSchematicNormalFxNode::FxSchematicNormalFxNode(FxSchematicScene *scene, FxSchematicDock *inDock; - if (m_isLargeScaled) { + if (m_isNormalIconView) { inDock = new FxSchematicDock(this, qPortName, m_width - 18, eFxInputPort); inDock->setPos(0, lastPosY); lastPosY += inDock->boundingRect().height(); @@ -2648,7 +2534,40 @@ void FxSchematicNormalFxNode::onNameChanged() { m_nameItem->hide(); m_name = m_nameItem->toPlainText(); m_painter->setName(m_name); - setToolTip(m_name); + + switch (m_type) { + case eNormalFx: + case eMacroFx: + case eNormalLayerBlendingFx: + case eNormalMatteFx: + case eNormalImageAdjustFx: { + QString fxId = QString::fromStdWString(getFx()->getFxId()); + if (m_name != fxId) + setToolTip(QString("%1 : %2").arg(m_name, fxId)); + else + setToolTip(m_name); + } break; + case eZeraryFx: { + TZeraryColumnFx *zfx = dynamic_cast(getFx()); + if (zfx) { + TFx *zeraryFx = zfx->getZeraryFx(); + if (zeraryFx) { + setToolTip(QString("%1 : %2").arg( + m_name, QString::fromStdWString(zeraryFx->getFxId()))); + } + } + break; + } + case eGroupedFx: { + QString fxId = + "Group " + QString::number(getFx()->getAttributes()->getGroupId()); + if (m_name != fxId) + setToolTip(QString("%1 (%2)").arg(m_name, fxId)); + else + setToolTip(m_name); + } + } + setFlag(QGraphicsItem::ItemIsSelectable, true); FxSchematicScene *fxScene = dynamic_cast(scene()); if (!fxScene) return; @@ -2707,26 +2626,54 @@ void FxSchematicNormalFxNode::resize(bool maximized) {} FxSchematicZeraryNode::FxSchematicZeraryNode(FxSchematicScene *scene, TZeraryColumnFx *fx) : FxSchematicNode(scene, fx, 90, 32, eZeraryFx) { + SchematicViewer *viewer = scene->getSchematicViewer(); + checkDynamicInputPortSize(); - if (!m_isLargeScaled) { + if (!m_isNormalIconView) { setWidth(90); setHeight(50); } m_columnIndex = fx->getColumnIndex(); + TXshColumn *column = scene->getXsheet()->getColumn(m_columnIndex); + TFx *zeraryFx = fx->getZeraryFx(); TStageObjectId id = TStageObjectId::ColumnId(m_columnIndex); std::string name = scene->getXsheet()->getStageObject(id)->getName(); - m_name = QString::fromStdString(name); + + if (column) { + // ZeraryFx columns store name elsewhere + TXshZeraryFxColumn *zColumn = dynamic_cast(column); + if (zColumn) + name = + ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName()); + } + + m_name = QString::fromStdString(name); + + setToolTip(QString("%1 : %2").arg( + m_name, QString::fromStdWString(zeraryFx->getFxId()))); m_nameItem = new SchematicName(this, 72, 20); // for rename m_outDock = new FxSchematicDock(this, "", 0, eFxOutputPort); m_linkDock = new FxSchematicDock(this, "", 0, eFxLinkPort); m_renderToggle = - new SchematicToggle(this, QPixmap(":Resources/schematic_prev_eye.png"), - SchematicToggle::eIsParentColumn, m_isLargeScaled); + new SchematicToggle(this, viewer->getSchematicPreviewButtonOnImage(), + viewer->getSchematicPreviewButtonBgOnColor(), + viewer->getSchematicPreviewButtonOffImage(), + viewer->getSchematicPreviewButtonBgOffColor(), + SchematicToggle::eIsParentColumn, m_isNormalIconView); + + m_cameraStandToggle = new SchematicToggle( + this, viewer->getSchematicCamstandButtonOnImage(), + viewer->getSchematicCamstandButtonTranspImage(), + viewer->getSchematicCamstandButtonBgOnColor(), + viewer->getSchematicCamstandButtonOffImage(), + viewer->getSchematicCamstandButtonBgOffColor(), + SchematicToggle::eIsParentColumn | SchematicToggle::eEnableNullState, + m_isNormalIconView); // get the fx icons according to the fx type m_painter = new FxPainter(this, m_width, m_height, m_name, m_type, @@ -2741,15 +2688,20 @@ FxSchematicZeraryNode::FxSchematicZeraryNode(FxSchematicScene *scene, addPort(0, m_outDock->getPort()); addPort(-1, m_linkDock->getPort()); - TXshColumn *column = scene->getXsheet()->getColumn(m_columnIndex); - if (column) m_renderToggle->setIsActive(column->isPreviewVisible()); + if (column) { + m_renderToggle->setIsActive(column->isPreviewVisible()); + m_cameraStandToggle->setState( + column->isCamstandVisible() ? (column->getOpacity() < 255 ? 2 : 1) : 0); + } // define positions - if (m_isLargeScaled) { + if (m_isNormalIconView) { m_nameItem->setPos(1, -1); m_outDock->setPos(72, 14); m_linkDock->setPos(72, m_height); m_renderToggle->setPos(72, 0); + m_cameraStandToggle->setPos(72, 7); + } else { QFont fnt = m_nameItem->font(); fnt.setPixelSize(fnt.pixelSize() * 2); @@ -2758,25 +2710,29 @@ FxSchematicZeraryNode::FxSchematicZeraryNode(FxSchematicScene *scene, m_nameItem->setPos(-1, 0); m_outDock->setPos(80, 0); m_linkDock->setPos(80, -5); - m_renderToggle->setPos(55, -5); + m_renderToggle->setPos(50, -5); + m_cameraStandToggle->setPos(20, -5); } m_nameItem->setZValue(3); m_outDock->setZValue(2); m_renderToggle->setZValue(2); + m_cameraStandToggle->setZValue(2); m_painter->setZValue(1); connect(m_nameItem, SIGNAL(focusOut()), this, SLOT(onNameChanged())); connect(m_renderToggle, SIGNAL(toggled(bool)), this, SLOT(onRenderToggleClicked(bool))); + connect(m_cameraStandToggle, SIGNAL(stateChanged(int)), this, + SLOT(onCameraStandToggleClicked(int))); if (zeraryFx) { int i, inputPorts = zeraryFx->getInputPortCount(); - double lastPosY = (m_isLargeScaled) ? m_height : 0; + double lastPosY = (m_isNormalIconView) ? m_height : 0; for (i = 0; i < inputPorts; i++) { FxSchematicDock *inDock; - if (m_isLargeScaled) { + if (m_isNormalIconView) { inDock = new FxSchematicDock( this, QString::fromStdString(zeraryFx->getInputPortName(i)), m_width - 18, eFxInputPort); @@ -2832,6 +2788,20 @@ void FxSchematicZeraryNode::onRenderToggleClicked(bool toggled) { //----------------------------------------------------- +void FxSchematicZeraryNode::onCameraStandToggleClicked(int state) { + FxSchematicScene *fxScene = dynamic_cast(scene()); + if (!fxScene) return; + TXshColumn *column = fxScene->getXsheet()->getColumn(m_columnIndex); + if (column) { + column->setCamstandVisible(!column->isCamstandVisible()); + // column->setCamstandVisible(toggled); + emit sceneChanged(); + emit xsheetChanged(); + } +} + +//----------------------------------------------------- + bool FxSchematicZeraryNode::isCached() const { TZeraryColumnFx *zfx = dynamic_cast(m_fx.getPointer()); if (!zfx) @@ -2848,12 +2818,35 @@ bool FxSchematicZeraryNode::isCached() const { void FxSchematicZeraryNode::mouseDoubleClickEvent( QGraphicsSceneMouseEvent *me) { - QAction *fxEditorPopup = - CommandManager::instance()->getAction("MI_FxParamEditor"); - fxEditorPopup->trigger(); + QRectF nameArea(0, 0, m_width, 14); + if (nameArea.contains(me->pos()) && me->modifiers() == Qt::ControlModifier) { + FxSchematicScene *fxScene = dynamic_cast(scene()); + TXshColumn *column = fxScene->getXsheet()->getColumn(m_columnIndex); + TStageObjectId id = TStageObjectId::ColumnId(m_columnIndex); + std::string name = fxScene->getXsheet()->getStageObject(id)->getName(); + + if (column) { + // ZeraryFx columns store name elsewhere + TXshZeraryFxColumn *zColumn = dynamic_cast(column); + if (zColumn) + name = + ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName()); + } + + m_name = QString::fromStdString(name); - // this signal cause the update the contents of the FxSettings - emit fxNodeDoubleClicked(); + m_nameItem->setPlainText(m_name); + m_nameItem->show(); + m_nameItem->setFocus(); + setFlag(QGraphicsItem::ItemIsSelectable, false); + } else { + QAction *fxEditorPopup = + CommandManager::instance()->getAction("MI_FxParamEditor"); + fxEditorPopup->trigger(); + + // this signal cause the update the contents of the FxSettings + emit fxNodeDoubleClicked(); + } } //----------------------------------------------------- @@ -2862,10 +2855,19 @@ void FxSchematicZeraryNode::onNameChanged() { m_nameItem->hide(); m_name = m_nameItem->toPlainText(); m_painter->setName(m_name); - setToolTip(m_name); + setFlag(QGraphicsItem::ItemIsSelectable, true); FxSchematicScene *fxScene = dynamic_cast(scene()); if (!fxScene) return; + + TXshZeraryFxColumn *zColumn = dynamic_cast( + fxScene->getXsheet()->getColumn(m_columnIndex)); + if (zColumn) { + TFx *fx = zColumn->getZeraryColumnFx()->getZeraryFx(); + setToolTip( + QString("%1 : %2").arg(m_name, QString::fromStdWString(fx->getFxId()))); + } + TFxCommand::renameFx(m_fx.getPointer(), m_name.toStdWString(), fxScene->getXsheetHandle()); updateOutputDockToolTips(m_name); @@ -2888,7 +2890,9 @@ FxSchematicColumnNode::FxSchematicColumnNode(FxSchematicScene *scene, : FxSchematicNode(scene, fx, 90, 32, eColumnFx) , m_isOpened(false) // iwasawa { - if (!m_isLargeScaled) { + SchematicViewer *viewer = scene->getSchematicViewer(); + + if (!m_isNormalIconView) { setWidth(90); setHeight(50); } @@ -2902,13 +2906,19 @@ FxSchematicColumnNode::FxSchematicColumnNode(FxSchematicScene *scene, m_nameItem = new SchematicName(this, 54, 20); //リネーム部分 m_outDock = new FxSchematicDock(this, "", 0, eFxOutputPort); // Outポート m_renderToggle = - new SchematicToggle(this, QPixmap(":Resources/schematic_prev_eye.png"), - SchematicToggle::eIsParentColumn, m_isLargeScaled); + new SchematicToggle(this, viewer->getSchematicPreviewButtonOnImage(), + viewer->getSchematicPreviewButtonBgOnColor(), + viewer->getSchematicPreviewButtonOffImage(), + viewer->getSchematicPreviewButtonBgOffColor(), + SchematicToggle::eIsParentColumn, m_isNormalIconView); m_cameraStandToggle = new SchematicToggle( - this, QPixmap(":Resources/schematic_table_view.png"), - QPixmap(":Resources/schematic_table_view_transp.png"), + this, viewer->getSchematicCamstandButtonOnImage(), + viewer->getSchematicCamstandButtonTranspImage(), + viewer->getSchematicCamstandButtonBgOnColor(), + viewer->getSchematicCamstandButtonOffImage(), + viewer->getSchematicCamstandButtonBgOffColor(), SchematicToggle::eIsParentColumn | SchematicToggle::eEnableNullState, - m_isLargeScaled); + m_isNormalIconView); m_columnPainter = new FxColumnPainter(this, m_width, m_height, m_name); // no link port @@ -2917,7 +2927,11 @@ FxSchematicColumnNode::FxSchematicColumnNode(FxSchematicScene *scene, //----- m_nameItem->setName(m_name); - setToolTip(m_name); + + int levelType; + QString levelName; + FxSchematicColumnNode::getLevelTypeAndName(levelType, levelName); + setToolTip(QString("%1 : %2").arg(m_name, levelName)); addPort(0, m_outDock->getPort()); @@ -2930,7 +2944,7 @@ FxSchematicColumnNode::FxSchematicColumnNode(FxSchematicScene *scene, } // set geometry - if (m_isLargeScaled) { + if (m_isNormalIconView) { m_resizeItem->setPos(2, 0); m_nameItem->setPos(16, -1); m_outDock->setPos(72, 14); @@ -2973,7 +2987,7 @@ FxSchematicColumnNode::~FxSchematicColumnNode() {} //----------------------------------------------------- QRectF FxSchematicColumnNode::boundingRect() const { - if (m_isOpened && m_isLargeScaled) + if (m_isOpened && m_isNormalIconView) return QRectF(-5, -54, m_width + 10, m_height + 59); else return QRectF(-5, -5, m_width + 10, m_height + 10); @@ -3054,6 +3068,17 @@ void FxSchematicColumnNode::getLevelTypeAndName(int <ype, if (xl) { ltype = cell.m_level->getType(); + // for Zerary Fx, display FxId + if (ltype == ZERARYFX_XSHLEVEL) { + TXshZeraryFxColumn *zColumn = + dynamic_cast(xsh->getColumn(m_columnIndex)); + if (zColumn) { + TFx *fx = zColumn->getZeraryColumnFx()->getZeraryFx(); + levelName = QString::fromStdWString(fx->getFxId()); + return; + } + } + levelName = QString::fromStdWString(xl->getName()); return; } @@ -3071,7 +3096,7 @@ void FxSchematicColumnNode::onChangedSize(bool expand) { prepareGeometryChange(); m_isOpened = expand; m_fx->getAttributes()->setIsOpened(m_isOpened); - m_height = (m_isLargeScaled) ? 32 : 50; + m_height = (m_isNormalIconView) ? 32 : 50; updateLinksGeometry(); update(); } @@ -3082,7 +3107,13 @@ void FxSchematicColumnNode::onNameChanged() { m_nameItem->hide(); m_name = m_nameItem->toPlainText(); m_columnPainter->setName(m_name); - setToolTip(m_name); + + int levelType; + QString levelName; + getLevelTypeAndName(levelType, levelName); + + setToolTip(QString("%1 : %2").arg(m_name, levelName)); + setFlag(QGraphicsItem::ItemIsSelectable, true); TStageObjectId id = TStageObjectId::ColumnId(m_columnIndex); @@ -3135,13 +3166,15 @@ void FxSchematicColumnNode::renameObject(const TStageObjectId &id, FxSchematicPaletteNode::FxSchematicPaletteNode(FxSchematicScene *scene, TPaletteColumnFx *fx) : FxSchematicNode(scene, fx, 90, 32, eColumnFx) { - if (!m_isLargeScaled) { + SchematicViewer *viewer = scene->getSchematicViewer(); + + if (!m_isNormalIconView) { setWidth(90); setHeight(50); } m_columnIndex = fx->getColumnIndex(); TStageObjectId id = TStageObjectId::ColumnId(m_columnIndex); - std::string name = scene->getXsheet()->getStageObject(id)->getFullName(); + std::string name = scene->getXsheet()->getStageObject(id)->getName(); m_name = QString::fromStdString(name); m_linkedNode = 0; @@ -3149,8 +3182,11 @@ FxSchematicPaletteNode::FxSchematicPaletteNode(FxSchematicScene *scene, m_nameItem = new SchematicName(this, 54, 20); // for rename m_outDock = new FxSchematicDock(this, "", 0, eFxOutputPort); m_renderToggle = - new SchematicToggle(this, QPixmap(":Resources/schematic_prev_eye.png"), - SchematicToggle::eIsParentColumn, m_isLargeScaled); + new SchematicToggle(this, viewer->getSchematicPreviewButtonOnImage(), + viewer->getSchematicPreviewButtonBgOnColor(), + viewer->getSchematicPreviewButtonOffImage(), + viewer->getSchematicPreviewButtonBgOffColor(), + SchematicToggle::eIsParentColumn, m_isNormalIconView); m_palettePainter = new FxPalettePainter(this, m_width, m_height, m_name); //---- @@ -3165,7 +3201,7 @@ FxSchematicPaletteNode::FxSchematicPaletteNode(FxSchematicScene *scene, if (column) m_renderToggle->setIsActive(column->isPreviewVisible()); // set geometry - if (m_isLargeScaled) { + if (m_isNormalIconView) { m_nameItem->setPos(19, -1); m_outDock->setPos(72, 14); m_renderToggle->setPos(72, 0); @@ -3258,7 +3294,8 @@ void FxSchematicPaletteNode::onNameChanged() { m_nameItem->hide(); m_name = m_nameItem->toPlainText(); m_palettePainter->setName(m_name); - setToolTip(m_name); + QString paletteName = getPaletteName(); + setToolTip(QString("%1 : %2").arg(m_name, paletteName)); setFlag(QGraphicsItem::ItemIsSelectable, true); TStageObjectId id = TStageObjectId::ColumnId(m_columnIndex); @@ -3306,7 +3343,9 @@ FxGroupNode::FxGroupNode(FxSchematicScene *scene, const QList &groupedFx, : FxSchematicNode(scene, roots[0].getPointer(), 90, 32, eGroupedFx) , m_groupId(groupId) , m_groupedFxs(groupedFx) { - if (!m_isLargeScaled) { + SchematicViewer *viewer = scene->getSchematicViewer(); + + if (!m_isNormalIconView) { setWidth(90); setHeight(50); } @@ -3314,13 +3353,23 @@ FxGroupNode::FxGroupNode(FxSchematicScene *scene, const QList &groupedFx, m_name = QString::fromStdWString(groupName); m_roots = roots; + QString fxId = "Group " + QString::number(m_groupId); + if (m_name != fxId) + setToolTip(QString("%1 (%2)").arg(m_name, fxId)); + else + setToolTip(m_name); + m_nameItem = new SchematicName(this, 72, 20); // for rename m_renderToggle = - new SchematicToggle(this, QPixmap(":Resources/schematic_prev_eye.png"), - SchematicToggle::eIsParentColumn, m_isLargeScaled); + new SchematicToggle(this, viewer->getSchematicPreviewButtonOnImage(), + viewer->getSchematicPreviewButtonBgOnColor(), + viewer->getSchematicPreviewButtonOffImage(), + viewer->getSchematicPreviewButtonBgOffColor(), + SchematicToggle::eIsParentColumn, m_isNormalIconView); m_outDock = new FxSchematicDock(this, "", 0, eFxGroupedOutPort); FxSchematicDock *inDock = new FxSchematicDock( - this, "Source", (m_isLargeScaled) ? m_width - 18 : 10, eFxGroupedInPort); + this, "Source", (m_isNormalIconView) ? m_width - 18 : 10, + eFxGroupedInPort); m_painter = new FxPainter(this, m_width, m_height, m_name, m_type, roots[0]->getFxType()); @@ -3337,7 +3386,7 @@ FxGroupNode::FxGroupNode(FxSchematicScene *scene, const QList &groupedFx, m_inDocks.push_back(inDock); // set geometry - if (m_isLargeScaled) { + if (m_isNormalIconView) { m_nameItem->setPos(1, -1); m_renderToggle->setPos(72, 0); m_outDock->setPos(72, 14); @@ -3453,7 +3502,11 @@ void FxGroupNode::onNameChanged() { m_nameItem->hide(); m_name = m_nameItem->toPlainText(); m_painter->setName(m_name); - setToolTip(m_name); + QString fxId = "Group " + QString::number(m_groupId); + if (m_name != fxId) + setToolTip(QString("%1 (%2)").arg(m_name, fxId)); + else + setToolTip(m_name); setFlag(QGraphicsItem::ItemIsSelectable, true); FxSchematicScene *fxScene = dynamic_cast(scene()); if (!fxScene) return; diff --git a/toonz/sources/toonzqt/fxschematicscene.cpp b/toonz/sources/toonzqt/fxschematicscene.cpp index be0019b..a79fd0a 100644 --- a/toonz/sources/toonzqt/fxschematicscene.cpp +++ b/toonz/sources/toonzqt/fxschematicscene.cpp @@ -3,6 +3,7 @@ #include "toonzqt/fxschematicscene.h" // TnzQt includes +#include "toonzqt/fxtypes.h" #include "toonzqt/fxschematicnode.h" #include "toonzqt/gutil.h" #include "toonzqt/dvdialog.h" @@ -27,6 +28,7 @@ #include "toonz/tcolumnhandle.h" #include "toonz/tframehandle.h" #include "toonz/tobjecthandle.h" +#include "toonz/childstack.h" // TnzBase includes #include "tmacrofx.h" @@ -36,12 +38,15 @@ // TnzCore includes #include "tconst.h" +#include "tenv.h" // Qt includes #include #include #include +TEnv::IntVar IconifyFxSchematicNodes("IconifyFxSchematicNodes", 0); + namespace { class MatchesFx { @@ -302,7 +307,10 @@ FxSchematicScene::FxSchematicScene(QWidget *parent) , m_lastPos(0, 0) , m_currentFxNode(0) , m_gridDimension(eSmall) - , m_isLargeScaled(true) { + , m_isNormalIconView(!IconifyFxSchematicNodes) + , m_viewer() { + m_viewer = (SchematicViewer *)parent; + m_selection = new FxSelection(); m_selection->setFxSchematicScene(this); @@ -345,13 +353,7 @@ void FxSchematicScene::setApplication(TApplication *app) { //------------------------------------------------------------------ void FxSchematicScene::updateScene() { - if (!views().empty()) -#if QT_VERSION >= 0x050000 - m_isLargeScaled = views().at(0)->matrix().determinant() >= 1.0; -#else - m_isLargeScaled = views().at(0)->matrix().det() >= 1.0; -#endif - m_disconnectionLinks.clearAll(); + if (!views().empty()) m_disconnectionLinks.clearAll(); m_connectionLinks.clearAll(); m_selectionOldPos.clear(); @@ -908,6 +910,15 @@ void FxSchematicScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { menu.addMenu(m_addFxContextMenu.getAddMenu()); if (addOutputFx) menu.addAction(addOutputFx); + + // Close sub xsheet and move to parent sheet + ToonzScene *scene = getXsheet()->getScene(); + ChildStack *childStack = scene->getChildStack(); + if (childStack && childStack->getAncestorCount() > 0) { + menu.addSeparator(); + menu.addAction(CommandManager::instance()->getAction("MI_CloseChild")); + } + menu.addSeparator(); menu.addAction(copy); menu.addAction(cut); @@ -946,7 +957,7 @@ QPointF FxSchematicScene::nearestPoint(const QPointF &point) { if (item) return rect.bottomRight(); item = itemAt(rect.topLeft()); if (item) return rect.topLeft(); - item = itemAt(rect.topRight()); + item = itemAt(rect.topRight()); #endif if (item) return rect.topRight(); return QPointF(); @@ -1374,13 +1385,6 @@ void FxSchematicScene::onCollapse(const QList &fxs) { //------------------------------------------------------------------ -void FxSchematicScene::onOpenSubxsheet() { - CommandManager *cm = CommandManager::instance(); - cm->execute("MI_OpenChild"); -} - -//------------------------------------------------------------------ - TXsheet *FxSchematicScene::getXsheet() { return m_xshHandle->getXsheet(); } //------------------------------------------------------------------ @@ -1446,6 +1450,14 @@ void FxSchematicScene::onCurrentColumnChanged(int index) { //------------------------------------------------------------------ +void FxSchematicScene::onIconifyNodesToggled(bool iconified) { + m_isNormalIconView = !iconified; + IconifyFxSchematicNodes = (iconified) ? 1 : 0; + updateScene(); +} + +//------------------------------------------------------------------ + TFx *FxSchematicScene::getCurrentFx() { return m_fxHandle->getFx(); } //------------------------------------------------------------------ diff --git a/toonz/sources/toonzqt/imageutils.cpp b/toonz/sources/toonzqt/imageutils.cpp index bb19e90..91cb97b 100644 --- a/toonz/sources/toonzqt/imageutils.cpp +++ b/toonz/sources/toonzqt/imageutils.cpp @@ -13,6 +13,7 @@ #include "toonz/toonzscene.h" #include "toonz/tproject.h" #include "toonz/Naa2TlvConverter.h" +#include "toonz/toonzimageutils.h" #ifdef _WIN32 #include "avicodecrestrictions.h" @@ -704,6 +705,63 @@ void convertNaa2Tlv(const TFilePath &source, const TFilePath &dest, //============================================================================= +void convertOldLevel2Tlv(const TFilePath &source, const TFilePath &dest, + const TFrameId &from, const TFrameId &to, + FrameTaskNotifier *frameNotifier) { + TFilePath destPltPath = TFilePath(dest.getParentDir().getWideString() + + L"\\" + dest.getWideName() + L".tpl"); + if (TSystem::doesExistFileOrLevel(destPltPath)) + TSystem::removeFileOrLevel(destPltPath); + + TLevelWriterP lw(dest); + lw->setIconSize(Preferences::instance()->getIconSize()); + TPaletteP palette = + ToonzImageUtils::loadTzPalette(source.withType("plt").withNoFrame()); + TLevelReaderP lr(source); + if (!lr) { + DVGui::warning(QObject::tr( + "The source image seems not suitable for this kind of conversion")); + frameNotifier->notifyError(); + return; + } + TLevelP inLevel = lr->loadInfo(); + if (!inLevel || inLevel->getFrameCount() == 0) { + DVGui::warning(QObject::tr( + "The source image seems not suitable for this kind of conversion")); + frameNotifier->notifyError(); + return; + } + // Get the frames available in level inside the [from, to] range + std::vector frames; + getFrameIds(from, to, inLevel, frames); + if (frames.empty()) return; + + TLevelP outLevel; + outLevel->setPalette(palette.getPointer()); + try { + int f, fCount = int(frames.size()); + for (f = 0; f != fCount; ++f) { + if (frameNotifier->abortTask()) break; + TToonzImageP img = lr->getFrameReader(frames[f])->load(); + if (!img) continue; + img->setPalette(palette.getPointer()); + lw->getFrameWriter(frames[f])->save(img); + + frameNotifier->notifyFrameCompleted(100 * (f + 1) / frames.size()); + } + } catch (TException &e) { + QString msg = QString::fromStdWString(e.getMessage()); + DVGui::warning(msg); + lw = TLevelWriterP(); + if (TSystem::doesExistFileOrLevel(dest)) TSystem::removeFileOrLevel(dest); + frameNotifier->notifyError(); + return; + } + lw = TLevelWriterP(); +} + +//============================================================================= + #define ZOOMLEVELS 13 #define NOZOOMINDEX 6 double ZoomFactors[ZOOMLEVELS] = { diff --git a/toonz/sources/toonzqt/pluginhost.cpp b/toonz/sources/toonzqt/pluginhost.cpp index 39b8565..895b130 100644 --- a/toonz/sources/toonzqt/pluginhost.cpp +++ b/toonz/sources/toonzqt/pluginhost.cpp @@ -602,7 +602,7 @@ Param *RasterFxPluginHost::createParam(const toonz_param_desc_t *desc) { p->setDescription(desc->note); p->setUILabel(desc->base.label); - bindParam(this, desc->key, p); + bindPluginParam(this, desc->key, p); params_.push_back(std::make_shared( this, desc->key, toonz_param_type_enum(desc->traits_tag), desc)); diff --git a/toonz/sources/toonzqt/schematicnode.cpp b/toonz/sources/toonzqt/schematicnode.cpp index a348e03..7daf2b6 100644 --- a/toonz/sources/toonzqt/schematicnode.cpp +++ b/toonz/sources/toonzqt/schematicnode.cpp @@ -1,6 +1,8 @@ #include "toonzqt/schematicnode.h" +#include "toonzqt/stageschematicscene.h" + #include #include #include @@ -159,28 +161,69 @@ void SchematicThumbnailToggle::mousePressEvent(QGraphicsSceneMouseEvent *me) { // //======================================================== -SchematicToggle::SchematicToggle(SchematicNode *parent, const QPixmap &pixmap, - int flags, bool isLargeScaled) +SchematicToggle::SchematicToggle(SchematicNode *parent, const QIcon &imageOn, + QColor colorOn, int flags, + bool isNormalIconView) + : QGraphicsItem(parent) + , m_imageOn(imageOn) + , m_imageOn2() + , m_imageOff() + , m_state(0) + , m_flags(flags) + , m_width(isNormalIconView ? 18 : 30) + , m_height(isNormalIconView ? 7 : 5) + , m_colorOn(colorOn) + , m_colorOff(QColor(0, 0, 0, 0)) {} + +//-------------------------------------------------------- + +SchematicToggle::SchematicToggle(SchematicNode *parent, const QIcon &imageOn, + QColor colorOn, const QIcon &imageOff, + QColor colorOff, int flags, + bool isNormalIconView) : QGraphicsItem(parent) - , m_pixmap1(pixmap) - , m_pixmap2() + , m_imageOn(imageOn) + , m_imageOn2() + , m_imageOff(imageOff) , m_state(0) , m_flags(flags) - , m_width(isLargeScaled ? 18 : 30) - , m_height(isLargeScaled ? 7 : 5) {} + , m_width(isNormalIconView ? 18 : 30) + , m_height(isNormalIconView ? 7 : 5) + , m_colorOn(colorOn) + , m_colorOff(colorOff) {} //-------------------------------------------------------- -SchematicToggle::SchematicToggle(SchematicNode *parent, const QPixmap &pixmap1, - const QPixmap &pixmap2, int flags, - bool isLargeScaled) +SchematicToggle::SchematicToggle(SchematicNode *parent, const QIcon &imageOn, + const QIcon &imageOn2, QColor colorOn, + int flags, bool isNormalIconView) : QGraphicsItem(parent) - , m_pixmap1(pixmap1) - , m_pixmap2(pixmap2) + , m_imageOn(imageOn) + , m_imageOn2(imageOn2) + , m_imageOff() , m_state(0) , m_flags(flags) - , m_width(isLargeScaled ? 18 : 30) - , m_height(isLargeScaled ? 7 : 5) {} + , m_width(isNormalIconView ? 18 : 30) + , m_height(isNormalIconView ? 7 : 5) + , m_colorOn(colorOn) + , m_colorOff(QColor(0, 0, 0, 0)) {} + +//-------------------------------------------------------- + +SchematicToggle::SchematicToggle(SchematicNode *parent, const QIcon &imageOn, + const QIcon &imageOn2, QColor colorOn, + const QIcon &imageOff, QColor colorOff, + int flags, bool isNormalIconView) + : QGraphicsItem(parent) + , m_imageOn(imageOn) + , m_imageOn2(imageOn2) + , m_imageOff(imageOff) + , m_state(0) + , m_flags(flags) + , m_width(isNormalIconView ? 18 : 30) + , m_height(isNormalIconView ? 7 : 5) + , m_colorOn(colorOn) + , m_colorOff(colorOff) {} //-------------------------------------------------------- @@ -197,10 +240,33 @@ QRectF SchematicToggle::boundingRect() const { void SchematicToggle::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { + int rectHeight = boundingRect().height(); + int rectWidth = boundingRect().width(); + int rectX = boundingRect().left(); + int rectY = boundingRect().top(); + + QRect rect = + QRect(0, 0, rectHeight, rectHeight) + .translated(rectX + (rectWidth / 2) - (rectHeight / 2), rectY); + if (m_state != 0) { - QPixmap &pix = - (m_state == 2 && !m_pixmap2.isNull()) ? m_pixmap2 : m_pixmap1; - painter->drawPixmap(boundingRect().toRect(), pix); + QIcon &pix = + (m_state == 2 && !m_imageOn2.isNull()) ? m_imageOn2 : m_imageOn; + painter->fillRect(boundingRect().toRect(), m_colorOn); + QRect sourceRect = + scene()->views()[0]->matrix().mapRect(QRect(0, 0, 18, 17)); + QPixmap redPm = pix.pixmap(sourceRect.size()); + QRect newRect = QRect(0, 0, sourceRect.width() * getDevPixRatio(), + sourceRect.height() * getDevPixRatio()); + painter->drawPixmap(rect, redPm, newRect); + } else if (!m_imageOff.isNull()) { + painter->fillRect(boundingRect().toRect(), m_colorOff); + QRect sourceRect = + scene()->views()[0]->matrix().mapRect(QRect(0, 0, 18, 17)); + QPixmap redPm = m_imageOff.pixmap(sourceRect.size()); + QRect newRect = QRect(0, 0, sourceRect.width() * getDevPixRatio(), + sourceRect.height() * getDevPixRatio()); + painter->drawPixmap(rect, redPm, newRect); } } @@ -208,7 +274,7 @@ void SchematicToggle::paint(QPainter *painter, void SchematicToggle::mousePressEvent(QGraphicsSceneMouseEvent *me) { if (me->button() == Qt::LeftButton) { - if (m_pixmap2.isNull()) { + if (m_imageOn2.isNull()) { m_state = 1 - m_state; emit(toggled(m_state != 0)); } else if (m_flags & eEnableNullState) { @@ -228,7 +294,7 @@ void SchematicToggle::mousePressEvent(QGraphicsSceneMouseEvent *me) { void SchematicToggle::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { if (!(m_flags & eIsParentColumn)) return; - if (m_pixmap2.isNull()) { + if (m_imageOn2.isNull()) { QMenu *menu = new QMenu(0); CommandManager *cmdManager = CommandManager::instance(); menu->addAction(cmdManager->getAction("MI_EnableThisColumnOnly")); @@ -261,9 +327,14 @@ void SchematicToggle_SplineOptions::paint( QRectF rect = boundingRect(); painter->fillRect(rect, Qt::white); if (m_state != 0) { - QPixmap &pix = - (m_state == 2 && !m_pixmap2.isNull()) ? m_pixmap2 : m_pixmap1; - painter->drawPixmap(boundingRect().toRect(), pix); + QIcon &pix = + (m_state == 2 && !m_imageOn2.isNull()) ? m_imageOn2 : m_imageOn; + QRect sourceRect = + scene()->views()[0]->matrix().mapRect(QRect(0, 0, 18, 17)); + QPixmap redPm = pix.pixmap(sourceRect.size()); + QRect newRect = QRect(0, 0, sourceRect.width() * getDevPixRatio(), + sourceRect.height() * getDevPixRatio()); + painter->drawPixmap(rect, redPm, newRect); } painter->setBrush(Qt::NoBrush); painter->setPen(QColor(180, 180, 180, 255)); diff --git a/toonz/sources/toonzqt/schematicviewer.cpp b/toonz/sources/toonzqt/schematicviewer.cpp index caf05df..489d3a6 100644 --- a/toonz/sources/toonzqt/schematicviewer.cpp +++ b/toonz/sources/toonzqt/schematicviewer.cpp @@ -3,6 +3,7 @@ #include "toonzqt/schematicviewer.h" // TnzQt includes +#include "toonzqt/fxtypes.h" #include "toonzqt/schematicnode.h" #include "toonzqt/fxschematicnode.h" #include "toonzqt/schematicgroupeditor.h" @@ -27,6 +28,7 @@ #include "toonz/fxdag.h" #include "toonz/tapplication.h" #include "toonz/tscenehandle.h" +#include "toonz/txshleveltypes.h" #include "../toonz/menubarcommandids.h" @@ -764,6 +766,59 @@ SchematicViewer::~SchematicViewer() {} //------------------------------------------------------------------ +void SchematicViewer::getNodeColor(int ltype, QColor &nodeColor) { + switch (ltype) { + case TZI_XSHLEVEL: + case OVL_XSHLEVEL: + nodeColor = getFullcolorColumnColor(); + break; + case PLI_XSHLEVEL: + nodeColor = getVectorColumnColor(); + break; + case TZP_XSHLEVEL: + nodeColor = getLevelColumnColor(); + break; + case ZERARYFX_XSHLEVEL: + nodeColor = getFxColumnColor(); + break; + case CHILD_XSHLEVEL: + nodeColor = getChildColumnColor(); + break; + case MESH_XSHLEVEL: + nodeColor = getMeshColumnColor(); + break; + case PLT_XSHLEVEL: + nodeColor = getPaletteColumnColor(); + break; + case eNormalFx: + nodeColor = getNormalFxColor(); + break; + case eZeraryFx: + nodeColor = getFxColumnColor(); + break; + case eMacroFx: + nodeColor = getMacroFxColor(); + break; + case eGroupedFx: + nodeColor = getGroupColor(); + break; + case eNormalImageAdjustFx: + nodeColor = getImageAdjustFxColor(); + break; + case eNormalLayerBlendingFx: + nodeColor = getLayerBlendingFxColor(); + break; + case eNormalMatteFx: + nodeColor = getMatteFxColor(); + break; + default: + nodeColor = grey210; + break; + } +} + +//------------------------------------------------------------------ + void SchematicViewer::setApplication(TApplication *app) { m_stageScene->setXsheetHandle(app->getCurrentXsheet()); m_stageScene->setObjectHandle(app->getCurrentObject()); @@ -821,7 +876,7 @@ void SchematicViewer::createToolbars() { void SchematicViewer::createActions() { // Create all actions QAction *addPegbar = 0, *addSpline = 0, *addCamera = 0, *insertFx = 0, - *addOutputFx = 0, *switchPort = 0; + *addOutputFx = 0, *switchPort = 0, *iconifyNodes = 0; { // Fit schematic QIcon fitSchematicIcon = createQIconOnOff("fit", false); @@ -914,6 +969,15 @@ void SchematicViewer::createActions() { // AddOutputFx addOutputFx = CommandManager::instance()->getAction("MI_NewOutputFx"); + // Iconify Fx nodes + iconifyNodes = new QAction(tr("&Toggle node icons"), m_fxToolbar); + iconifyNodes->setCheckable(true); + iconifyNodes->setChecked(!m_fxScene->isNormalIconView()); + QIcon iconifyNodesIcon = createQIconOnOff("iconifynodes"); + iconifyNodes->setIcon(iconifyNodesIcon); + connect(iconifyNodes, SIGNAL(toggled(bool)), m_fxScene, + SLOT(onIconifyNodesToggled(bool))); + // Swap fx/stage schematic QIcon changeSchematicIcon = createQIconOnOff("swap", false); m_changeScene = @@ -949,6 +1013,8 @@ void SchematicViewer::createActions() { m_stageToolbar->addAction(addPegbar); m_fxToolbar->addSeparator(); + m_fxToolbar->addAction(iconifyNodes); + m_fxToolbar->addSeparator(); m_fxToolbar->addAction(addOutputFx); m_fxToolbar->addAction(insertFx); @@ -989,7 +1055,7 @@ void SchematicViewer::setFxSchematic() { m_fxToolbar->show(); // check if the fx scene was small scaled (icon view mode) - if (!m_fxScene->isLargeScaled()) m_fxScene->updateScene(); + if (!m_fxScene->isNormalIconView()) m_fxScene->updateScene(); m_viewer->update(); } @@ -1026,7 +1092,7 @@ void SchematicViewer::onSceneSwitched() { // reset schematic m_viewer->resetMatrix(); m_viewer->centerOn(m_viewer->scene()->itemsBoundingRect().center()); - if (m_viewer->scene() == m_fxScene && !m_fxScene->isLargeScaled()) + if (m_viewer->scene() == m_fxScene && !m_fxScene->isNormalIconView()) m_fxScene->updateScene(); } @@ -1085,6 +1151,18 @@ void SchematicViewer::changeNodeSize() { //------------------------------------------------------------------ +QColor SchematicViewer::getSelectedNodeTextColor() { + // get colors + TPixel currentColumnPixel; + Preferences::instance()->getCurrentColumnData(currentColumnPixel); + QColor currentColumnColor((int)currentColumnPixel.r, + (int)currentColumnPixel.g, + (int)currentColumnPixel.b, 255); + return currentColumnColor; +} + +//------------------------------------------------------------------ + void SchematicViewer::setCursorMode(CursorMode cursorMode) { m_cursorMode = cursorMode; m_viewer->setCursorMode(m_cursorMode); diff --git a/toonz/sources/toonzqt/stageschematicnode.cpp b/toonz/sources/toonzqt/stageschematicnode.cpp index 2a818b0..4b57ebe 100644 --- a/toonz/sources/toonzqt/stageschematicnode.cpp +++ b/toonz/sources/toonzqt/stageschematicnode.cpp @@ -135,9 +135,11 @@ void ColumnPainter::paint(QPainter *painter, QString levelName; m_parent->getLevelTypeAndName(levelType, levelName); - QLinearGradient linearGrad = getGradientByLevelType(m_type); + QColor nodeColor; + SchematicViewer *viewer = stageScene->getSchematicViewer(); + viewer->getNodeColor(levelType, nodeColor); - painter->setBrush(QBrush(linearGrad)); + painter->setBrush(nodeColor); painter->setPen(Qt::NoPen); if (levelType == PLT_XSHLEVEL) painter->drawRoundRect(0, 0, m_width, m_height, 32, 99); @@ -164,7 +166,7 @@ void ColumnPainter::paint(QPainter *painter, painter->drawRect(0, -pixmap.height(), m_width, pixmap.height()); } } - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); painter->setBrush(Qt::NoBrush); //! draw the name only if it is not editing @@ -175,7 +177,7 @@ void ColumnPainter::paint(QPainter *painter, // if this is current object if (stageScene->getCurrentObject() == m_parent->getStageObject()->getId()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); QRectF columnNameRect(18, 2, 54, 14); QString elidedName = elideText(m_name, painter->font(), columnNameRect.width()); @@ -193,81 +195,6 @@ void ColumnPainter::paint(QPainter *painter, //-------------------------------------------------------- -QLinearGradient ColumnPainter::getGradientByLevelType(int type) { - QColor col1, col2, col3, col4, col5; - switch (type) { - case TZI_XSHLEVEL: - case OVL_XSHLEVEL: - col1 = QColor(209, 232, 234); - col2 = QColor(121, 171, 181); - col3 = QColor(98, 143, 165); - col4 = QColor(33, 90, 118); - col5 = QColor(122, 172, 173); - break; - case PLI_XSHLEVEL: - col1 = QColor(236, 226, 182); - col2 = QColor(199, 187, 95); - col3 = QColor(180, 180, 67); - col4 = QColor(130, 125, 15); - col5 = QColor(147, 150, 28); - break; - case TZP_XSHLEVEL: - col1 = QColor(196, 245, 196); - col2 = QColor(111, 192, 105); - col3 = QColor(63, 146, 99); - col4 = QColor(32, 113, 86); - col5 = QColor(117, 187, 166); - break; - case ZERARYFX_XSHLEVEL: - col1 = QColor(232, 245, 196); - col2 = QColor(130, 129, 93); - col3 = QColor(113, 115, 81); - col4 = QColor(55, 59, 25); - col5 = QColor(144, 154, 111); - break; - case CHILD_XSHLEVEL: - col1 = QColor(247, 208, 241); - col2 = QColor(214, 154, 219); - col3 = QColor(170, 123, 169); - col4 = QColor(92, 52, 98); - col5 = QColor(132, 111, 154); - break; - case PLT_XSHLEVEL: - col1 = QColor(42, 171, 154); - col2 = QColor(28, 116, 105); - col3 = QColor(15, 62, 56); - col4 = QColor(15, 62, 56); - col5 = QColor(33, 95, 90); - break; - case MESH_XSHLEVEL: - col1 = QColor(210, 140, 255); - col2 = QColor(200, 130, 255); - col3 = QColor(150, 80, 180); - col4 = QColor(150, 80, 180); - col5 = QColor(180, 120, 220); - break; - case UNKNOWN_XSHLEVEL: - case NO_XSHLEVEL: - default: - col1 = QColor(227, 227, 227); - col2 = QColor(174, 174, 174); - col3 = QColor(123, 123, 123); - col4 = QColor(61, 61, 61); - col5 = QColor(127, 138, 137); - } - - QLinearGradient linearGrad(QPointF(0, 0), QPointF(0, 32)); - linearGrad.setColorAt(0, col1); - linearGrad.setColorAt(0.08, col2); - linearGrad.setColorAt(0.20, col3); - linearGrad.setColorAt(0.23, col4); - linearGrad.setColorAt(0.9, col4); - linearGrad.setColorAt(1, col5); - return linearGrad; -} - -//-------------------------------------------------------- - void ColumnPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { StageSchematicScene *stageScene = dynamic_cast(scene()); @@ -276,10 +203,9 @@ void ColumnPainter::contextMenuEvent(QGraphicsSceneContextMenuEvent *cme) { QAction *resetCenter = new QAction(tr("&Reset Center"), &menu); connect(resetCenter, SIGNAL(triggered()), stageScene, SLOT(onResetCenter())); QAction *collapse = CommandManager::instance()->getAction("MI_Collapse"); - QAction *openSubxsh = new QAction(tr("&Open Subxsheet"), &menu); + QAction *openSubxsh = CommandManager::instance()->getAction("MI_OpenChild"); QAction *explodeChild = CommandManager::instance()->getAction("MI_ExplodeChild"); - connect(openSubxsh, SIGNAL(triggered()), stageScene, SLOT(onOpenSubxsheet())); QAction *group = CommandManager::instance()->getAction("MI_Group"); QAction *clear = CommandManager::instance()->getAction("MI_Clear"); @@ -370,6 +296,8 @@ void GroupPainter::paint(QPainter *painter, dynamic_cast(scene()); if (!stageScene) return; + SchematicViewer *viewer = stageScene->getSchematicViewer(); + painter->save(); QPen pen; if (m_parent->isSelected()) { @@ -383,14 +311,7 @@ void GroupPainter::paint(QPainter *painter, painter->restore(); { - QLinearGradient groupLinearGrad(QPointF(0, 0), QPointF(0, 18)); - groupLinearGrad.setColorAt(0, QColor(115, 184, 200)); - groupLinearGrad.setColorAt(0.14, QColor(65, 118, 150)); - groupLinearGrad.setColorAt(0.35, QColor(57, 107, 158)); - groupLinearGrad.setColorAt(0.4, QColor(12, 60, 120)); - groupLinearGrad.setColorAt(0.8, QColor(12, 60, 120)); - groupLinearGrad.setColorAt(1, QColor(85, 91, 110)); - painter->setBrush(QBrush(groupLinearGrad)); + painter->setBrush(viewer->getGroupColor()); painter->setPen(Qt::NoPen); painter->drawRect(QRectF(0, 0, m_width, m_height)); } @@ -400,9 +321,9 @@ void GroupPainter::paint(QPainter *painter, QFont font("Verdana", 8); painter->setFont(font); if (stageScene->getCurrentObject() == m_parent->getStageObject()->getId()) - painter->setPen(QColor(255, 0, 0, 255)); + painter->setPen(viewer->getSelectedNodeTextColor()); else - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); QRectF rect(18, 0, 54, 18); QString elidedName = elideText(m_name, painter->font(), rect.width()); @@ -458,26 +379,21 @@ QRectF PegbarPainter::boundingRect() const { void PegbarPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - QLinearGradient pegLinearGrad(QPointF(0, 0), QPointF(0, 18)); - pegLinearGrad.setColorAt(0, QColor(223, 184, 115)); - pegLinearGrad.setColorAt(0.14, QColor(165, 118, 65)); - pegLinearGrad.setColorAt(0.35, QColor(157, 107, 58)); - pegLinearGrad.setColorAt(0.4, QColor(112, 60, 27)); - pegLinearGrad.setColorAt(0.8, QColor(112, 60, 27)); - pegLinearGrad.setColorAt(1, QColor(113, 91, 85)); - - painter->setBrush(QBrush(pegLinearGrad)); + StageSchematicScene *stageScene = + dynamic_cast(scene()); + + if (!stageScene) return; + SchematicViewer *viewer = stageScene->getSchematicViewer(); + + painter->setBrush(viewer->getPegColor()); painter->setPen(Qt::NoPen); painter->drawRect(QRectF(0, 0, m_width, m_height)); if (!m_parent->isNameEditing()) { - StageSchematicScene *stageScene = - dynamic_cast(scene()); - if (!stageScene) return; if (stageScene->getCurrentObject() == m_parent->getStageObject()->getId()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); else - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); // Draw the name QRectF rect(18, 0, 54, 18); QString elidedName = elideText(m_name, painter->font(), rect.width()); @@ -548,35 +464,23 @@ QRectF CameraPainter::boundingRect() const { void CameraPainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - QLinearGradient camLinearGrad(QPointF(0, 0), QPointF(0, 18)); - if (m_isActive) { - camLinearGrad.setColorAt(0, QColor(115, 190, 224)); - camLinearGrad.setColorAt(0.14, QColor(51, 132, 208)); - camLinearGrad.setColorAt(0.35, QColor(39, 118, 196)); - camLinearGrad.setColorAt(0.4, QColor(18, 82, 153)); - camLinearGrad.setColorAt(0.8, QColor(18, 82, 153)); - camLinearGrad.setColorAt(1, QColor(68, 119, 169)); - } else { - camLinearGrad.setColorAt(0, QColor(183, 197, 196)); - camLinearGrad.setColorAt(0.14, QColor(138, 157, 160)); - camLinearGrad.setColorAt(0.35, QColor(125, 144, 146)); - camLinearGrad.setColorAt(0.4, QColor(80, 94, 97)); - camLinearGrad.setColorAt(0.8, QColor(80, 94, 97)); - camLinearGrad.setColorAt(1, QColor(128, 140, 142)); - } + StageSchematicScene *stageScene = + dynamic_cast(scene()); + if (!stageScene) return; + + SchematicViewer *viewer = stageScene->getSchematicViewer(); + QColor cameraColor = m_isActive ? viewer->getActiveCameraColor() + : viewer->getOtherCameraColor(); - painter->setBrush(QBrush(camLinearGrad)); + painter->setBrush(cameraColor); painter->setPen(Qt::NoPen); painter->drawRect(QRectF(0, 0, m_width, m_height)); if (!m_parent->isNameEditing()) { - StageSchematicScene *stageScene = - dynamic_cast(scene()); - if (!stageScene) return; if (stageScene->getCurrentObject() == m_parent->getStageObject()->getId()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); else - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); // Draw the name QRectF rect(18, 0, 54, 18); QString elidedName = elideText(m_name, painter->font(), rect.width()); @@ -652,15 +556,13 @@ void TablePainter::paint(QPainter *painter, QWidget *widget) { QPixmap tablePm = QPixmap(":Resources/schematic_tablenode.png"); - QLinearGradient tableLinearGrad(QPointF(0, 0), QPointF(0, 18)); - tableLinearGrad.setColorAt(0, QColor(152, 146, 188)); - tableLinearGrad.setColorAt(0.14, QColor(107, 106, 148)); - tableLinearGrad.setColorAt(0.35, QColor(96, 96, 138)); - tableLinearGrad.setColorAt(0.4, QColor(63, 67, 99)); - tableLinearGrad.setColorAt(0.8, QColor(63, 67, 99)); - tableLinearGrad.setColorAt(1, QColor(101, 105, 143)); + StageSchematicScene *stageScene = + dynamic_cast(scene()); + if (!stageScene) return; - painter->setBrush(QBrush(tableLinearGrad)); + SchematicViewer *viewer = stageScene->getSchematicViewer(); + + painter->setBrush(viewer->getTableColor()); painter->setPen(Qt::NoPen); painter->drawRect(QRectF(0, 0, m_width, m_height)); @@ -668,17 +570,15 @@ void TablePainter::paint(QPainter *painter, painter->drawPixmap(imgRect, tablePm); - StageSchematicScene *stageScene = - dynamic_cast(scene()); - if (!stageScene) return; if (stageScene->getCurrentObject() == m_parent->getStageObject()->getId()) - painter->setPen(Qt::yellow); + painter->setPen(viewer->getSelectedNodeTextColor()); else - painter->setPen(Qt::white); + painter->setPen(viewer->getTextColor()); // Draw the name QRectF rect(30, 0, 42, 18); - painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, QString(tr("Table"))); + painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, + QString(tr("Table"))); } //-------------------------------------------------------- @@ -727,15 +627,13 @@ QRectF SplinePainter::boundingRect() const { void SplinePainter::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - QLinearGradient pegLinearGrad(QPointF(0, 0), QPointF(0, 18)); - pegLinearGrad.setColorAt(0, QColor(157, 255, 82)); - pegLinearGrad.setColorAt(0.14, QColor(127, 207, 42)); - pegLinearGrad.setColorAt(0.35, QColor(128, 201, 37)); - pegLinearGrad.setColorAt(0.4, QColor(100, 148, 8)); - pegLinearGrad.setColorAt(0.8, QColor(100, 148, 8)); - pegLinearGrad.setColorAt(1, QColor(120, 178, 73)); - - painter->setBrush(QBrush(pegLinearGrad)); + StageSchematicScene *stageScene = + dynamic_cast(scene()); + if (!stageScene) return; + + SchematicViewer *viewer = stageScene->getSchematicViewer(); + + painter->setBrush(viewer->getSplineColor()); painter->setPen(Qt::NoPen); painter->drawRoundRect(QRectF(0, 0, m_width, m_height), 20, 99); if (m_parent->isOpened()) { @@ -754,10 +652,13 @@ void SplinePainter::paint(QPainter *painter, //! draw the name only if it is not editing if (!m_parent->isNameEditing()) { - StageSchematicScene *stageScene = - dynamic_cast(scene()); - if (!stageScene) return; - painter->setPen(Qt::white); + /* There is no current spline + TStageObjectId currObj = stageScene->getCurrentObject(); + if(currObj.getCode() == m_parent->getSpline()->getId()) + painter->setPen(viewer->getSelectedNodeTextColor()); + else + */ + painter->setPen(viewer->getTextColor()); QRectF rect(18, 0, 72, 18); QString elidedName = elideText(m_name, painter->font(), rect.width()); painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, elidedName); @@ -1773,8 +1674,22 @@ StageSchematicColumnNode::StageSchematicColumnNode(StageSchematicScene *scene, bool ret = true; assert(pegbar && pegbar->getId().isColumn()); + + SchematicViewer *viewer = scene->getSchematicViewer(); + + TXshColumn *column = + scene->getXsheet()->getColumn(pegbar->getId().getIndex()); + std::string name = m_stageObject->getName(); + if (column) { + // ZeraryFx columns store name elsewhere + TXshZeraryFxColumn *zColumn = dynamic_cast(column); + if (zColumn) + name = + ::to_string(zColumn->getZeraryColumnFx()->getZeraryFx()->getName()); + } + m_name = QString::fromStdString(name); m_resizeItem = new SchematicThumbnailToggle(this, m_stageObject->isOpened()); m_resizeItem->setPos(2, 0); @@ -1791,21 +1706,25 @@ StageSchematicColumnNode::StageSchematicColumnNode(StageSchematicScene *scene, m_nameItem->hide(); m_renderToggle = - new SchematicToggle(this, QPixmap(":Resources/schematic_prev_eye.png"), + new SchematicToggle(this, viewer->getSchematicPreviewButtonOnImage(), + viewer->getSchematicPreviewButtonBgOnColor(), + viewer->getSchematicPreviewButtonOffImage(), + viewer->getSchematicPreviewButtonBgOffColor(), SchematicToggle::eIsParentColumn); ret = ret && connect(m_renderToggle, SIGNAL(toggled(bool)), this, SLOT(onRenderToggleClicked(bool))); if (scene) { - TXshColumn *column = - scene->getXsheet()->getColumn(pegbar->getId().getIndex()); if (column) m_renderToggle->setIsActive(column->isPreviewVisible()); m_renderToggle->setPos(72, 0); m_renderToggle->setZValue(2); m_cameraStandToggle = new SchematicToggle( - this, QPixmap(":Resources/schematic_table_view.png"), - QPixmap(":Resources/schematic_table_view_transp.png"), + this, viewer->getSchematicCamstandButtonOnImage(), + viewer->getSchematicCamstandButtonTranspImage(), + viewer->getSchematicCamstandButtonBgOnColor(), + viewer->getSchematicCamstandButtonOffImage(), + viewer->getSchematicCamstandButtonBgOffColor(), SchematicToggle::eIsParentColumn | SchematicToggle::eEnableNullState); ret = ret && connect(m_cameraStandToggle, SIGNAL(stateChanged(int)), this, SLOT(onCameraStandToggleClicked(int))); @@ -1833,8 +1752,10 @@ StageSchematicColumnNode::StageSchematicColumnNode(StageSchematicScene *scene, onChangedSize(m_stageObject->isOpened()); assert(ret); - if (levelType == ZERARYFX_XSHLEVEL || levelType == PLT_XSHLEVEL) + if (levelType == PLT_XSHLEVEL) { m_resizeItem->hide(); + m_cameraStandToggle->hide(); + } } //-------------------------------------------------------- @@ -1863,7 +1784,9 @@ void StageSchematicColumnNode::paint(QPainter *painter, QFont font("Verdana", 8); painter->setFont(font); StageSchematicScene *scene = dynamic_cast(m_scene); - if (scene && scene->getCurrentObject() == id) painter->setPen(Qt::red); + SchematicViewer *viewer = scene->getSchematicViewer(); + if (scene && scene->getCurrentObject() == id) + painter->setPen(viewer->getSelectedNodeTextColor()); QFontMetrics metrix(font); int srcWidth = metrix.width(colNumber); int srcHeight = metrix.height(); @@ -1977,18 +1900,20 @@ void StageSchematicColumnNode::mouseDoubleClickEvent( StageSchematicScene *stageScene = dynamic_cast(scene()); if (!stageScene) return; - - // do nothing for double-clicking a zerary Fx node - TStageObjectId id = m_stageObject->getId(); - TXshColumn *column = stageScene->getXsheet()->getColumn(id.getIndex()); - TXshZeraryFxColumn *fxColumn = dynamic_cast(column); - if (fxColumn) { - return; - } - QRectF nameArea(14, 0, m_width - 15, 14); if (nameArea.contains(me->pos())) { - m_name = QString::fromStdString(m_stageObject->getName()); + std::string name = m_stageObject->getName(); + + TStageObjectId id = m_stageObject->getId(); + TXshColumn *column = stageScene->getXsheet()->getColumn(id.getIndex()); + if (column) { + TXshZeraryFxColumn *fxColumn = dynamic_cast(column); + if (fxColumn) + name = ::to_string( + fxColumn->getZeraryColumnFx()->getZeraryFx()->getName()); + } + + m_name = QString::fromStdString(name); m_nameItem->setPlainText(m_name); m_nameItem->show(); m_nameItem->setFocus(); @@ -2296,7 +2221,11 @@ StageSchematicGroupNode::StageSchematicGroupNode( m_painter = new GroupPainter(this, m_width, m_height, m_name); m_painter->setZValue(1); - setToolTip(m_name); + QString id = "Group " + QString::number(getGroupId()); + if (m_name != id) + setToolTip(QString("%1 (%2)").arg(m_name, id)); + else + setToolTip(m_name); assert(ret); } @@ -2343,7 +2272,11 @@ void StageSchematicGroupNode::onNameChanged() { m_nameItem->hide(); m_name = m_nameItem->toPlainText(); m_painter->setName(m_name); - setToolTip(m_name); + QString id = "Group " + QString::number(getGroupId()); + if (m_name != id) + setToolTip(QString("%1 (%2)").arg(m_name, id)); + else + setToolTip(m_name); setFlag(QGraphicsItem::ItemIsSelectable, true); TStageObjectCmd::renameGroup(m_groupedObj, m_name.toStdWString(), false, diff --git a/toonz/sources/toonzqt/stageschematicscene.cpp b/toonz/sources/toonzqt/stageschematicscene.cpp index 0748609..f84b657 100644 --- a/toonz/sources/toonzqt/stageschematicscene.cpp +++ b/toonz/sources/toonzqt/stageschematicscene.cpp @@ -24,6 +24,7 @@ #include "toonz/tcamera.h" #include "toonz/tstageobjectcmd.h" #include "toonz/tproject.h" +#include "toonz/childstack.h" // TnzCore includes #include "tconst.h" @@ -136,7 +137,10 @@ StageSchematicScene::StageSchematicScene(QWidget *parent) , m_sceneHandle(0) , m_frameHandle(0) , m_gridDimension(eSmall) - , m_showLetterOnPortFlag(ShowLetterOnOutputPortOfStageNode != 0) { + , m_showLetterOnPortFlag(ShowLetterOnOutputPortOfStageNode != 0) + , m_viewer() { + m_viewer = (SchematicViewer *)parent; + QPointF sceneCenter = sceneRect().center(); m_firstPos = TPointD(sceneCenter.x(), sceneCenter.y()); @@ -1137,6 +1141,15 @@ void StageSchematicScene::contextMenuEvent( menu.addAction(addPegbar); menu.addAction(addCamera); menu.addAction(addSpline); + + // Close sub xsheet and move to parent sheet + ToonzScene *scene = m_sceneHandle->getScene(); + ChildStack *childStack = scene->getChildStack(); + if (childStack && childStack->getAncestorCount() > 0) { + menu.addSeparator(); + menu.addAction(CommandManager::instance()->getAction("MI_CloseChild")); + } + menu.addSeparator(); menu.addAction(paste); m_selection->setPastePosition(TPointD(scenePos.x(), scenePos.y())); @@ -1219,13 +1232,6 @@ void StageSchematicScene::onCollapse(QList objects) { //------------------------------------------------------------------ -void StageSchematicScene::onOpenSubxsheet() { - CommandManager *cm = CommandManager::instance(); - cm->execute("MI_OpenChild"); -} - -//------------------------------------------------------------------ - void StageSchematicScene::onEditGroup() { if (m_selection->isEmpty()) return; TStageObjectTree *pegTree = m_xshHandle->getXsheet()->getStageObjectTree(); diff --git a/toonz/sources/toonzqt/toonzqt.qrc b/toonz/sources/toonzqt/toonzqt.qrc index 055d028..d2256d3 100644 --- a/toonz/sources/toonzqt/toonzqt.qrc +++ b/toonz/sources/toonzqt/toonzqt.qrc @@ -180,11 +180,12 @@ Resources/spline_parent_port.svg Resources/schematic_prev_eye.png Resources/schematic_table_view.png - Resources/schematic_table_view_transp.png + Resources/schematic_table_view_transp.png Resources/fxport_red.svg Resources/fxport_blue.svg Resources/cachefx.png Resources/schematic_link.svg + Resources/schematic_link_small.svg Resources/schematic_thumbtoggle_on.svg Resources/schematic_thumbtoggle_off.svg Resources/dragcursor_exp_text.png @@ -313,6 +314,9 @@ Resources/switchport_off.svg Resources/switchport_over.svg Resources/plus.svg + Resources/iconifynodes_on.svg + Resources/iconifynodes_off.svg + Resources/iconifynodes_over.svg Resources/schematic_selection_mode_on.svg Resources/schematic_selection_mode_off.svg Resources/schematic_zoom_mode_on.svg