OpenToonz - An open-source full-featured 2D animation creation software
C
XDTS File Support (#2938)
shun-iwasawa38d9cff01998
diff --git a/stuff/profiles/layouts/rooms/Default/menubar_template.xml b/stuff/profiles/layouts/rooms/Default/menubar_template.xmlindex 33aea1fea..25561792d 100644--- a/stuff/profiles/layouts/rooms/Default/menubar_template.xml+++ b/stuff/profiles/layouts/rooms/Default/menubar_template.xml@@ -27,6 +27,7 @@</menu><menu title="Export"><command>MI_SoundTrack</command>+ <command>MI_ExportXDTS</command></menu><separator/><command>MI_PrintXsheet</command>diff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txtindex 48db86190..02d328679 100644--- a/toonz/sources/toonz/CMakeLists.txt+++ b/toonz/sources/toonz/CMakeLists.txt@@ -120,6 +120,7 @@ set(MOC_HEADERSxshnoteviewer.hxshrowviewer.hxshtoolbar.h+ xdtsimportpopup.h)if(WITH_STOPMOTION)@@ -173,6 +174,7 @@ set(HEADERS../include/cellposition.h../include/orientation.h../include/saveloadqsettings.h+ xdtsio.h# Tracker fileObjectTracker.hdummyprocessor.h@@ -347,6 +349,8 @@ set(SOURCESboardsettingspopup.cppseparatecolorsswatch.cppseparatecolorspopup.cpp+ xdtsio.cpp+ xdtsimportpopup.cpp# Tracker filedummyprocessor.cppmetnum.cppdiff --git a/toonz/sources/toonz/Resources/xdts.svg b/toonz/sources/toonz/Resources/xdts.svgnew file mode 100644index 000000000..83e43cc50--- /dev/null+++ b/toonz/sources/toonz/Resources/xdts.svg@@ -0,0 +1,191 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->++<svg+ xmlns:dc="http://purl.org/dc/elements/1.1/"+ xmlns:cc="http://creativecommons.org/ns#"+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+ xmlns:svg="http://www.w3.org/2000/svg"+ xmlns="http://www.w3.org/2000/svg"+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"+ version="1.1"+ id="svg2"+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"+ sodipodi:docname="xdts.svg"+ x="0px"+ y="0px"+ viewBox="0 0 61 61"+ style="enable-background:new 0 0 61 61;"+ xml:space="preserve"><metadata+ id="metadata18"><rdf:RDF><cc:Work+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs+ id="defs16" /><sodipodi:namedview+ pagecolor="#ffffff"+ bordercolor="#666666"+ borderopacity="1"+ objecttolerance="10"+ gridtolerance="10"+ guidetolerance="10"+ inkscape:pageopacity="0"+ inkscape:pageshadow="2"+ inkscape:window-width="1287"+ inkscape:window-height="753"+ id="namedview14"+ showgrid="false"+ inkscape:zoom="4.5409836"+ inkscape:cx="30.5"+ inkscape:cy="30.5"+ inkscape:window-x="283"+ inkscape:window-y="413"+ inkscape:window-maximized="0"+ inkscape:current-layer="svg2" />+<style+ type="text/css"+ id="style2">+ .st0{fill:#EBEBEB;}+ .st1{fill:#404040;}+ .st2{fill:#484848;}+</style>+<g+ id="g4">+ <rect+ id="rect6"+ x="0.5"+ y="0.5"+ class="st0"+ width="60"+ height="60"+ style="fill:#ebebeb" />+ <path+ id="path8"+ inkscape:connector-curvature="0"+ class="st1"+ d="M 61,61 H 0 V 0 H 61 Z M 1,1 V 60 H 60 V 1 C 60,1 1,1 1,1 Z"+ style="fill:#404040" />+</g>++++<g+ aria-label="XDTS"+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:16.45611954px;line-height:1.25;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none;stroke-width:0.41140226"+ id="text4531"><path+ d="M 19.925656,52.10165 H 16.438373 L 14.140302,48.284923 11.794019,52.10165 H 8.4674402 L 12.348449,46.075239 8.6201093,40.137216 h 3.4792477 l 2.153438,3.607811 2.209684,-3.607811 h 3.334614 l -3.752445,5.817495 z"+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:16.45611954px;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke-width:0.41140226"+ id="path4778" /><path+ d="m 31.769563,46.131486 q 0,1.671324 -0.731205,2.997135 -0.731204,1.317775 -1.848099,2.024874 -0.932085,0.602641 -2.032909,0.779416 -1.092789,0.168739 -2.330212,0.168739 h -3.74441 V 40.137216 h 3.712269 q 1.261528,0 2.362353,0.160704 1.100824,0.160704 2.06505,0.779416 1.181176,0.75531 1.86417,2.040944 0.682993,1.277599 0.682993,3.013206 z m -3.085522,-0.02411 q 0,-1.181176 -0.409796,-2.016839 -0.401761,-0.843697 -1.245459,-1.317775 -0.610676,-0.337479 -1.285634,-0.36962 -0.666923,-0.03214 -1.599008,-0.03214 h -0.05625 v 7.48882 h 0.05625 q 1.012437,0 1.703466,-0.03214 0.699063,-0.04018 1.32581,-0.433902 0.73924,-0.466043 1.12493,-1.285634 0.385691,-0.819592 0.385691,-2.000769 z"+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:16.45611954px;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke-width:0.41140226"+ id="path4780" /><path+ d="m 35.851452,52.10165 v -9.682433 h -3.535495 v -2.282001 h 10.076159 v 2.282001 h -3.535494 v 9.682433 z"+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:16.45611954px;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke-width:0.41140226"+ id="path4782" /><path+ d="m 47.341811,52.318601 q -1.374022,0 -2.4186,-0.265162 -1.036543,-0.265162 -1.928452,-0.658888 v -2.844466 h 0.273198 q 0.899944,0.763346 1.984698,1.173142 1.084754,0.409796 2.105226,0.409796 0.257127,0 0.674958,-0.05625 0.425866,-0.05625 0.682993,-0.176775 0.313374,-0.136598 0.530324,-0.377655 0.216951,-0.249091 0.216951,-0.650852 0,-0.449972 -0.353549,-0.731205 -0.35355,-0.281232 -0.843698,-0.409796 -0.610676,-0.160704 -1.30974,-0.305338 -0.691028,-0.144634 -1.293669,-0.353549 -1.390092,-0.490148 -1.992733,-1.317775 -0.602642,-0.827627 -0.602642,-2.073086 0,-1.67936 1.422233,-2.715902 1.422233,-1.044578 3.551565,-1.044578 1.068684,0 2.121297,0.216951 1.060648,0.21695 1.896311,0.58657 v 2.731973 h -0.265163 q -0.666922,-0.5705 -1.631148,-0.964225 -0.956191,-0.393726 -1.968628,-0.393726 -0.393725,0 -0.707099,0.05625 -0.313373,0.05625 -0.658887,0.21695 -0.281233,0.128564 -0.490148,0.385691 -0.200881,0.249091 -0.200881,0.562465 0,0.458007 0.321409,0.731204 0.329444,0.265162 1.261529,0.482113 0.602641,0.136599 1.157071,0.265162 0.562465,0.128564 1.197247,0.35355 1.245458,0.449972 1.848099,1.213317 0.610676,0.75531 0.610676,2.000768 0,1.783818 -1.406162,2.868572 -1.398128,1.084754 -3.784586,1.084754 z"+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:16.45611954px;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke-width:0.41140226"+ id="path4784" /></g><rect+ style="fill:none;fill-opacity:1;stroke:#484848;stroke-width:1;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-opacity:1"+ id="rect4533"+ width="40"+ height="25"+ x="10.5"+ y="8.5" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,12.5 c 40,0 40,0 40,0"+ id="path4535"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,15.484101 c 40,0 40,0 40,0"+ id="path4535-4"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,18.49046 c 35,0 35,0 35,0"+ id="path4535-3"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,21.49682 c 35,0 35,0 35,0"+ id="path4535-4-3"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,24.50318 c 35,0 35,0 35,0"+ id="path4535-4-9"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,27.50954 c 35,0 35,0 35,0"+ id="path4535-3-1"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 10.5,30.515899 c 35,0 35,0 35,0"+ id="path4535-4-3-1"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 31.25,33.5 c 0,-21 0,-21 0,-21"+ id="path4535-9"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 17.25,33.5 c 0,-21 0,-21 0,-21"+ id="path4535-9-1"+ inkscape:connector-curvature="0" /><path+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"+ d="m 38.25,33.5 c 0,-21 0,-21 0,-21"+ id="path4535-9-9"+ inkscape:connector-curvature="0" /><path+ style="fill:none;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 24.25,33.5 c 0,-21 0,-21 0,-21"+ id="path4535-9-1-4"+ inkscape:connector-curvature="0" /><path+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#484848;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"+ d="m 45.25,33.5 c 0,-21 0,-21 0,-21"+ id="path4535-9-9-5"+ inkscape:connector-curvature="0" /><g+ aria-label="A"+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.66666675px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none"+ id="text4670"><path+ d="m 14.755209,15 h -0.27474 L 14.290365,14.459635 H 13.451824 L 13.261719,15 h -0.261718 l 0.705729,-1.938802 h 0.34375 z m -0.544271,-0.761719 -0.339844,-0.951823 -0.341145,0.951823 z"+ style=""+ id="path4775" /></g><g+ aria-label="B"+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.66666675px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none"+ id="text4670-1"><path+ d="m 21.488802,14.403646 q 0,0.144531 -0.05469,0.255208 -0.05469,0.110677 -0.147136,0.182292 -0.109375,0.08594 -0.240885,0.122396 Q 20.915885,15 20.714062,15 h -0.6875 v -1.938802 h 0.574219 q 0.21224,0 0.317708,0.01563 0.105469,0.01563 0.201823,0.0651 0.106771,0.05599 0.154948,0.144531 0.04818,0.08724 0.04818,0.209636 0,0.138021 -0.07031,0.235677 -0.07031,0.09635 -0.1875,0.154948 v 0.01042 q 0.196615,0.04036 0.309896,0.173177 0.113281,0.131511 0.113281,0.333334 z m -0.433594,-0.873698 q 0,-0.07031 -0.02344,-0.11849 -0.02344,-0.04818 -0.07552,-0.07813 -0.0612,-0.03516 -0.148438,-0.04297 -0.08724,-0.0091 -0.216145,-0.0091 h -0.307292 v 0.559896 h 0.333333 q 0.121094,0 0.192709,-0.01172 0.07161,-0.01302 0.132812,-0.05208 0.0612,-0.03906 0.08594,-0.100261 0.02604,-0.0625 0.02604,-0.147135 z m 0.165365,0.884114 q 0,-0.117187 -0.03516,-0.186197 -0.03516,-0.06901 -0.127605,-0.117188 -0.0625,-0.03255 -0.152343,-0.04167 -0.08854,-0.01042 -0.216146,-0.01042 h -0.404948 v 0.721354 h 0.341146 q 0.169271,0 0.277343,-0.01693 0.108073,-0.01823 0.177084,-0.0651 0.07292,-0.05078 0.106771,-0.115886 0.03385,-0.0651 0.03385,-0.167969 z"+ style=""+ id="path4772" /></g><g+ aria-label="C"+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.66666675px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none"+ id="text4670-0"><path+ d="m 28.523958,14.859375 q -0.07161,0.03125 -0.130208,0.05859 -0.05729,0.02734 -0.151042,0.05729 -0.07943,0.02474 -0.173177,0.04167 -0.09245,0.01823 -0.204427,0.01823 -0.210937,0 -0.384115,-0.05859 -0.171875,-0.05989 -0.299479,-0.186197 -0.125,-0.123698 -0.195312,-0.313803 -0.07031,-0.191406 -0.07031,-0.44401 0,-0.239583 0.06771,-0.428385 0.06771,-0.188802 0.195312,-0.319011 0.123698,-0.126302 0.298177,-0.192708 0.175781,-0.06641 0.389323,-0.06641 0.15625,0 0.311198,0.03776 0.15625,0.03776 0.346354,0.132813 v 0.305989 h -0.01953 q -0.160156,-0.134114 -0.317708,-0.195312 -0.157552,-0.0612 -0.33724,-0.0612 -0.147135,0 -0.265625,0.04818 -0.117187,0.04687 -0.209635,0.147135 -0.08984,0.09766 -0.140625,0.247396 -0.04948,0.148438 -0.04948,0.34375 0,0.204427 0.05469,0.351563 0.05599,0.147135 0.143229,0.239583 0.09115,0.09635 0.21224,0.143229 0.122396,0.04557 0.257812,0.04557 0.186198,0 0.348959,-0.0638 0.16276,-0.0638 0.304687,-0.191406 h 0.01823 z"+ style=""+ id="path4769" /></g><g+ aria-label="D"+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.66666675px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none"+ id="text4670-1-0"><path+ d="m 35.664585,14.032552 q 0,0.264323 -0.115885,0.479167 -0.114584,0.214843 -0.30599,0.333333 -0.132812,0.08203 -0.296875,0.11849 Q 34.783075,15 34.516148,15 h -0.489584 v -1.938802 h 0.484375 q 0.283854,0 0.450521,0.04167 0.167969,0.04036 0.283854,0.111979 0.197917,0.123698 0.308594,0.329427 0.110677,0.205729 0.110677,0.488281 z m -0.269531,-0.0039 q 0,-0.227865 -0.07943,-0.384115 -0.07943,-0.15625 -0.236979,-0.246094 -0.114584,-0.0651 -0.24349,-0.08984 -0.128906,-0.02604 -0.308594,-0.02604 h -0.242187 v 1.496094 h 0.242187 q 0.186198,0 0.324219,-0.02734 0.139323,-0.02734 0.255208,-0.101562 0.144532,-0.09245 0.216146,-0.24349 0.07292,-0.151042 0.07292,-0.377604 z"+ style=""+ id="path4766" /></g><g+ aria-label="E"+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.66666675px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none"+ id="text4670-1-0-2"><path+ d="m 42.303908,15 h -1.277344 v -1.938802 h 1.277344 v 0.229167 h -1.019531 v 0.53125 h 1.019531 v 0.229166 h -1.019531 v 0.720052 h 1.019531 z"+ style=""+ id="path4763" /></g><g+ aria-label="Action"+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.66666675px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#484848;fill-opacity:1;stroke:none"+ id="text4670-10"><path+ d="m 28.233725,11.649905 h -0.27474 l -0.190104,-0.540364 h -0.838542 l -0.190104,0.540364 h -0.261719 l 0.705729,-1.9388019 h 0.34375 z M 27.689454,10.888186 27.34961,9.9363635 27.008464,10.888186 Z"+ style=""+ id="path4750" /><path+ d="m 29.583985,11.558759 q -0.122396,0.05859 -0.233073,0.09115 -0.109375,0.03255 -0.233073,0.03255 -0.157552,0 -0.289062,-0.04557 -0.131511,-0.04687 -0.225261,-0.140625 -0.09505,-0.09375 -0.147135,-0.236979 -0.05208,-0.143229 -0.05208,-0.334635 0,-0.356771 0.195312,-0.559896 0.196615,-0.203125 0.518229,-0.203125 0.125,0 0.244792,0.03516 0.121094,0.03516 0.221354,0.08594 v 0.272135 h -0.01302 q -0.111979,-0.08724 -0.231771,-0.134114 -0.118489,-0.04687 -0.23177,-0.04687 -0.208334,0 -0.329427,0.140625 -0.119792,0.139322 -0.119792,0.410156 0,0.263021 0.117187,0.404948 0.11849,0.140625 0.332032,0.140625 0.07422,0 0.151041,-0.01953 0.07682,-0.01953 0.138021,-0.05078 0.05339,-0.02734 0.100261,-0.05729 0.04687,-0.03125 0.07422,-0.05339 h 0.01302 z"+ style=""+ id="path4752" /><path+ d="m 30.654298,11.636884 q -0.06901,0.01823 -0.151042,0.02995 -0.08073,0.01172 -0.144531,0.01172 -0.222657,0 -0.338542,-0.119792 -0.115885,-0.119791 -0.115885,-0.384114 v -0.773438 h -0.165365 v -0.205729 h 0.165365 V 9.7775093 h 0.244791 v 0.4179687 h 0.505209 v 0.205729 h -0.505209 v 0.662761 q 0,0.114583 0.0052,0.179687 0.0052,0.0638 0.03646,0.119792 0.02865,0.05208 0.07813,0.07682 0.05078,0.02344 0.153646,0.02344 0.0599,0 0.125,-0.01693 0.0651,-0.01823 0.09375,-0.02995 h 0.01302 z"+ style=""+ id="path4754" /><path+ d="M 31.214193,9.9519885 H 30.938152 V 9.6980822 h 0.276041 z m -0.01563,1.6979165 h -0.244791 v -1.454427 h 0.244791 z"+ style=""+ id="path4756" /><path+ d="m 32.925131,10.923343 q 0,0.355468 -0.182292,0.561198 -0.182291,0.205729 -0.488281,0.205729 -0.308594,0 -0.490885,-0.205729 -0.18099,-0.20573 -0.18099,-0.561198 0,-0.355469 0.18099,-0.561198 0.182291,-0.207032 0.490885,-0.207032 0.30599,0 0.488281,0.207032 0.182292,0.205729 0.182292,0.561198 z m -0.252604,0 q 0,-0.282552 -0.110677,-0.419271 -0.110677,-0.138021 -0.307292,-0.138021 -0.199219,0 -0.309896,0.138021 -0.109375,0.136719 -0.109375,0.419271 0,0.273437 0.110677,0.415364 0.110677,0.140625 0.308594,0.140625 0.195312,0 0.30599,-0.139323 0.111979,-0.140625 0.111979,-0.416666 z"+ style=""+ id="path4758" /><path+ d="M 34.521485,11.649905 H 34.276694 V 10.82178 q 0,-0.10026 -0.01172,-0.1875 -0.01172,-0.08854 -0.04297,-0.138021 -0.03255,-0.05469 -0.09375,-0.08073 -0.0612,-0.02734 -0.158854,-0.02734 -0.10026,0 -0.209635,0.04948 -0.109375,0.04948 -0.209636,0.126302 v 1.085937 H 33.30534 v -1.454427 h 0.244791 v 0.161458 q 0.114584,-0.09505 0.236979,-0.148437 0.122396,-0.05339 0.251302,-0.05339 0.235678,0 0.359375,0.141928 0.123698,0.141927 0.123698,0.408854 z"+ style=""+ id="path4760" /></g></svg>\ No newline at end of filediff --git a/toonz/sources/toonz/filebrowserpopup.cpp b/toonz/sources/toonz/filebrowserpopup.cppindex 099984845..9e127c7e0 100644--- a/toonz/sources/toonz/filebrowserpopup.cpp+++ b/toonz/sources/toonz/filebrowserpopup.cpp@@ -496,6 +496,7 @@ TFilePath GenericSaveFilePopup::getPath() {LoadScenePopup::LoadScenePopup() : FileBrowserPopup(tr("Load Scene")) {setOkText(tr("Load"));addFilterType("tnz");+ addFilterType("xdts");// set the initial current path according to the current modulesetInitialFolderByCurrentRoom();@@ -509,7 +510,7 @@ bool LoadScenePopup::execute() {const TFilePath &fp = *m_selectedPaths.begin();- if (fp.getType() != "tnz") {+ if (fp.getType() != "tnz" && fp.getType() != "xdts") {DVGui::error(toQString(fp) + tr(" is not a scene file."));return false;}@@ -1235,6 +1236,7 @@ bool LoadLevelPopup::execute() {}return 0 < IoCmd::loadResources(args, true, 0);+} else {std::set<TFilePath>::const_iterator it;IoCmd::LoadResourceArguments args;diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cppindex 77267ca49..7e056ed37 100644--- a/toonz/sources/toonz/iocommand.cpp+++ b/toonz/sources/toonz/iocommand.cpp@@ -19,6 +19,7 @@#include "filebrowser.h"#include "versioncontrol.h"#include "cachefxcommand.h"+#include "xdtsio.h"// TnzTools includes#include "tools/toolhandle.h"@@ -1758,8 +1759,9 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,assert(!path.isEmpty());TFilePath scenePath = path;bool importScene = false;+ bool isXdts = scenePath.getType() == "xdts";if (scenePath.getType() == "") scenePath = scenePath.withType("tnz");- if (scenePath.getType() != "tnz") {+ if (scenePath.getType() != "tnz" && !isXdts) {QString msg;msg = QObject::tr("File %1 doesn't look like a TOONZ Scene").arg(QString::fromStdWString(scenePath.getWideString()));@@ -1846,8 +1848,11 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,TImageStyle::setCurrentScene(scene);printf("%s:%s Progressing:\n", __FILE__, __FUNCTION__);try {- /*-- プログレス表示を行いながらLoad --*/- scene->load(scenePath);+ if (isXdts)+ XdtsIo::loadXdtsScene(scene, scenePath);+ else+ /*-- プログレス表示を行いながらLoad --*/+ scene->load(scenePath);// import if neededTProjectManager *pm = TProjectManager::instance();TProjectP currentProject = pm->getCurrentProject();@@ -1912,7 +1917,7 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,scene->getProperties()->getFieldGuideAspectRatio());IconGenerator::instance()->invalidateSceneIcon();DvDirModel::instance()->refreshFolder(scenePath.getParentDir());- TApp::instance()->getCurrentScene()->setDirtyFlag(false);+ TApp::instance()->getCurrentScene()->setDirtyFlag(isXdts);History::instance()->addItem(scenePath);if (updateRecentFile)RecentFiles::instance()->addFilePath(@@ -1994,11 +1999,9 @@ bool IoCmd::loadScene() {static LoadScenePopup *popup = 0;if (!popup) {popup = new LoadScenePopup();- popup->addFilterType("tnz");}int ret = popup->exec();if (ret == QDialog::Accepted) {- TApp::instance()->getCurrentScene()->setDirtyFlag(false);return true;} else {TApp::instance()->getCurrentSelection()->setSelection(oldSelection);diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cppindex 733e8bdcb..5bda0cf9b 100644--- a/toonz/sources/toonz/mainwindow.cpp+++ b/toonz/sources/toonz/mainwindow.cpp@@ -1603,6 +1603,8 @@ void MainWindow::defineActions() {preferencesAction->setIcon(QIcon(":Resources/preferences.svg"));createMenuFileAction(MI_ShortcutPopup, tr("&Configure Shortcuts..."), "");createMenuFileAction(MI_PrintXsheet, tr("&Print Xsheet"), "");+ createMenuFileAction(MI_ExportXDTS,+ tr("Export Exchange Digital Time Sheet (XDTS)"), "");createMenuFileAction("MI_RunScript", tr("Run Script..."), "");createMenuFileAction("MI_OpenScriptConsole", tr("Open Script Console..."),"");diff --git a/toonz/sources/toonz/menubarcommandids.h b/toonz/sources/toonz/menubarcommandids.hindex d6cb12113..18467061f 100644--- a/toonz/sources/toonz/menubarcommandids.h+++ b/toonz/sources/toonz/menubarcommandids.h@@ -372,4 +372,5 @@#define MI_SelectBothGuideStrokes "MI_SelectBothGuideStrokes"#define MI_SelectGuidesAndTweenMode "MI_SelectGuidesAndTweenMode"+#define MI_ExportXDTS "MI_ExportXDTS"#endifdiff --git a/toonz/sources/toonz/toonz.qrc b/toonz/sources/toonz/toonz.qrcindex a542e2fa8..2a15dc34e 100644--- a/toonz/sources/toonz/toonz.qrc+++ b/toonz/sources/toonz/toonz.qrc@@ -484,5 +484,6 @@<file>Resources/flipvert_over.svg</file><file>Resources/reset.svg</file><file>Resources/reset_over.svg</file>+ <file>Resources/xdts.svg</file></qresource></RCC>diff --git a/toonz/sources/toonz/xdtsimportpopup.cpp b/toonz/sources/toonz/xdtsimportpopup.cppnew file mode 100644index 000000000..40f149e5a--- /dev/null+++ b/toonz/sources/toonz/xdtsimportpopup.cpp@@ -0,0 +1,152 @@+#include "xdtsimportpopup.h"++#include "tapp.h"+#include "tsystem.h"+#include "toonzqt/filefield.h"+#include "toonz/toonzscene.h"++#include <QMainWindow>+#include <QTableView>+#include <QPushButton>+#include <QScrollArea>+#include <QGridLayout>+#include <QLabel>++using namespace DVGui;++XDTSImportPopup::XDTSImportPopup(QStringList levelNames, ToonzScene* scene,+ TFilePath scenePath)+ : m_scene(scene)+ , DVGui::Dialog(TApp::instance()->getMainWindow(), true, false,+ "XDTSImport") {+ setWindowTitle(tr("Importing XDTS file %1")+ .arg(QString::fromStdString(scenePath.getLevelName())));+ QPushButton* loadButton = new QPushButton(tr("Load"), this);+ QPushButton* cancelButton = new QPushButton(tr("Cancel"), this);++ QString description =+ tr("Please specify the level locations. Suggested paths "+ "are input in the fields with blue border.");++ m_topLayout->addWidget(new QLabel(description, this), 0);+ m_topLayout->addSpacing(15);++ QScrollArea* fieldsArea = new QScrollArea(this);+ fieldsArea->setWidgetResizable(true);++ QWidget* fieldsWidget = new QWidget(this);++ QGridLayout* fieldsLay = new QGridLayout();+ fieldsLay->setMargin(0);+ fieldsLay->setHorizontalSpacing(10);+ fieldsLay->setVerticalSpacing(10);+ fieldsLay->addWidget(new QLabel(tr("Level Name"), this), 0, 0,+ Qt::AlignLeft | Qt::AlignVCenter);+ fieldsLay->addWidget(new QLabel(tr("Level Path"), this), 0, 1,+ Qt::AlignLeft | Qt::AlignVCenter);+ for (QString& levelName : levelNames) {+ int row = fieldsLay->rowCount();+ fieldsLay->addWidget(new QLabel(levelName, this), row, 0,+ Qt::AlignRight | Qt::AlignVCenter);+ FileField* fileField = new FileField(this);+ fieldsLay->addWidget(fileField, row, 1);+ m_fields.insert(levelName, fileField);+ fileField->setFileMode(QFileDialog::AnyFile);+ fileField->setObjectName("SuggestiveFileField");+ connect(fileField, SIGNAL(pathChanged()), this, SLOT(onPathChanged()));+ }+ fieldsLay->setColumnStretch(1, 1);+ fieldsLay->setRowStretch(fieldsLay->rowCount(), 1);++ fieldsWidget->setLayout(fieldsLay);+ fieldsArea->setWidget(fieldsWidget);+ m_topLayout->addWidget(fieldsArea, 1);++ connect(loadButton, SIGNAL(clicked()), this, SLOT(accept()));+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));++ addButtonBarWidget(cancelButton, loadButton);++ updateSuggestions(scenePath.getQString());+}++//-----------------------------------------------------------------------------++void XDTSImportPopup::onPathChanged() {+ FileField* fileField = dynamic_cast<FileField*>(sender());+ if (!fileField) return;+ // make the field non-suggestive+ m_pathSuggestedLevels.removeAll(m_fields.key(fileField));+ updateSuggestions(fileField->getPath());+}++//-----------------------------------------------------------------------------++void XDTSImportPopup::updateSuggestions(const QString samplePath) {+ TFilePath fp(samplePath);+ fp = m_scene->decodeFilePath(fp).getParentDir();+ QDir suggestFolder(fp.getQString());+ QStringList filters;+ filters << "*.bmp"+ << "*.jpg"+ << "*.nol"+ << "*.pic"+ << "*.pict"+ << "*.pct"+ << "*.png"+ << "*.rgb"+ << "*.sgi"+ << "*.tga"+ << "*.tif"+ << "*.tiff"+ << "*.tlv"+ << "*.pli"+ << "*.psd";+ suggestFolder.setNameFilters(filters);+ suggestFolder.setFilter(QDir::Files);+ TFilePathSet pathSet;+ try {+ TSystem::readDirectory(pathSet, suggestFolder, true);+ } catch (...) {+ return;+ }++ QMap<QString, FileField*>::iterator fieldsItr = m_fields.begin();+ while (fieldsItr != m_fields.end()) {+ QString levelName = fieldsItr.key();+ FileField* fileField = fieldsItr.value();+ // check if the field can be filled with suggestion+ if (fileField->getPath().isEmpty() ||+ m_pathSuggestedLevels.contains(levelName)) {+ // input suggestion if there is a file with the same level name+ for (TFilePath path : pathSet) {+ if (path.getName() == levelName.toStdString()) {+ TFilePath codedPath = m_scene->codeFilePath(path);+ fileField->setPath(codedPath.getQString());+ if (!m_pathSuggestedLevels.contains(levelName))+ m_pathSuggestedLevels.append(levelName);+ break;+ }+ }+ }+ ++fieldsItr;+ }++ // repaint fields+ fieldsItr = m_fields.begin();+ while (fieldsItr != m_fields.end()) {+ if (m_pathSuggestedLevels.contains(fieldsItr.key()))+ fieldsItr.value()->setStyleSheet(+ QString("#SuggestiveFileField "+ "QLineEdit{border-color:#2255aa;border-width:2px;}"));+ else+ fieldsItr.value()->setStyleSheet(QString(""));+ ++fieldsItr;+ }+}++QString XDTSImportPopup::getLevelPath(QString levelName) {+ FileField* field = m_fields.value(levelName);+ if (!field) return QString();+ return field->getPath();+}\ No newline at end of filediff --git a/toonz/sources/toonz/xdtsimportpopup.h b/toonz/sources/toonz/xdtsimportpopup.hnew file mode 100644index 000000000..a185d25f0--- /dev/null+++ b/toonz/sources/toonz/xdtsimportpopup.h@@ -0,0 +1,30 @@+#pragma once+#ifndef XDTSIMPORTPOPUP_H+#define XDTSIMPORTPOPUP_H++#include "toonzqt/dvdialog.h"+#include "tfilepath.h"++#include <QMap>+namespace DVGui {+class FileField;+}+class ToonzScene;++class XDTSImportPopup : public DVGui::Dialog {+ Q_OBJECT+ QMap<QString, DVGui::FileField *> m_fields;+ QStringList m_pathSuggestedLevels;+ ToonzScene *m_scene;++ void updateSuggestions(const QString samplePath);++public:+ XDTSImportPopup(QStringList levelNames, ToonzScene *scene,+ TFilePath scenePath);+ QString getLevelPath(QString levelName);+protected slots:+ void onPathChanged();+};++#endif\ No newline at end of filediff --git a/toonz/sources/toonz/xdtsio.cpp b/toonz/sources/toonz/xdtsio.cppnew file mode 100644index 000000000..71f8caf56--- /dev/null+++ b/toonz/sources/toonz/xdtsio.cpp@@ -0,0 +1,527 @@+#include "xdtsio.h"++#include "tsystem.h"+#include "toonz/toonzscene.h"+#include "toonz/tproject.h"+#include "toonz/levelset.h"+#include "toonz/txsheet.h"+#include "toonz/txshcell.h"+#include "toonz/txshsimplelevel.h"+#include "toonz/txsheethandle.h"+#include "toonz/tscenehandle.h"+#include "toonz/preferences.h"++#include "toonzqt/menubarcommand.h"+#include "toonzqt/gutil.h"++#include "tapp.h"+#include "menubarcommandids.h"+#include "xdtsimportpopup.h"++#include <iostream>+#include <QJsonObject>+#include <QJsonArray>+#include <QRegExp>+#include <QFile>+#include <QJsonDocument>+#include <QApplication>+#include <QDesktopServices>+#include <QUrl>+using namespace XdtsIo;+namespace {+static QByteArray identifierStr("exchangeDigitalTimeSheet Save Data");+}+//-----------------------------------------------------------------------------+void XdtsHeader::read(const QJsonObject &json) {+ QRegExp rx("\\d{1,4}");+ // TODO: We could check if the keys are valid+ // before attempting to read them with QJsonObject::contains(),+ // but we assume that they are.+ m_cut = json["cut"].toString();+ if (!rx.exactMatch(m_cut)) // TODO: should handle an error+ std::cout << "The XdtsHeader value \"cut\" does not match the pattern."+ << std::endl;+ m_scene = json["scene"].toString();+ if (!rx.exactMatch(m_scene))+ std::cout << "The XdtsHeader value \"scene\" does not match the pattern."+ << std::endl;+}++void XdtsHeader::write(QJsonObject &json) const {+ json["cut"] = m_cut;+ json["scene"] = m_scene;+}++//-----------------------------------------------------------------------------++void XdtsFrameDataItem::read(const QJsonObject &json) {+ m_id = DataId(qRound(json["id"].toDouble()));+ QJsonArray valuesArray = json["values"].toArray();+ for (int vIndex = 0; vIndex < valuesArray.size(); ++vIndex) {+ m_values.append(valuesArray[vIndex].toString());+ }+}++void XdtsFrameDataItem::write(QJsonObject &json) const {+ json["id"] = int(m_id);+ QJsonArray valuesArray;+ foreach (const QString &value, m_values) { valuesArray.append(value); }+ json["values"] = valuesArray;+}++//-----------------------------------------------------------------------------+void XdtsTrackFrameItem::read(const QJsonObject &json) {+ QJsonArray dataArray = json["data"].toArray();+ for (int dataIndex = 0; dataIndex < dataArray.size(); ++dataIndex) {+ QJsonObject dataObject = dataArray[dataIndex].toObject();+ XdtsFrameDataItem data;+ data.read(dataObject);+ m_data.append(data);+ }+ m_frame = json["frame"].toInt();+}++void XdtsTrackFrameItem::write(QJsonObject &json) const {+ QJsonArray dataArray;+ foreach (const XdtsFrameDataItem &data, m_data) {+ QJsonObject dataObject;+ data.write(dataObject);+ dataArray.append(dataObject);+ }+ json["data"] = dataArray;++ json["frame"] = m_frame;+}++//-----------------------------------------------------------------------------++QPair<int, int> XdtsTrackFrameItem::frameCellNumber() const {+ return QPair<int, int>(m_frame, m_data[0].getCellNumber());+}++//-----------------------------------------------------------------------------+void XdtsFieldTrackItem::read(const QJsonObject &json) {+ QJsonArray frameArray = json["frames"].toArray();+ for (int frameIndex = 0; frameIndex < frameArray.size(); ++frameIndex) {+ QJsonObject frameObject = frameArray[frameIndex].toObject();+ XdtsTrackFrameItem frame;+ frame.read(frameObject);+ m_frames.append(frame);+ }+ m_trackNo = json["trackNo"].toInt();+}++void XdtsFieldTrackItem::write(QJsonObject &json) const {+ QJsonArray frameArray;+ foreach (const XdtsTrackFrameItem &frame, m_frames) {+ QJsonObject frameObject;+ frame.write(frameObject);+ frameArray.append(frameObject);+ }+ json["frames"] = frameArray;++ json["trackNo"] = m_trackNo;+}+//-----------------------------------------------------------------------------++bool frameLessThan(const QPair<int, int> &v1, const QPair<int, int> &v2) {+ return v1.first < v2.first;+}++QVector<int> XdtsFieldTrackItem::getCellNumberTrack() const {+ QList<QPair<int, int>> frameCellNumbers;+ for (const XdtsTrackFrameItem &frame : m_frames)+ frameCellNumbers.append(frame.frameCellNumber());+ qSort(frameCellNumbers.begin(), frameCellNumbers.end(), frameLessThan);++ QVector<int> cells;+ int currentFrame = 0;+ for (QPair<int, int> &frameCellNumber : frameCellNumbers) {+ while (currentFrame < frameCellNumber.first) {+ cells.append((cells.isEmpty()) ? 0 : cells.last());+ currentFrame++;+ }+ // ignore sheet symbols for now+ int cellNumber = frameCellNumber.second;+ if (cellNumber == -1)+ cells.append((cells.isEmpty()) ? 0 : cells.last());+ else+ cells.append(cellNumber);+ currentFrame++;+ }+ return cells;+}++QString XdtsFieldTrackItem::build(TXshCellColumn *column, int duration) {+ // register the firstly-found level+ TXshSimpleLevel *level = nullptr;+ TXshCell prevCell;+ int r0, r1;+ column->getRange(r0, r1);+ if (r0 > 0) addFrame(0, 0);+ for (int row = r0; row <= r1; row++) {+ TXshCell cell = column->getCell(row);+ // try to register the level+ if (!level && cell.getSimpleLevel()) level = cell.getSimpleLevel();+ // if the level does not match with the registered one,+ // handle as the empty cell+ if (!level || cell.m_level != level) cell = TXshCell();+ // continue if the cell is continuous+ if (prevCell == cell) continue;++ if (cell.isEmpty())+ addFrame(row, 0);+ else+ addFrame(row, cell.getFrameId().getNumber());++ prevCell = cell;+ }+ if (r1 + 1 < duration) addFrame(r1 + 1, 0);+ if (level)+ return QString::fromStdWString(level->getName());+ else {+ m_frames.clear();+ return QString();+ }+}+//-----------------------------------------------------------------------------++void XdtsTimeTableFieldItem::read(const QJsonObject &json) {+ m_fieldId = FieldId(qRound(json["fieldId"].toDouble()));+ QJsonArray trackArray = json["tracks"].toArray();+ for (int trackIndex = 0; trackIndex < trackArray.size(); ++trackIndex) {+ QJsonObject trackObject = trackArray[trackIndex].toObject();+ XdtsFieldTrackItem track;+ track.read(trackObject);+ m_tracks.append(track);+ }+}++void XdtsTimeTableFieldItem::write(QJsonObject &json) const {+ json["fieldId"] = int(m_fieldId);+ QJsonArray trackArray;+ foreach (const XdtsFieldTrackItem &track, m_tracks) {+ QJsonObject trackObject;+ track.write(trackObject);+ trackArray.append(trackObject);+ }+ json["tracks"] = trackArray;+}++QList<int> XdtsTimeTableFieldItem::getOccupiedColumns() const {+ QList<int> ret;+ for (const XdtsFieldTrackItem &track : m_tracks) {+ if (!track.isEmpty()) ret.append(track.getTrackNo());+ }+ return ret;+}++QVector<int> XdtsTimeTableFieldItem::getColumnTrack(int col) const {+ for (const XdtsFieldTrackItem &track : m_tracks) {+ if (track.getTrackNo() != col) continue;+ return track.getCellNumberTrack();+ }+ return QVector<int>();+}++void XdtsTimeTableFieldItem::build(TXsheet *xsheet, int duration,+ QStringList &columnLabels) {+ m_fieldId = CELL;+ for (int col = 0; col < xsheet->getFirstFreeColumnIndex(); col++) {+ if (xsheet->isColumnEmpty(col)) {+ columnLabels.append("");+ continue;+ }+ TXshCellColumn *column = xsheet->getColumn(col)->getCellColumn();+ if (!column) {+ columnLabels.append("");+ continue;+ }+ XdtsFieldTrackItem track(col);+ columnLabels.append(track.build(column, duration));+ if (!track.isEmpty()) m_tracks.append(track);+ }+}+//-----------------------------------------------------------------------------++void XdtsTimeTableHeaderItem::read(const QJsonObject &json) {+ m_fieldId = FieldId(qRound(json["fieldId"].toDouble()));+ QJsonArray namesArray = json["names"].toArray();+ for (int nIndex = 0; nIndex < namesArray.size(); ++nIndex) {+ m_names.append(namesArray[nIndex].toString());+ }+}++void XdtsTimeTableHeaderItem::write(QJsonObject &json) const {+ json["fieldId"] = int(m_fieldId);+ QJsonArray namesArray;+ foreach (const QString name, m_names) { namesArray.append(name); }+ json["names"] = namesArray;+}++void XdtsTimeTableHeaderItem::build(QStringList &columnLabels) {+ m_names.append(columnLabels);+}++//-----------------------------------------------------------------------------++void XdtsTimeTableItem::read(const QJsonObject &json) {+ if (json.contains("fields")) {+ QJsonArray fieldArray = json["fields"].toArray();+ for (int fieldIndex = 0; fieldIndex < fieldArray.size(); ++fieldIndex) {+ QJsonObject fieldObject = fieldArray[fieldIndex].toObject();+ XdtsTimeTableFieldItem field;+ field.read(fieldObject);+ m_fields.append(field);+ if (field.isCellField()) m_cellFieldIndex = fieldIndex;+ }+ }+ m_duration = json["duration"].toInt();+ m_name = json["name"].toString();+ QJsonArray headerArray = json["timeTableHeaders"].toArray();+ for (int headerIndex = 0; headerIndex < headerArray.size(); ++headerIndex) {+ QJsonObject headerObject = headerArray[headerIndex].toObject();+ XdtsTimeTableHeaderItem header;+ header.read(headerObject);+ m_timeTableHeaders.append(header);+ if (header.isCellField()) m_cellHeaderIndex = headerIndex;+ }+}++void XdtsTimeTableItem::write(QJsonObject &json) const {+ if (!m_fields.isEmpty()) {+ QJsonArray fieldArray;+ foreach (const XdtsTimeTableFieldItem &field, m_fields) {+ QJsonObject fieldObject;+ field.write(fieldObject);+ fieldArray.append(fieldObject);+ }+ json["fields"] = fieldArray;+ }+ json["duration"] = m_duration;+ json["name"] = m_name;+ QJsonArray headerArray;+ foreach (const XdtsTimeTableHeaderItem header, m_timeTableHeaders) {+ QJsonObject headerObject;+ header.write(headerObject);+ headerArray.append(headerObject);+ }+ json["timeTableHeaders"] = headerArray;+}++QStringList XdtsTimeTableItem::getLevelNames() const {+ // obtain column labels from the header+ assert(m_cellHeaderIndex >= 0);+ QStringList labels = m_timeTableHeaders.at(m_cellHeaderIndex).getLayerNames();+ // obtain occupied column numbers in the field+ assert(m_cellFieldIndex >= 0);+ QList<int> occupiedColumns =+ m_fields.at(m_cellFieldIndex).getOccupiedColumns();+ // return the names of occupied columns+ QStringList ret;+ for (const int columnId : occupiedColumns) ret.append(labels.at(columnId));+ return ret;+}++void XdtsTimeTableItem::build(TXsheet *xsheet, QString name) {+ m_duration = xsheet->getFrameCount();+ m_name = name;+ QStringList columnLabels;+ XdtsTimeTableFieldItem field;+ field.build(xsheet, m_duration, columnLabels);+ m_fields.append(field);+ while (columnLabels.last().isEmpty()) columnLabels.removeLast();+ XdtsTimeTableHeaderItem header;+ header.build(columnLabels);+ m_timeTableHeaders.append(header);+ m_cellHeaderIndex = 0;+ m_cellFieldIndex = 0;+}+//-----------------------------------------------------------------------------++void XdtsData::read(const QJsonObject &json) {+ if (json.contains("header")) {+ QJsonObject headerObject = json["header"].toObject();+ m_header.read(headerObject);+ }+ QJsonArray tableArray = json["timeTables"].toArray();+ for (int tableIndex = 0; tableIndex < tableArray.size(); ++tableIndex) {+ QJsonObject tableObject = tableArray[tableIndex].toObject();+ XdtsTimeTableItem table;+ table.read(tableObject);+ m_timeTables.append(table);+ }+ m_version = Version(qRound(json["version"].toDouble()));+}++void XdtsData::write(QJsonObject &json) const {+ if (!m_header.isEmpty()) {+ QJsonObject headerObject;+ m_header.write(headerObject);+ json["header"] = headerObject;+ }+ QJsonArray tableArray;+ foreach (const XdtsTimeTableItem &table, m_timeTables) {+ QJsonObject tableObject;+ table.write(tableObject);+ tableArray.append(tableObject);+ }+ json["timeTables"] = tableArray;+ json["version"] = int(m_version);+}++QStringList XdtsData::getLevelNames() const {+ // currently support only the first page of time tables+ return m_timeTables.at(0).getLevelNames();+}++void XdtsData::build(TXsheet *xsheet, QString name) {+ XdtsTimeTableItem timeTable;+ timeTable.build(xsheet, name);+ m_timeTables.append(timeTable);+}++//-----------------------------------------------------------------------------++bool XdtsIo::loadXdtsScene(ToonzScene *scene, const TFilePath &scenePath) {+ QApplication::restoreOverrideCursor();+ // read the Json file+ QFile loadFile(scenePath.getQString());+ if (!loadFile.open(QIODevice::ReadOnly)) {+ qWarning("Couldn't open save file.");+ return false;+ }++ QByteArray dataArray = loadFile.readAll();++ if (!dataArray.startsWith(identifierStr)) {+ qWarning("The first line does not start with XDTS identifier string.");+ return false;+ }+ // remove identifier+ dataArray.remove(0, identifierStr.length());++ QJsonDocument loadDoc(QJsonDocument::fromJson(dataArray));++ XdtsData xdtsData;+ xdtsData.read(loadDoc.object());++ // obtain level names+ QStringList levelNames = xdtsData.getLevelNames();++ scene->clear();++ TProjectManager *pm = TProjectManager::instance();+ TProjectP sceneProject = pm->loadSceneProject(scenePath);+ if (!sceneProject) return false;+ scene->setProject(sceneProject.getPointer());+ std::string sceneFileName = scenePath.getName() + ".tnz";+ scene->setScenePath(scenePath.getParentDir() + sceneFileName);+ TApp::instance()->getCurrentScene()->setScene(scene);++ XDTSImportPopup popup(levelNames, scene, scenePath);++ int ret = popup.exec();+ if (ret == QDialog::Rejected) return false;++ QMap<QString, TXshLevel *> levels;+ try {+ for (QString name : levelNames) {+ QString levelPath = popup.getLevelPath(name);+ TXshLevel *level = nullptr;+ if (!levelPath.isEmpty())+ level = scene->loadLevel(scene->decodeFilePath(TFilePath(levelPath)),+ nullptr, name.toStdWString());+ if (!level) {+ int levelType = Preferences::instance()->getDefLevelType();+ level = scene->createNewLevel(levelType, name.toStdWString());+ }+ levels.insert(name, level);+ }+ } catch (...) {+ return false;+ }++ TXsheet *xsh = scene->getXsheet();+ XdtsTimeTableFieldItem cellField = xdtsData.timeTable().getCellField();+ XdtsTimeTableHeaderItem cellHeader = xdtsData.timeTable().getCellHeader();+ int duration = xdtsData.timeTable().getDuration();+ QStringList layerNames = cellHeader.getLayerNames();+ QList<int> columns = cellField.getOccupiedColumns();+ for (int column : columns) {+ QString levelName = layerNames.at(column);+ TXshLevel *level = levels.value(levelName);+ QVector<int> track = cellField.getColumnTrack(column);++ int row = 0;+ std::vector<TFrameId>::iterator it;+ for (int f : track) {+ if (f == 0) // empty cell+ row++;+ else+ xsh->setCell(row++, column, TXshCell(level, TFrameId(f)));+ }+ // if the last cell is not "SYMBOL_NULL_CELL", continue the cell+ // to the end of the sheet+ int lastFid = track.last();+ if (lastFid != 0) {+ for (; row < duration; row++)+ xsh->setCell(row, column, TXshCell(level, TFrameId(lastFid)));+ }+ }+ xsh->updateFrameCount();++ return true;+}++class ExportXDTSCommand final : public MenuItemHandler {+public:+ ExportXDTSCommand() : MenuItemHandler(MI_ExportXDTS) {}+ void execute() override;+} exportXDTSCommand;++void ExportXDTSCommand::execute() {+ ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();+ TXsheet *xsheet = TApp::instance()->getCurrentXsheet()->getXsheet();+ TFilePath fp = scene->getScenePath().withType("xdts");+ if (TSystem::doesExistFileOrLevel(fp)) {+ QString question =+ QObject::tr("The file %1 already exists.\nDo you want to overwrite it?")+ .arg(toQString(fp));+ int ret = DVGui::MsgBox(question, QObject::tr("Overwrite"),+ QObject::tr("Cancel"), 0);+ if (ret == 2 || ret == 0) return;+ }++ XdtsData xdtsData;+ xdtsData.build(xsheet, QString::fromStdString(fp.getName()));++ QFile saveFile(fp.getQString());++ if (!saveFile.open(QIODevice::WriteOnly)) {+ qWarning("Couldn't open save file.");+ return;+ }++ QJsonObject xdtsObject;+ xdtsData.write(xdtsObject);+ QJsonDocument saveDoc(xdtsObject);+ QByteArray jsonByteArrayData = saveDoc.toJson();+ jsonByteArrayData.prepend(identifierStr + '\n');+ saveFile.write(jsonByteArrayData);++ QString str = QObject::tr("The file %1 has been exported successfully.")+ .arg(QString::fromStdString(fp.getLevelName()));++ std::vector<QString> buttons = {QObject::tr("OK"),+ QObject::tr("Open containing folder")};+ int ret = DVGui::MsgBox(DVGui::INFORMATION, str, buttons);++ if (ret == 2) {+ TFilePath folderPath = fp.getParentDir();+ if (TSystem::isUNC(folderPath))+ QDesktopServices::openUrl(QUrl(folderPath.getQString()));+ else+ QDesktopServices::openUrl(QUrl::fromLocalFile(folderPath.getQString()));+ }+}diff --git a/toonz/sources/toonz/xdtsio.h b/toonz/sources/toonz/xdtsio.hnew file mode 100644index 000000000..d1880a031--- /dev/null+++ b/toonz/sources/toonz/xdtsio.h@@ -0,0 +1,242 @@+#pragma once+#ifndef XDTSIO_H+#define XDTSIO_H++#include <QString>+#include <QList>+#include <QPair>+#include <QStringList>++#include <iostream>++class ToonzScene;+class TFilePath;+class TXsheet;+class TXshCellColumn;+class QJsonObject;++namespace XdtsIo {++enum FieldId { CELL = 0, DIALOG = 3, CAMERAWORK = 5 };+// (*1) Field: Input location of each timesheet instruction.+// Fields are divided into cells, dialog, and camerawork.+// [FieldId] [field name] [details]+// 0 Cell Field for cell numbers+// 3 Dialog Field for speaker names and line timing+// 5 Camerawork Field for camerawork instructions++// "description": "Cut / scene information",+class XdtsHeader {+ //"description": "Cut No."+ //"pattern" : "\\d{1,4}"+ QString m_cut;+ //"description": "Scene No.",+ //"pattern" : "\\d{1,4}"+ QString m_scene;++ // "required": ["cut", "scene"]+public:+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ bool isEmpty() const { return m_cut.isEmpty() && m_scene.isEmpty(); }+};++//"description": "Frame instruction information",+class XdtsFrameDataItem {+ //"description": "Instruction type(*2)",+ //*2 Currently only supports instructions with id=0.+ enum DataId { Default = 0 } m_id;++ //"description": "Instruction value(*3)",+ QList<QString> m_values;+ // "minItems" : 1,+ //"required": ["id", "values"]++ //(*3) Values are different depending on the field type.+ // Values for each field are as follows.+ // [Field name: Cell]+ // Enter the cell number string and special instruction string(*4)+ // (value element numbers: 1)+ // [Field name: Dialog]+ // In the dialog's first frame, enter the speaker name in the first+ // element, and the dialog's string in the second element.+ // When the line lasts for multiple frames, specify the character+ // string "SYMBOL_HYPHEN" up to the end frame.+ // (value element numbers: 1�`2)+ // [Field name: Camerawork]+ // In the camerawork's first frame, enter the camerawork instruction+ // string When the camerawork lasts for multiple frames, specify the+ // character string "SYMBOL_HYPHEN" up to the end frame.+ // (value element numbers: 1)++ //(*4) Special instruction character strings+ // [Character string] [Instruction] [Valid field]+ // SYMBOL_TICK_1 Inbetween symbol(��) Cell+ // SYMBOL_TICK_2 Reverse sheet symbol(��) Cell+ // SYMBOL_NULL_CELL Empty cell symbol(�~) Cell+ // SYMBOL_HYPHEN Continue previous All fields+ // field instruction++public:+ XdtsFrameDataItem() : m_id(Default) {}+ XdtsFrameDataItem(int cellNumber) : m_id(Default) {+ m_values.append((cellNumber == 0) ? QString("SYMBOL_NULL_CELL")+ : QString::number(cellNumber));+ }+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ int getCellNumber() const {+ if (m_values.isEmpty()) return 0;+ QString val = m_values.at(0);+ if (val == "SYMBOL_NULL_CELL") return 0;+ // ignore sheet symbols for now+ else if (val == "SYMBOL_HYPHEN" || val == "SYMBOL_TICK_1" ||+ val == "SYMBOL_TICK_2")+ return -1;+ // return cell number+ return m_values.at(0).toInt();+ }+};++//"description": "Individual layer frame information",+class XdtsTrackFrameItem {+ //"description": "Frame instruction information",+ QList<XdtsFrameDataItem> m_data;++ //"description": "Frame No.(*5)",+ // (*5) Set as 0 when specifying the first frame.+ //"minimum" : 0+ int m_frame;++ //"required": ["data", "frame"]+public:+ XdtsTrackFrameItem() = default;+ XdtsTrackFrameItem(int frame, int cellNumber) : m_frame(frame) {+ m_data.append(XdtsFrameDataItem(cellNumber));+ }+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ QPair<int, int> frameCellNumber() const;+};++//"description": "Individual field layer info",+class XdtsFieldTrackItem {+ //"description": "Individual layer frame information",+ QList<XdtsTrackFrameItem> m_frames;++ //"description": "Layer No.(*6)",+ // (*6) Set as 0 for the bottom layer.+ // corresponds to column numbers in OT+ int m_trackNo;+ // "minimum" : 0++ //"required": ["frames", "trackNo"]+public:+ XdtsFieldTrackItem(int trackNo = 0) : m_trackNo(trackNo) {}+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ bool isEmpty() const { return m_frames.isEmpty(); }+ int getTrackNo() const { return m_trackNo; }+ QVector<int> getCellNumberTrack() const;++ QString build(TXshCellColumn *, int);+ void addFrame(int frame, int cellNumber) {+ m_frames.append(XdtsTrackFrameItem(frame, cellNumber));+ }+};++class XdtsTimeTableFieldItem {+ // "description": "Field type(*1)",+ FieldId m_fieldId;++ //"description": "Individual field layer info",+ QList<XdtsFieldTrackItem> m_tracks;++ //"required": ["fieldId", "tracks"]+public:+ XdtsTimeTableFieldItem(FieldId fieldId = CELL) : m_fieldId(fieldId) {}+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ bool isCellField() { return m_fieldId == CELL; }+ QList<int> getOccupiedColumns() const;+ QVector<int> getColumnTrack(int col) const;++ void build(TXsheet *, int, QStringList &);+};++class XdtsTimeTableHeaderItem {+ //"description": "Field type(*1)",+ FieldId m_fieldId;++ //"description": "Layer name array(*7)",+ //(*7) Specify layer names with trackNo's that match numbers counted as 0,1,2,+ // etc.+ QStringList m_names;++ //"required": ["fieldId", "names"]+public:+ XdtsTimeTableHeaderItem(FieldId fieldId = CELL) : m_fieldId(fieldId) {}+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ bool isCellField() { return m_fieldId == CELL; }+ QStringList getLayerNames() const { return m_names; }++ void build(QStringList &);+ void addName(QString name) { m_names.append(name); }+};++class XdtsTimeTableItem {+ //"description": "Individual field info",+ QList<XdtsTimeTableFieldItem> m_fields;+ int m_cellFieldIndex = -1;+ //"description": "Timesheet total frames",+ //"minimum" : 1+ int m_duration;++ //"description": "Timesheet name",+ QString m_name;++ // "description": "Individual field layer name",+ QList<XdtsTimeTableHeaderItem> m_timeTableHeaders;+ int m_cellHeaderIndex = -1;+ //"required": ["duration", "name", "timeTableHeaders"]++public:+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ QStringList getLevelNames() const;+ XdtsTimeTableFieldItem getCellField() { return m_fields[m_cellFieldIndex]; }+ XdtsTimeTableHeaderItem getCellHeader() {+ return m_timeTableHeaders[m_cellHeaderIndex];+ }+ int getDuration() { return m_duration; }++ void build(TXsheet *, QString);+};++// "$schema": "http://json-schema.org/draft-07/schema",+class XdtsData {+ XdtsHeader m_header;++ //"description": "Timesheet info",+ //"minItems" : 1,+ QList<XdtsTimeTableItem> m_timeTables;++ // "description": "XTDS file format version",+ enum Version { Ver_2018_11_29 = 5 } m_version;++ //"required": ["timeTables", "version"]+public:+ XdtsData(Version version = Ver_2018_11_29) : m_version(version) {}+ void read(const QJsonObject &json);+ void write(QJsonObject &json) const;+ QStringList getLevelNames() const;+ XdtsTimeTableItem &timeTable() { return m_timeTables[0]; }+ void build(TXsheet *, QString);+};++bool loadXdtsScene(ToonzScene *scene, const TFilePath &scenePath);++} // namespace XdtsIo++#endifdiff --git a/toonz/sources/toonzqt/icongenerator.cpp b/toonz/sources/toonzqt/icongenerator.cppindex 92c3e979e..39f75b4c3 100644--- a/toonz/sources/toonzqt/icongenerator.cpp+++ b/toonz/sources/toonzqt/icongenerator.cpp@@ -118,7 +118,7 @@ bool getIcon(const std::string &iconName, QPixmap &pix,ras->getSize().lx > standardSize.lx &&ras->getSize().ly > standardSize.ly)isHighDpi = true;- pix = rasterToQPixmap(ras, false, isHighDpi);+ pix = rasterToQPixmap(ras, false, isHighDpi);return true;}@@ -135,7 +135,7 @@ void setIcon(const std::string &iconName, const TRaster32P &icon) {//-----------------------------------------------------------------------------/*! Cache icon data in TToonzImage format if ToonzImageIconRenderer generates* them-*/+ */void setIcon_TnzImg(const std::string &iconName, const TRasterCM32P &icon) {if (iconsMap.find(iconName) != iconsMap.end())TImageCache::instance()->add(@@ -187,7 +187,7 @@ void makeChessBackground(const TRaster32P &ras) {int yCol = (y & 4);- for (int x = 0; pix != lineEnd; ++x, ++pix)+ for (int x = 0; pix != lineEnd; ++x, ++pix)if (pix->m != 255) *pix = overPix((x & 4) == yCol ? gray1 : gray2, *pix);}@@ -605,8 +605,8 @@ TRaster32P SplineIconRenderer::generateRaster(double scaleX = 1, scaleY = 1;if (sbbox.getLx() > 0.0) scaleX = (double)iconSize.lx / sbbox.getLx();if (sbbox.getLy() > 0.0) scaleY = (double)iconSize.ly / sbbox.getLy();- double scale = 0.8 * std::min(scaleX, scaleY);- TPointD centerStroke = 0.5 * (sbbox.getP00() + sbbox.getP11());+ double scale = 0.8 * std::min(scaleX, scaleY);+ TPointD centerStroke = 0.5 * (sbbox.getP00() + sbbox.getP11());TPointD centerPixmap(iconSize.lx * 0.5, iconSize.ly * 0.5);glPushMatrix();tglMultMatrix(TScale(scale).place(centerStroke, centerPixmap));@@ -971,10 +971,10 @@ TRaster32P IconGenerator::generateVectorFileIcon(const TFilePath &path,TLevelReaderP lr(path);TLevelP level = lr->loadInfo();if (level->begin() == level->end()) return TRaster32P();- TFrameId frameId = fid;+ TFrameId frameId = fid;if (fid == TFrameId::NO_FRAME) frameId = level->begin()->first;- TImageP img = lr->getFrameReader(frameId)->load();- TVectorImageP vi = img;+ TImageP img = lr->getFrameReader(frameId)->load();+ TVectorImageP vi = img;if (!vi) return TRaster32P();vi->setPalette(level->getPalette());VectorImageIconRenderer vir("", iconSize, vi.getPointer(),@@ -1112,7 +1112,7 @@ TRaster32P IconGenerator::generateMeshFileIcon(const TFilePath &path,TLevelP level = lr->loadInfo();if (level->begin() == level->end()) return TRaster32P();- TFrameId frameId = fid;+ TFrameId frameId = fid;if (fid == TFrameId::NO_FRAME) frameId = level->begin()->first;TMeshImageP mi = lr->getFrameReader(frameId)->load();@@ -1225,6 +1225,12 @@ void FileIconRenderer::run() {Qt::KeepAspectRatio));setIcon(rasterFromQPixmap(magpie));return;+ } else if (type == "xdts") {+ QPixmap xdts(svgToPixmap(":Resources/xdts.svg",+ QSize(iconSize.lx, iconSize.ly),+ Qt::KeepAspectRatio));+ setIcon(rasterFromQPixmap(xdts));+ return;} else if (type == "js") {QImage script(":Resources/scripticon.png");setIcon(rasterFromQImage(script));