summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/atlas_import_failed.xpm414
-rw-r--r--editor/import/editor_import_collada.cpp2
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp56
-rw-r--r--editor/import/editor_scene_importer_gltf.h1
-rw-r--r--editor/import/resource_importer_scene.cpp318
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.cpp2
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp412
-rw-r--r--editor/import/resource_importer_texture_atlas.h72
-rw-r--r--editor/import/resource_importer_wav.cpp38
10 files changed, 1153 insertions, 164 deletions
diff --git a/editor/import/atlas_import_failed.xpm b/editor/import/atlas_import_failed.xpm
new file mode 100644
index 0000000000..52db6b76a6
--- /dev/null
+++ b/editor/import/atlas_import_failed.xpm
@@ -0,0 +1,414 @@
+/* XPM */
+static const char * atlas_import_failed_xpm[] = {
+"128 128 283 2",
+" c None",
+". c #FFFFFF",
+"+ c #FFDADA",
+"@ c #FF0000",
+"# c #FFD8D8",
+"$ c #FFF7F7",
+"% c #FF2E2E",
+"& c #FFD4D4",
+"* c #FFD6D6",
+"= c #FFE3E3",
+"- c #FFB3B3",
+"; c #FFC8C8",
+"> c #FF3535",
+", c #FF8D8D",
+"' c #FF7878",
+") c #FF6E6E",
+"! c #FFB5B5",
+"~ c #FF0D0D",
+"{ c #FFF0F0",
+"] c #FFE8E8",
+"^ c #FFC2C2",
+"/ c #FFEDED",
+"( c #FFBBBB",
+"_ c #FFB9B9",
+": c #FFA4A4",
+"< c #FFFEFE",
+"[ c #FFD9D9",
+"} c #FF9393",
+"| c #FF5858",
+"1 c #FF3232",
+"2 c #FF7575",
+"3 c #FFC9C9",
+"4 c #FFFCFC",
+"5 c #FFBDBD",
+"6 c #FF3838",
+"7 c #FF9494",
+"8 c #FFE2E2",
+"9 c #FFD1D1",
+"0 c #FFDEDE",
+"a c #FFCACA",
+"b c #FF6969",
+"c c #FF8484",
+"d c #FFEAEA",
+"e c #FFE9E9",
+"f c #FF3B3B",
+"g c #FFC0C0",
+"h c #FF6868",
+"i c #FF7373",
+"j c #FFF6F6",
+"k c #FFADAD",
+"l c #FF5D5D",
+"m c #FF2626",
+"n c #FF5C5C",
+"o c #FFABAB",
+"p c #FFCECE",
+"q c #FF7070",
+"r c #FF5555",
+"s c #FF1C1C",
+"t c #FFF4F4",
+"u c #FF8282",
+"v c #FF6060",
+"w c #FFE7E7",
+"x c #FF9D9D",
+"y c #FF5656",
+"z c #FF4242",
+"A c #FF9B9B",
+"B c #FFD0D0",
+"C c #FFF8F8",
+"D c #FF6A6A",
+"E c #FF5151",
+"F c #FFFBFB",
+"G c #FF4949",
+"H c #FFCDCD",
+"I c #FFDDDD",
+"J c #FF9E9E",
+"K c #FFF9F9",
+"L c #FFDCDC",
+"M c #FF8F8F",
+"N c #FFCBCB",
+"O c #FFF5F5",
+"P c #FF4747",
+"Q c #FF9C9C",
+"R c #FFEEEE",
+"S c #FFFAFA",
+"T c #FF1616",
+"U c #FF8888",
+"V c #FFC5C5",
+"W c #FF2222",
+"X c #FF4B4B",
+"Y c #FFB8B8",
+"Z c #FF7F7F",
+"` c #FFE6E6",
+" . c #FF8080",
+".. c #FFB4B4",
+"+. c #FFC3C3",
+"@. c #FFD2D2",
+"#. c #FFD7D7",
+"$. c #FFDFDF",
+"%. c #FFB7B7",
+"&. c #FFF1F1",
+"*. c #FF6262",
+"=. c #FF8A8A",
+"-. c #FFA9A9",
+";. c #FFAEAE",
+">. c #FFAAAA",
+",. c #FF8B8B",
+"'. c #FF4F4F",
+"). c #FFFDFD",
+"!. c #FFA3A3",
+"~. c #FF2A2A",
+"{. c #FFCFCF",
+"]. c #FF8585",
+"^. c #FF7676",
+"/. c #FFD3D3",
+"(. c #FFD5D5",
+"_. c #FF8181",
+":. c #FFC6C6",
+"<. c #FFDBDB",
+"[. c #FF9090",
+"}. c #FFAFAF",
+"|. c #FFA1A1",
+"1. c #FFBABA",
+"2. c #FF6C6C",
+"3. c #FF5F5F",
+"4. c #FF3D3D",
+"5. c #FF9999",
+"6. c #FFE0E0",
+"7. c #FF8383",
+"8. c #FFEFEF",
+"9. c #FFF3F3",
+"0. c #FFA8A8",
+"a. c #FFB6B6",
+"b. c #FF9F9F",
+"c. c #FF4545",
+"d. c #FFE5E5",
+"e. c #FFE4E4",
+"f. c #FFC7C7",
+"g. c #FF6565",
+"h. c #FFACAC",
+"i. c #FF5A5A",
+"j. c #FF7272",
+"k. c #FF7C7C",
+"l. c #FFBFBF",
+"m. c #FF7171",
+"n. c #FFECEC",
+"o. c #FF8989",
+"p. c #FF7777",
+"q. c #FFC4C4",
+"r. c #FF9898",
+"s. c #FF8C8C",
+"t. c #FF7A7A",
+"u. c #FF8E8E",
+"v. c #FFF2F2",
+"w. c #FF9797",
+"x. c #FFC1C1",
+"y. c #FFA6A6",
+"z. c #FFEBEB",
+"A. c #FF4040",
+"B. c #EDEDED",
+"C. c #000000",
+"D. c #AAAAAA",
+"E. c #F6F6F6",
+"F. c #1C1C1C",
+"G. c #888888",
+"H. c #7C7C7C",
+"I. c #626262",
+"J. c #B3B3B3",
+"K. c #2A2A2A",
+"L. c #959595",
+"M. c #FDFDFD",
+"N. c #C5C5C5",
+"O. c #666666",
+"P. c #353535",
+"Q. c #777777",
+"R. c #DEDEDE",
+"S. c #6C6C6C",
+"T. c #F5F5F5",
+"U. c #ADADAD",
+"V. c #DDDDDD",
+"W. c #D8D8D8",
+"X. c #B4B4B4",
+"Y. c #FAFAFA",
+"Z. c #949494",
+"`. c #3B3B3B",
+" + c #A8A8A8",
+".+ c #C8C8C8",
+"++ c #D4D4D4",
+"@+ c #B9B9B9",
+"#+ c #2E2E2E",
+"$+ c #FEFEFE",
+"%+ c #BABABA",
+"&+ c #FCFCFC",
+"*+ c #B2B2B2",
+"=+ c #CACACA",
+"-+ c #696969",
+";+ c #222222",
+">+ c #F2F2F2",
+",+ c #555555",
+"'+ c #C4C4C4",
+")+ c #EBEBEB",
+"!+ c #727272",
+"~+ c #585858",
+"{+ c #0D0D0D",
+"]+ c #B1B1B1",
+"^+ c #E5E5E5",
+"/+ c #C0C0C0",
+"(+ c #8F8F8F",
+"_+ c #4D4D4D",
+":+ c #F4F4F4",
+"<+ c #7D7D7D",
+"[+ c #E4E4E4",
+"}+ c #F3F3F3",
+"|+ c #383838",
+"1+ c #A9A9A9",
+"2+ c #D6D6D6",
+"3+ c #D5D5D5",
+"4+ c #5F5F5F",
+"5+ c #C6C6C6",
+"6+ c #E2E2E2",
+"7+ c #FBFBFB",
+"8+ c #404040",
+"9+ c #909090",
+"0+ c #EEEEEE",
+"a+ c #878787",
+"b+ c #E8E8E8",
+"c+ c #494949",
+"d+ c #424242",
+"e+ c #E6E6E6",
+"f+ c #CFCFCF",
+"g+ c #DCDCDC",
+"h+ c #161616",
+"i+ c #BBBBBB",
+"j+ c #CCCCCC",
+"k+ c #B0B0B0",
+"l+ c #C7C7C7",
+"m+ c #858585",
+"n+ c #F8F8F8",
+"o+ c #D7D7D7",
+"p+ c #BDBDBD",
+"q+ c #ECECEC",
+"r+ c #939393",
+"s+ c #A1A1A1",
+"t+ c #7A7A7A",
+"u+ c #4B4B4B",
+"v+ c #E9E9E9",
+"w+ c #717171",
+"x+ c #AFAFAF",
+"y+ c #454545",
+"z+ c #F9F9F9",
+"A+ c #DBDBDB",
+"B+ c #C1C1C1",
+"C+ c #707070",
+"D+ c #323232",
+"E+ c #9D9D9D",
+"F+ c #D1D1D1",
+"G+ c #6D6D6D",
+"H+ c #262626",
+"I+ c #6E6E6E",
+"J+ c #808080",
+"K+ c #BFBFBF",
+"L+ c #999999",
+"M+ c #F1F1F1",
+"N+ c #DADADA",
+"O+ c #9F9F9F",
+"P+ c #8B8B8B",
+"Q+ c #7F7F7F",
+"R+ c #9E9E9E",
+"S+ c #F0F0F0",
+"T+ c #A4A4A4",
+"U+ c #A5A5A5",
+"V+ c #CDCDCD",
+"W+ c #CBCBCB",
+"X+ c #9B9B9B",
+"Y+ c #D9D9D9",
+"Z+ c #A0A0A0",
+"`+ c #9C9C9C",
+" @ c #C2C2C2",
+".@ c #636363",
+"+@ c #D0D0D0",
+"@@ c #6A6A6A",
+"#@ c #898989",
+"$@ c #C3C3C3",
+"%@ c #A7A7A7",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . $ % @ & . . . . . * @ + . . . . + @ # . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . ; @ > , . . . . . * @ + . . . . + @ # . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . ' ) ! ~ { . . . . * @ + . . . . + @ # . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . . . ] @ ^ / @ ( . . . _ @ @ @ @ @ : . + @ # . . < [ } | 1 2 3 . . . . 4 5 ) 6 | 7 8 . . . . . . . . = @ - . . 9 @ 0 a b > c d . e , f | g . . . . 9 @ 0 a h % i & . . . . j k l m n o j . . . 9 @ 0 p q m r @ @ @ @ @ : . . . . . . . . . . ",
+". . . . . . . . . . . . k s t . u v < . . _ @ @ @ @ @ : . + @ # . . w @ @ @ @ @ @ 5 . . . k @ @ @ @ @ % . . . . . . . . = @ - . . 9 @ x @ @ @ @ y d z @ @ @ @ * . . . 9 @ A @ @ @ @ @ B . . C D @ @ @ @ @ h C . . 9 @ x @ @ @ E @ @ @ @ @ : . . . . . . . . . . ",
+". . . . . . . . . . . F G 7 . . H @ I . . . * @ + . . . . + @ # . . ] J 8 j K 0 h 6 K . . l l = F j L M . . . . . . . . = @ - . . 9 @ % N j O J @ P Q R S & T U . . . 9 @ s ^ O j V W X F . Y @ Z ` S w .@ ... . 9 @ s +.t . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . . @.@ #.. . K 6 x . . . * @ + . . . . + @ # . . . . . . . . # @ $.. . ' M . . . . . . . . . . . . . = @ - . . 9 @ %.. . . &.@ *.4 . . . =.r . . . 9 @ -.. . . . ;.@ 0 . q 6 t . . . t f h . . 9 @ >.. . . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . . ,.'.).. . . !.~.j . . * @ + . . . . + @ # . . . {.].P ~ @ @ @ 9 . . 8 r ^.- /.j . . . . . . . . . = @ - . . 9 @ + . . . . @ A . . . . !.~ . . . 9 @ (.. . . . # @ N . 1 _.. . . . . c s . . 9 @ (.. . . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . { ~ @ @ @ @ @ @ @ :.. . * @ + . . . . + @ # . . ^ @ @ @ @ @ @ @ H . . . F <._ [.> }.. . . . . . . . = @ - . . 9 @ 0 . . . . @ |.. . . . : @ . . . 9 @ (.. . . . # @ N . 1 u . . . . . c s . . 9 @ 0 . . . . * @ + . . . . . . . . . . . . . ",
+". . . . . . . . . . 1.@ @ @ @ @ @ @ @ ^.. . #.@ # . . . . + @ # . . 2.r $.$ < . [ @ H . . . . . . . + @ * . . . . . . . = @ - . . 9 @ 0 . . . . @ |.. . . . : @ . . . 9 @ -.. . . . ;.@ 0 . q 6 t . . . O f h . . 9 @ 0 . . . . #.@ # . . . . . . . . . . . . . ",
+". . . . . . . . . < 3.4.K . . . . . 5.@ w . 6.@ ;.F . . . + @ # . . 2.n ` 4 $ + *.@ H . 4 7.@.8.4 9.k @ ^ . . . . . . . = @ - . . 9 @ 0 . . . . @ |.. . . . : @ . . . 9 @ s ^ O j V W X F . %.@ u w F ] u @ - . . 9 @ 0 . . . . 6.@ ;.F . . . . . . . . . . . . ",
+". . . . . . . . . L @ 0.. . . . . . L @ o . K > @ @ @ : . + @ # . . a.@ @ @ @ @ b.@ H . F @ @ @ @ @ @ > / . . . . . . . = @ - . . 9 @ 0 . . . . @ |.. . . . : @ . . . 9 @ A @ @ @ @ @ B . . C D @ @ @ @ @ h $ . . 9 @ 0 . . . . K > @ @ @ : . . . . . . . . . . ",
+". . . . . . . . . A @ ` . . . . . . < *.c.F . # ^.~.@ : . + @ # . . 4 _ *.% q N d.@ H . . e.: h % l b.e . . . . . . . . = @ - . . 9 @ 0 . . . . @ |.. . . . : @ . . . 9 @ 0 f.g.~.i /.. . . . j h.n W i.>.O . . . 9 @ 0 . . . . . # ^.~.@ : . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 @ 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 @ 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 @ 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 @ 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + @ # . . + @ # . . . . . . . . . . . . . . . . . . . . j.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ @ @ @ @ @ @ # . . . . . . . . . . + @ # . . + @ # . . . . . . . . . . . . . . . . . . . . j.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ @ @ @ @ @ @ # . . . . . . . . . . . . . . . + @ # . . . . . . . . . . . . . . . . . . . . j.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . . . . . . . . . . . . . . . . . + @ # . . . . . . . . . . . . . . . . . . . . j.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . < [ } | 1 2 3 . . . . + @ # . . + @ # . . . 4 l.m.% G 5.n.. . . . &.Q z c.x O j.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . w @ @ @ @ @ @ 5 . . . + @ # . . + @ # . . ).o.@ @ @ @ @ c./ . . $ v @ @ @ @ p.2.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ @ @ @ @ @ U ] J 8 j K 0 h 6 K . . + @ # . . + @ # . . q.@ } w F O q.s r.. . a.@ s.d S 8 ) @ k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ @ @ @ @ @ U . . . . . . # @ $.. . + @ # . . + @ # . . t.| ).. . . . !.> < . q G C . . . d @ k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . . {.].P ~ @ @ @ 9 . . + @ # . . + @ # . . > @ @ @ @ @ @ @ @ O . % u.. . . . . y k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . ^ @ @ @ @ @ @ @ H . . + @ # . . + @ # . . 1 @ @ @ @ @ @ @ @ v.. % u.. . . . . r k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . 2.r $.$ < . [ @ H . . + @ # . . + @ # . . ^.h < . . . . . . . . q G C . . . d @ k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . 2.n ` 4 $ + *.@ H . . + @ # . . + @ # . . +.@ w.e.C S d x.y.. . a.@ s.z.S 8 ) @ k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . a.@ @ @ @ @ b.@ H . . + @ # . . + @ # . . ).M @ @ @ @ @ @ s.. . $ v @ @ @ @ ^.2.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . = @ - . . . . . 4 _ *.% q N d.@ H . . + @ # . . + @ # . . . ).f.k.6 z ' Y v.. . . &.A A.z A O j.k.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.B.C.D.B.C.D.. . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.C.C.C.F.. B.C.D.B.C.D.B.C.D.. . . . C.G.. . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.H.. . . . . . . B.C.D.B.C.D.. . . . C.G.. . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.H.. . . . B.C.D.B.C.D.B.C.D.. . . I.C.C.C.J.B.C.C.C.K.L.M.. N.O.P.Q.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.C.C.C.H.. B.C.D.B.C.D.B.C.D.. . . . C.G.. . B.C.S.T.U.C.V.W.C.X.Y.Z.`.E.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.H.. . . . B.C.D.B.C.D.B.C.D.. . . . C.G.. . B.C. +. .+C.++@+C.C.C.C.C.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.H.. . . . B.C.D.B.C.D.B.C.D.. . . . #+Q.$+. B.C.D.. .+C.++W.C.%+&+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.C.H.. . . . B.C.D.B.C.D.B.C.D.. . . . *+`.C.=+B.C.D.. .+C.++. N.-+;+C.C.Y.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . B.C.D.B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y.C.>+,+R.. . '+C.C.)+. . . C.G.. . B.C.D.. . . . . . . . . . . . . . . . E.C.C.C.C.F.. B.C.D.B.C.D.. . . . . . . Y.C.>+,+R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y.C.>+,+R.. . !+~+{+]+. . . C.G.. . B.C.D.. . . . . . . . . . . . . . . . E.C.H.. . . . . . . B.C.D.. . . . . . . Y.C.>+,+R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y.C.>+,+R.. ^+C./+(+_+&+. I.C.C.C.J.B.C.D.:+C.C.P.<+[+. }+G.|+C.C.>+. . . E.C.H.. . . . B.C.D.B.C.D.. N.O.P.Q.R.. Y.C.>+,+R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1+;+T.2+C.3+. . C.G.. . B.C.D.. . . T.4+Q.. 5+C.X.6+Y.. . . . E.C.C.C.C.H.. B.C.D.B.C.D.W.C.X.Y.Z.`.E.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7+8+C.C.C.C.9+. . C.G.. . B.C.D.0+a+8+C.C.|+. b+c+C.C.d+e+. . . E.C.H.. . . . B.C.D.B.C.D.@+C.C.C.C.C.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f+C.g+. . J.h+>+. #+Q.$+. B.C.D.i+C.j+0+,+#+. . &+e+k+C.l+. . . E.C.H.. . . . B.C.D.B.C.D.W.C.%+&+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . m+h+n+. . o+C.p+. *+`.C.=+B.C.D.q+!+{+C.C.#+. =+C.C.8+r+E.. . . E.C.H.. . . . B.C.D.B.C.D.. N.-+;+C.C.Y.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V.4+C.s+C.U.. . . . . . . B.C.D.. . . . N.C.W.. . . B.C.D.. . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . t+u+Y.v+C.U.. . . . . . . B.C.D.. . . . N.C.W.. . . B.C.D.. . . . . . . . . . . C.G.. . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . u+w+. . . . . . . . . . . B.C.D.. . . . N.C.W.. . . . . . . . . . . . . . . . . C.G.. . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . H.C.C.C.C.C.U.. N.O.P.Q.R.. B.C.D.. x+d+C.C.C.W.. . . B.C.D.B.C.C.C.K.L.M.. . . I.C.C.C.J.B.C.C.C.K.L.M.. N.O.P.Q.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . y+!+. v+C.U.W.C.X.Y.Z.`.E.B.C.D.2+C.x+z+(+C.W.. . . B.C.D.B.C.S.T.U.C.V.. . . . C.G.. . B.C.S.T.U.C.V.W.C.X.Y.Z.`.E.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . y+!+. v+C.U.@+C.C.C.C.C.R.B.C.D.%+C.A+. B+C.W.. . . B.C.D.B.C. +. .+C.++. . . . C.G.. . B.C. +. .+C.++@+C.C.C.C.C.R.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . y+!+. v+C.U.W.C.%+&+. . . B.C.D.2+C.k+z+9+C.W.. . . B.C.D.B.C.D.. .+C.++. . . . #+Q.$+. B.C.D.. .+C.++W.C.%+&+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . y+!+. v+C.U.. N.-+;+C.C.Y.B.C.D.. x+d+C.C.C.W.. . . B.C.D.B.C.D.. .+C.++. . . . *+`.C.=+B.C.D.. .+C.++. N.-+;+C.C.Y.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.C.W.. . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . N.C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.G.. . . . . . . . . N.C.W.. . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . N.C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.G.. . . . . . . . . N.C.W.. . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . N.C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.)+C.C.C.K.C+O.K.!+B.B.C.C.C.D+E+7+. '+O.P.C+F+. B.C.C.C.,+I.C.C.C.J.. . . . x+d+C.C.C.W.. '+O.P.C+F+. . .+G+H+C.R.B.C.D.>+I+I.q+. . . :+C.C.P.<+[+. B.C.C.C.K.L.M.. x+d+C.C.C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.)+C.!+T.J+C.=+g+C.]+B.C.I+E.=+C.K+W.C.]+Y.L+h+b+B.C.O.M+. . C.G.. . . . . 2+C.x+z+(+C.W.W.C.]+Y.L+h+b+N+C.O+z+. . B.C.P+4+Q+T.. . . . . . . T.4+Q.. B.C.S.T.U.C.V.2+C.x+z+(+C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.)+C. +. R+C.M+S+C.T+B.C.U+. M+C.E+@+C.V.. =+C.V+B.C. +. . . C.G.. . . . . %+C.A+. B+C.W.@+C.V.. =+C.V+@+C.A+. . . B.C.C.C.R.. . . . . 0+a+8+C.C.|+. B.C. +. .+C.++%+C.A+. B+C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.)+C.D.. R+C.>+S+C.T+B.C.C+E.W+C.K+W.C.*+Y.X+{+b+B.C.D.. . . #+Q.$+. . . . 2+C.k+z+9+C.W.W.C.*+Y.X+{+b+Y+C.s+z+. . B.C.Z+m+|+V.. . . . i+C.j+0+,+#+. B.C.D.. .+C.++2+C.k+z+9+C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . B.C.D.)+C.D.. R+C.>+S+C.T+B.C.C.C.D+`+7+. @.@D+G++@. B.C.D.. . . *+`.C.=+. . . . x+d+C.C.C.W.. @.@D+G++@. . l+@@H+C.R.B.C.D.Y.#@K.2+. . . q+!+{+C.C.#+. B.C.D.. .+C.++. x+d+C.C.C.W.. . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.G.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C.G.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.C.C.,+. N.O.P.Q.R.. . . . . B.C.D.)+C.C.C.K.C+O.K.!+B.B.C.C.C.D+E+7+. '+O.P.C+F+. B.C.C.C.,+I.C.C.C.J.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.O.M+. W.C.X.Y.Z.`.E.$@C.C.%@B.C.D.)+C.!+T.J+C.=+g+C.]+B.C.I+E.=+C.K+W.C.]+Y.L+h+b+B.C.O.M+. . C.G.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C. +. . @+C.C.C.C.C.R.. . . . B.C.D.)+C. +. R+C.M+S+C.T+B.C.U+. M+C.E+@+C.V.. =+C.V+B.C. +. . . C.G.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . W.C.%+&+. . . . . . . B.C.D.)+C.D.. R+C.>+S+C.T+B.C.C+E.W+C.K+W.C.*+Y.X+{+b+B.C.D.. . . #+Q.$+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . N.-+;+C.C.Y.. . . . B.C.D.)+C.D.. R+C.>+S+C.T+B.C.C.C.D+`+7+. @.@D+G++@. B.C.D.. . . *+`.C.=+. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.C.D.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ",
+". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "};
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 44eaf3d9ef..e152827c63 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1614,8 +1614,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
continue;
}
- ERR_CONTINUE(xform_idx == -1);
-
Vector<float> data = at.get_value_at_time(snapshots[i]);
ERR_CONTINUE(data.empty());
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 7032146229..c97021433b 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -237,8 +237,7 @@ Error EditorSceneImporterGLTF::_parse_nodes(GLTFState &state) {
node->scale = _arr_to_vec3(n["scale"]);
}
- node->xform.basis = Basis(node->rotation);
- node->xform.basis.scale(node->scale);
+ node->xform.basis.set_quat_scale(node->rotation, node->scale);
node->xform.origin = node->translation;
}
@@ -582,7 +581,9 @@ int EditorSceneImporterGLTF::_get_component_type_size(int component_type) {
case COMPONENT_TYPE_UNSIGNED_SHORT: return 2; break;
case COMPONENT_TYPE_INT: return 4; break;
case COMPONENT_TYPE_FLOAT: return 4; break;
- default: { ERR_FAIL_V(0); }
+ default: {
+ ERR_FAIL_V(0);
+ }
}
return 0;
}
@@ -632,7 +633,8 @@ Vector<double> EditorSceneImporterGLTF::_decode_accessor(GLTFState &state, int p
element_size = 16; //override for this case
}
} break;
- default: {}
+ default: {
+ }
}
Vector<double> dst_buffer;
@@ -1698,6 +1700,22 @@ void EditorSceneImporterGLTF::_assign_scene_names(GLTFState &state) {
}
}
+void EditorSceneImporterGLTF::_reparent_skeleton(GLTFState &state, int p_node, Vector<Skeleton *> &skeletons, Node *p_parent_node) {
+ //reparent skeletons to proper place
+ Vector<int> nodes = state.skeleton_nodes[p_node];
+ for (int i = 0; i < nodes.size(); i++) {
+ Skeleton *skeleton = skeletons[nodes[i]];
+ Node *owner = skeleton->get_owner();
+ skeleton->get_parent()->remove_child(skeleton);
+ p_parent_node->add_child(skeleton);
+ skeleton->set_owner(owner);
+ //may have meshes as children, set owner in them too
+ for (int j = 0; j < skeleton->get_child_count(); j++) {
+ skeleton->get_child(j)->set_owner(owner);
+ }
+ }
+}
+
void EditorSceneImporterGLTF::_generate_node(GLTFState &state, int p_node, Node *p_parent, Node *p_owner, Vector<Skeleton *> &skeletons) {
ERR_FAIL_INDEX(p_node, state.nodes.size());
@@ -1769,24 +1787,17 @@ void EditorSceneImporterGLTF::_generate_node(GLTFState &state, int p_node, Node
_generate_node(state, n->children[i], node, p_owner, skeletons);
}
}
+
+ if (state.skeleton_nodes.has(p_node)) {
+ _reparent_skeleton(state, p_node, skeletons, node);
+ }
}
void EditorSceneImporterGLTF::_generate_bone(GLTFState &state, int p_node, Vector<Skeleton *> &skeletons, Node *p_parent_node) {
ERR_FAIL_INDEX(p_node, state.nodes.size());
if (state.skeleton_nodes.has(p_node)) {
- //reparent skeletons to proper place
- Vector<int> nodes = state.skeleton_nodes[p_node];
- for (int i = 0; i < nodes.size(); i++) {
- Node *owner = skeletons[i]->get_owner();
- skeletons[i]->get_parent()->remove_child(skeletons[i]);
- p_parent_node->add_child(skeletons[i]);
- skeletons[i]->set_owner(owner);
- //may have meshes as children, set owner in them too
- for (int j = 0; j < skeletons[i]->get_child_count(); j++) {
- skeletons[i]->get_child(j)->set_owner(owner);
- }
- }
+ _reparent_skeleton(state, p_node, skeletons, p_parent_node);
}
GLTFNode *n = state.nodes[p_node];
@@ -2079,22 +2090,23 @@ void EditorSceneImporterGLTF::_import_animation(GLTFState &state, AnimationPlaye
animation->add_track(Animation::TYPE_VALUE);
animation->track_set_path(track_idx, node_path);
- if (track.weight_tracks[i].interpolation <= GLTFAnimation::INTERP_STEP) {
- animation->track_set_interpolation_type(track_idx, track.weight_tracks[i].interpolation == GLTFAnimation::INTERP_STEP ? Animation::INTERPOLATION_NEAREST : Animation::INTERPOLATION_NEAREST);
+ // Only LINEAR and STEP (NEAREST) can be supported out of the box by Godot's Animation,
+ // the other modes have to be baked.
+ GLTFAnimation::Interpolation gltf_interp = track.weight_tracks[i].interpolation;
+ if (gltf_interp == GLTFAnimation::INTERP_LINEAR || gltf_interp == GLTFAnimation::INTERP_STEP) {
+ animation->track_set_interpolation_type(track_idx, gltf_interp == GLTFAnimation::INTERP_STEP ? Animation::INTERPOLATION_NEAREST : Animation::INTERPOLATION_LINEAR);
for (int j = 0; j < track.weight_tracks[i].times.size(); j++) {
float t = track.weight_tracks[i].times[j];
float w = track.weight_tracks[i].values[j];
animation->track_insert_key(track_idx, t, w);
}
} else {
- //must bake, apologies.
+ // CATMULLROMSPLINE or CUBIC_SPLINE have to be baked, apologies.
float increment = 1.0 / float(bake_fps);
float time = 0.0;
-
bool last = false;
while (true) {
-
- _interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, track.weight_tracks[i].interpolation);
+ _interpolate_track<float>(track.weight_tracks[i].times, track.weight_tracks[i].values, time, gltf_interp);
if (last) {
break;
}
diff --git a/editor/import/editor_scene_importer_gltf.h b/editor/import/editor_scene_importer_gltf.h
index 0dff45abaf..ebf20e122a 100644
--- a/editor/import/editor_scene_importer_gltf.h
+++ b/editor/import/editor_scene_importer_gltf.h
@@ -310,6 +310,7 @@ class EditorSceneImporterGLTF : public EditorSceneImporter {
Vector<Basis> _decode_accessor_as_basis(GLTFState &state, int p_accessor, bool p_for_vertex);
Vector<Transform> _decode_accessor_as_xform(GLTFState &state, int p_accessor, bool p_for_vertex);
+ void _reparent_skeleton(GLTFState &state, int p_node, Vector<Skeleton *> &skeletons, Node *p_parent_node);
void _generate_bone(GLTFState &state, int p_node, Vector<Skeleton *> &skeletons, Node *p_parent_node);
void _generate_node(GLTFState &state, int p_node, Node *p_parent, Node *p_owner, Vector<Skeleton *> &skeletons);
void _import_animation(GLTFState &state, AnimationPlayer *ap, int index, int bake_fps, Vector<Skeleton *> skeletons);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 5eb1d2ec6c..0989a43705 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -279,7 +279,24 @@ static String _fixstr(const String &p_what, const String &p_str) {
return what;
}
-Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map, LightBakeMode p_light_bake_mode) {
+static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape> > &r_shape_list, bool p_convex) {
+
+ if (!p_convex) {
+
+ Ref<Shape> shape = mesh->create_trimesh_shape();
+ r_shape_list.push_back(shape);
+ } else {
+
+ Vector<Ref<Shape> > cd = mesh->convex_decompose();
+ if (cd.size()) {
+ for (int i = 0; i < cd.size(); i++) {
+ r_shape_list.push_back(cd[i]);
+ }
+ }
+ }
+}
+
+Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape> > > &collision_map, LightBakeMode p_light_bake_mode) {
// children first
for (int i = 0; i < p_node->get_child_count(); i++) {
@@ -365,37 +382,52 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
if (mi) {
- Node *col = NULL;
-
- if (_teststr(name, "colonly")) {
- col = mi->create_trimesh_collision_node();
- if (col == NULL) {
- ERR_PRINTS("Error generating collision for mesh: " + name);
- } else {
-
- col->set_name(_fixstr(name, "colonly"));
+ Ref<Mesh> mesh = mi->get_mesh();
+
+ if (mesh.is_valid()) {
+ List<Ref<Shape> > shapes;
+ String fixed_name;
+ if (collision_map.has(mesh)) {
+ shapes = collision_map[mesh];
+ } else if (_teststr(name, "colonly")) {
+ _gen_shape_list(mesh, shapes, false);
+ collision_map[mesh] = shapes;
+ } else if (_teststr(name, "convcolonly")) {
+ _gen_shape_list(mesh, shapes, true);
+ collision_map[mesh] = shapes;
}
- } else {
- col = mi->create_convex_collision_node();
- if (col == NULL) {
- ERR_PRINTS("Error generating collision for mesh: " + name);
- } else {
- col->set_name(_fixstr(name, "convcolonly"));
+ if (_teststr(name, "colonly")) {
+ fixed_name = _fixstr(name, "colonly");
+ } else if (_teststr(name, "convcolonly")) {
+ fixed_name = _fixstr(name, "convcolonly");
}
- }
- if (col) {
- Object::cast_to<Spatial>(col)->set_transform(mi->get_transform());
- p_node->replace_by(col);
- memdelete(p_node);
- p_node = col;
+ ERR_FAIL_COND_V(fixed_name == String(), NULL);
- StaticBody *sb = Object::cast_to<StaticBody>(col);
- CollisionShape *colshape = Object::cast_to<CollisionShape>(sb->get_child(0));
- colshape->set_name("shape");
- colshape->set_owner(p_node->get_owner());
+ if (shapes.size()) {
+
+ StaticBody *col = memnew(StaticBody);
+ col->set_transform(mi->get_transform());
+ col->set_name(fixed_name);
+ p_node->replace_by(col);
+ memdelete(p_node);
+ p_node = col;
+
+ int idx = 0;
+ for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
+
+ CollisionShape *cshape = memnew(CollisionShape);
+ cshape->set_shape(E->get());
+ col->add_child(cshape);
+
+ cshape->set_name("shape" + itos(idx));
+ cshape->set_owner(col->get_owner());
+ idx++;
+ }
+ }
}
+
} else if (p_node->has_meta("empty_draw_type")) {
String empty_draw_type = String(p_node->get_meta("empty_draw_type"));
StaticBody *sb = memnew(StaticBody);
@@ -434,77 +466,91 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
if (isroot)
return p_node;
- // get mesh instance and bounding box
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
- AABB aabb = mi->get_aabb();
-
- // create a new rigid body collision node
- RigidBody *rigid_body = memnew(RigidBody);
- Node *col = rigid_body;
- ERR_FAIL_COND_V(!col, NULL);
-
- // remove node name postfix
- col->set_name(_fixstr(name, "rigid"));
- // get mesh instance xform matrix to the rigid body collision node
- Object::cast_to<Spatial>(col)->set_transform(mi->get_transform());
- // save original node by duplicating it into a new instance and correcting the name
- Node *mesh = p_node->duplicate();
- mesh->set_name(_fixstr(name, "rigid"));
- // reset the xform matrix of the duplicated node so it can inherit parent node xform
- Object::cast_to<Spatial>(mesh)->set_transform(Transform(Basis()));
- // reparent the new mesh node to the rigid body collision node
- p_node->add_child(mesh);
- mesh->set_owner(p_node->get_owner());
- // replace the original node with the rigid body collision node
- p_node->replace_by(col);
- memdelete(p_node);
- p_node = col;
-
- // create an alias for the rigid body collision node
- RigidBody *rb = Object::cast_to<RigidBody>(col);
- // create a new Box collision shape and set the right extents
- Ref<BoxShape> shape = memnew(BoxShape);
- shape->set_extents(aabb.get_size() * 0.5);
- CollisionShape *colshape = memnew(CollisionShape);
- colshape->set_name("shape");
- colshape->set_shape(shape);
- // reparent the new collision shape to the rigid body collision node
- rb->add_child(colshape);
- colshape->set_owner(p_node->get_owner());
+ Ref<Mesh> mesh = mi->get_mesh();
+
+ if (mesh.is_valid()) {
+ List<Ref<Shape> > shapes;
+ if (collision_map.has(mesh)) {
+ shapes = collision_map[mesh];
+ } else {
+ _gen_shape_list(mesh, shapes, true);
+ }
+
+ RigidBody *rigid_body = memnew(RigidBody);
+ rigid_body->set_name(_fixstr(name, "rigid"));
+ p_node->replace_by(rigid_body);
+ rigid_body->set_transform(mi->get_transform());
+ p_node = rigid_body;
+ mi->set_name("mesh");
+ mi->set_transform(Transform());
+ rigid_body->add_child(mi);
+ mi->set_owner(rigid_body->get_owner());
+
+ int idx = 0;
+ for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
+
+ CollisionShape *cshape = memnew(CollisionShape);
+ cshape->set_shape(E->get());
+ rigid_body->add_child(cshape);
+
+ cshape->set_name("shape" + itos(idx));
+ cshape->set_owner(p_node->get_owner());
+ idx++;
+ }
+ }
} else if ((_teststr(name, "col") || (_teststr(name, "convcol"))) && Object::cast_to<MeshInstance>(p_node)) {
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
- Node *col;
- if (_teststr(name, "col")) {
- String new_name = _fixstr(name, "col");
- if (mi->get_parent() && !mi->get_parent()->has_node(new_name)) {
- mi->set_name(new_name);
+ Ref<Mesh> mesh = mi->get_mesh();
+
+ if (mesh.is_valid()) {
+ List<Ref<Shape> > shapes;
+ String fixed_name;
+ if (collision_map.has(mesh)) {
+ shapes = collision_map[mesh];
+ } else if (_teststr(name, "col")) {
+ _gen_shape_list(mesh, shapes, false);
+ collision_map[mesh] = shapes;
+ } else if (_teststr(name, "convcol")) {
+ _gen_shape_list(mesh, shapes, true);
+ collision_map[mesh] = shapes;
}
- col = mi->create_trimesh_collision_node();
- ERR_FAIL_COND_V(!col, NULL);
- col->set_name("col");
- } else {
- String new_name = _fixstr(name, "convcol");
- if (mi->get_parent() && !mi->get_parent()->has_node(new_name)) {
- mi->set_name(new_name);
+ if (_teststr(name, "col")) {
+ fixed_name = _fixstr(name, "col");
+ } else if (_teststr(name, "convcol")) {
+ fixed_name = _fixstr(name, "convcol");
}
- col = mi->create_convex_collision_node();
- ERR_FAIL_COND_V(!col, NULL);
- col->set_name("convcol");
- }
+ if (fixed_name != String()) {
+ if (mi->get_parent() && !mi->get_parent()->has_node(fixed_name)) {
+ mi->set_name(fixed_name);
+ }
+ }
- p_node->add_child(col);
+ if (shapes.size()) {
+ StaticBody *col = memnew(StaticBody);
+ col->set_name("static_collision");
+ mi->add_child(col);
+ col->set_owner(mi->get_owner());
- StaticBody *sb = Object::cast_to<StaticBody>(col);
- CollisionShape *colshape = Object::cast_to<CollisionShape>(sb->get_child(0));
- colshape->set_name("shape");
- col->add_child(colshape);
- colshape->set_owner(p_node->get_owner());
- sb->set_owner(p_node->get_owner());
+ int idx = 0;
+ for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
+
+ CollisionShape *cshape = memnew(CollisionShape);
+ cshape->set_shape(E->get());
+ col->add_child(cshape);
+
+ cshape->set_name("shape" + itos(idx));
+ cshape->set_owner(p_node->get_owner());
+
+ idx++;
+ }
+ }
+ }
} else if (_teststr(name, "navmesh") && Object::cast_to<MeshInstance>(p_node)) {
@@ -574,48 +620,35 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
Ref<ArrayMesh> mesh = mi->get_mesh();
if (!mesh.is_null()) {
- if (_teststr(mesh->get_name(), "col") || _teststr(mesh->get_name(), "convcol")) {
- Ref<Shape> shape;
- if (_teststr(mesh->get_name(), "col")) {
- mesh->set_name(_fixstr(mesh->get_name(), "col"));
-
- if (collision_map.has(mesh)) {
- shape = collision_map[mesh];
-
- } else {
-
- shape = mesh->create_trimesh_shape();
- if (!shape.is_null())
- collision_map[mesh] = shape;
- }
- } else if (_teststr(mesh->get_name(), "convcol")) {
- mesh->set_name(_fixstr(mesh->get_name(), "convcol"));
+ List<Ref<Shape> > shapes;
+ if (collision_map.has(mesh)) {
+ shapes = collision_map[mesh];
+ } else if (_teststr(mesh->get_name(), "col")) {
+ _gen_shape_list(mesh, shapes, false);
+ collision_map[mesh] = shapes;
+ mesh->set_name(_fixstr(mesh->get_name(), "col"));
+ } else if (_teststr(mesh->get_name(), "convcol")) {
+ _gen_shape_list(mesh, shapes, true);
+ collision_map[mesh] = shapes;
+ mesh->set_name(_fixstr(mesh->get_name(), "convcol"));
+ }
- if (collision_map.has(mesh)) {
- shape = collision_map[mesh];
+ if (shapes.size()) {
+ StaticBody *col = memnew(StaticBody);
+ col->set_name("static_collision");
+ p_node->add_child(col);
+ col->set_owner(p_node->get_owner());
- } else {
+ int idx = 0;
+ for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
- shape = mesh->create_convex_shape();
- if (!shape.is_null())
- collision_map[mesh] = shape;
- }
- }
-
- if (!shape.is_null()) {
- StaticBody *col = memnew(StaticBody);
CollisionShape *cshape = memnew(CollisionShape);
- cshape->set_shape(shape);
+ cshape->set_shape(E->get());
col->add_child(cshape);
- col->set_transform(mi->get_transform());
- col->set_name(mi->get_name());
- p_node->replace_by(col);
- memdelete(p_node);
- p_node = col;
-
- cshape->set_name("shape");
+ cshape->set_name("shape" + itos(idx));
cshape->set_owner(p_node->get_owner());
+ idx++;
}
}
}
@@ -675,6 +708,10 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_interpolate(j, from, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, 0, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->value_track_interpolate(j, from);
+ new_anim->track_insert_key(dtrack, 0, var);
+ }
}
}
@@ -685,6 +722,10 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_get_key(j, k, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, kt - from, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->track_get_key_value(j, k);
+ new_anim->track_insert_key(dtrack, kt - from, var);
+ }
}
if (dtrack != -1 && kt >= to) {
@@ -696,6 +737,10 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_interpolate(j, to, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, to - from, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->value_track_interpolate(j, to);
+ new_anim->track_insert_key(dtrack, to - from, var);
+ }
}
}
@@ -713,6 +758,12 @@ void ResourceImporterScene::_create_clips(Node *scene, const Array &p_clips, boo
default_anim->transform_track_interpolate(j, to, &p, &q, &s);
new_anim->transform_track_insert_key(dtrack, to - from, p, q, s);
}
+ if (default_anim->track_get_type(j) == Animation::TYPE_VALUE) {
+ Variant var = default_anim->value_track_interpolate(j, from);
+ new_anim->track_insert_key(dtrack, 0, var);
+ Variant to_var = default_anim->value_track_interpolate(j, to);
+ new_anim->track_insert_key(dtrack, to - from, to_var);
+ }
}
}
@@ -942,6 +993,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
old_anim->copy_track(i, anim);
}
}
+ anim->set_loop(old_anim->has_loop());
}
}
@@ -972,7 +1024,7 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
} else {
ResourceSaver::save(ext_name, mat, ResourceSaver::FLAG_CHANGE_PATH);
- p_materials[mat] = ResourceLoader::load(ext_name);
+ p_materials[mat] = ResourceLoader::load(ext_name, "", true); // disable loading from the cache.
}
}
@@ -1018,13 +1070,13 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
String ext_name = p_base_path.plus_file(_make_extname(mat->get_name()) + ".material");
;
- if (FileAccess::exists(ext_name)) {
+ if (p_keep_materials && FileAccess::exists(ext_name)) {
//if exists, use it
p_materials[mat] = ResourceLoader::load(ext_name);
} else {
ResourceSaver::save(ext_name, mat, ResourceSaver::FLAG_CHANGE_PATH);
- p_materials[mat] = ResourceLoader::load(ext_name);
+ p_materials[mat] = ResourceLoader::load(ext_name, "", true); // disable loading from the cache.
}
}
@@ -1093,7 +1145,7 @@ void ResourceImporterScene::get_import_options(List<ImportOption> *r_options, in
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/import", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/fps", PROPERTY_HINT_RANGE, "1,120,1"), 15));
r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "animation/filter_script", PROPERTY_HINT_MULTILINE_TEXT), ""));
- r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files"), animations_out ? true : false));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "animation/storage", PROPERTY_HINT_ENUM, "Built-In,Files", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), animations_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/keep_custom_tracks"), animations_out ? true : false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "animation/optimizer/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "animation/optimizer/max_linear_error"), 0.05));
@@ -1239,6 +1291,13 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
}
String root_type = p_options["nodes/root_type"];
+ root_type = root_type.split(" ")[0]; // full root_type is "ClassName (filename.gd)" for a script global class.
+
+ Ref<Script> root_script = NULL;
+ if (ScriptServer::is_global_class(root_type)) {
+ root_script = ResourceLoader::load(ScriptServer::get_global_class_path(root_type));
+ root_type = ScriptServer::get_global_class_base(root_type);
+ }
if (root_type != "Spatial") {
Node *base_node = Object::cast_to<Node>(ClassDB::instance(root_type));
@@ -1251,12 +1310,19 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
}
}
+ if (root_script.is_valid()) {
+ scene->set_script(Variant(root_script));
+ }
+
if (Object::cast_to<Spatial>(scene)) {
float root_scale = p_options["nodes/root_scale"];
Object::cast_to<Spatial>(scene)->scale(Vector3(root_scale, root_scale, root_scale));
}
- scene->set_name(p_options["nodes/root_name"]);
+ if (p_options["nodes/root_name"] != "Scene Root")
+ scene->set_name(p_options["nodes/root_name"]);
+ else
+ scene->set_name(p_save_path.get_file().get_basename());
err = OK;
@@ -1268,7 +1334,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
float anim_optimizer_maxang = p_options["animation/optimizer/max_angle"];
int light_bake_mode = p_options["meshes/light_baking"];
- Map<Ref<ArrayMesh>, Ref<Shape> > collision_map;
+ Map<Ref<Mesh>, List<Ref<Shape> > > collision_map;
scene = _fix_node(scene, scene, collision_map, LightBakeMode(light_bake_mode));
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index 99f8b1a8e0..b10c4da2e5 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -146,7 +146,7 @@ public:
void _make_external_resources(Node *p_node, const String &p_base_path, bool p_make_animations, bool p_keep_animations, bool p_make_materials, bool p_keep_materials, bool p_make_meshes, Map<Ref<Animation>, Ref<Animation> > &p_animations, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes);
- Node *_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map, LightBakeMode p_light_bake_mode);
+ Node *_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape> > > &collision_map, LightBakeMode p_light_bake_mode);
void _create_clips(Node *scene, const Array &p_clips, bool p_bake_all);
void _filter_anim_tracks(Ref<Animation> anim, Set<String> &keep);
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index d72de3de48..5865ceb3af 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -81,7 +81,7 @@ void ResourceImporterTexture::_texture_reimport_normal(const Ref<StreamTexture>
void ResourceImporterTexture::update_imports() {
if (EditorFileSystem::get_singleton()->is_scanning() || EditorFileSystem::get_singleton()->is_importing()) {
- return; // do nothing for noe
+ return; // do nothing for now
}
mutex->lock();
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
new file mode 100644
index 0000000000..eca4e58abe
--- /dev/null
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -0,0 +1,412 @@
+/*************************************************************************/
+/* resource_importer_texture_atlas.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 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 */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "resource_importer_texture_atlas.h"
+
+#include "atlas_import_failed.xpm"
+#include "core/io/image_loader.h"
+#include "core/io/resource_saver.h"
+#include "core/os/file_access.h"
+#include "editor/editor_atlas_packer.h"
+#include "scene/resources/mesh.h"
+#include "scene/resources/texture.h"
+
+String ResourceImporterTextureAtlas::get_importer_name() const {
+
+ return "texture_atlas";
+}
+
+String ResourceImporterTextureAtlas::get_visible_name() const {
+
+ return "TextureAtlas";
+}
+void ResourceImporterTextureAtlas::get_recognized_extensions(List<String> *p_extensions) const {
+
+ ImageLoader::get_recognized_extensions(p_extensions);
+}
+
+String ResourceImporterTextureAtlas::get_save_extension() const {
+ return "res";
+}
+
+String ResourceImporterTextureAtlas::get_resource_type() const {
+
+ return "Texture";
+}
+
+bool ResourceImporterTextureAtlas::get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const {
+
+ return true;
+}
+
+int ResourceImporterTextureAtlas::get_preset_count() const {
+ return 0;
+}
+String ResourceImporterTextureAtlas::get_preset_name(int p_idx) const {
+
+ return String();
+}
+
+void ResourceImporterTextureAtlas::get_import_options(List<ImportOption> *r_options, int p_preset) const {
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "atlas_file", PROPERTY_HINT_SAVE_FILE, "*.png"), ""));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "import_mode", PROPERTY_HINT_ENUM, "Region,Mesh2D"), 0));
+}
+
+String ResourceImporterTextureAtlas::get_option_group_file() const {
+ return "atlas_file";
+}
+
+Error ResourceImporterTextureAtlas::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
+
+ /* If this happens, it's because the atlas_file field was not filled, so just import a broken texture */
+
+ //use an xpm because it's size independent, the editor images are vector and size dependent
+ //it's a simple hack
+ Ref<Image> broken = memnew(Image((const char **)atlas_import_failed_xpm));
+ Ref<ImageTexture> broken_texture;
+ broken_texture.instance();
+ broken_texture->create_from_image(broken);
+
+ String target_file = p_save_path + ".tex";
+
+ ResourceSaver::save(target_file, broken_texture);
+
+ return OK;
+}
+
+static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_transposed, Ref<Image> p_image, const Ref<Image> &p_src_image) {
+
+ int width = p_image->get_width();
+ int height = p_image->get_height();
+ int src_width = p_src_image->get_width();
+ int src_height = p_src_image->get_height();
+
+ int x[3];
+ int y[3];
+
+ for (int j = 0; j < 3; j++) {
+
+ x[j] = vertices[j].x;
+ y[j] = vertices[j].y;
+ }
+
+ // sort the points vertically
+ if (y[1] > y[2]) {
+ SWAP(x[1], x[2]);
+ SWAP(y[1], y[2]);
+ }
+ if (y[0] > y[1]) {
+ SWAP(x[0], x[1]);
+ SWAP(y[0], y[1]);
+ }
+ if (y[1] > y[2]) {
+ SWAP(x[1], x[2]);
+ SWAP(y[1], y[2]);
+ }
+
+ double dx_far = double(x[2] - x[0]) / (y[2] - y[0] + 1);
+ double dx_upper = double(x[1] - x[0]) / (y[1] - y[0] + 1);
+ double dx_low = double(x[2] - x[1]) / (y[2] - y[1] + 1);
+ double xf = x[0];
+ double xt = x[0] + dx_upper; // if y[0] == y[1], special case
+ for (int yi = y[0]; yi <= (y[2] > height - 1 ? height - 1 : y[2]); yi++) {
+ if (yi >= 0) {
+ for (int xi = (xf > 0 ? int(xf) : 0); xi <= (xt < width ? xt : width - 1); xi++) {
+
+ int px = xi, py = yi;
+ int sx = px, sy = py;
+ sx = CLAMP(sx, 0, src_width);
+ sy = CLAMP(sy, 0, src_height);
+ Color color = p_src_image->get_pixel(sx, sy);
+ if (p_transposed) {
+ SWAP(px, py);
+ }
+ px += p_offset.x;
+ py += p_offset.y;
+
+ //may have been cropped, so don't blit what is not visible?
+ if (px < 0 || px >= width) {
+ continue;
+ }
+ if (py < 0 || py >= height) {
+ continue;
+ }
+ p_image->set_pixel(px, py, color);
+ }
+
+ for (int xi = (xf < width ? int(xf) : width - 1); xi >= (xt > 0 ? xt : 0); xi--) {
+ int px = xi, py = yi;
+ int sx = px, sy = py;
+ sx = CLAMP(sx, 0, src_width);
+ sy = CLAMP(sy, 0, src_height);
+ Color color = p_src_image->get_pixel(sx, sy);
+ if (p_transposed) {
+ SWAP(px, py);
+ }
+ px += p_offset.x;
+ py += p_offset.y;
+
+ //may have been cropped, so don't blit what is not visible?
+ if (px < 0 || px >= width) {
+ continue;
+ }
+ if (py < 0 || py >= height) {
+ continue;
+ }
+ p_image->set_pixel(px, py, color);
+ }
+ }
+ xf += dx_far;
+ if (yi < y[1])
+ xt += dx_upper;
+ else
+ xt += dx_low;
+ }
+}
+
+Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths) {
+
+ ERR_FAIL_COND_V(p_source_file_options.size() == 0, ERR_BUG); //should never happen
+
+ Vector<EditorAtlasPacker::Chart> charts;
+ Vector<PackData> pack_data_files;
+
+ pack_data_files.resize(p_source_file_options.size());
+
+ int idx = 0;
+ for (const Map<String, Map<StringName, Variant> >::Element *E = p_source_file_options.front(); E; E = E->next(), idx++) {
+
+ PackData &pack_data = pack_data_files.write[idx];
+ String source = E->key();
+ const Map<StringName, Variant> &options = E->get();
+
+ Ref<Image> image;
+ image.instance();
+ Error err = ImageLoader::load_image(source, image);
+ ERR_CONTINUE(err != OK);
+
+ pack_data.image = image;
+
+ int mode = options["import_mode"];
+
+ if (mode == IMPORT_MODE_REGION) {
+
+ pack_data.is_mesh = false;
+
+ EditorAtlasPacker::Chart chart;
+
+ //clip a region from the image
+ Rect2 used_rect = image->get_used_rect();
+ pack_data.region = used_rect;
+
+ chart.vertices.push_back(used_rect.position);
+ chart.vertices.push_back(used_rect.position + Vector2(used_rect.size.x, 0));
+ chart.vertices.push_back(used_rect.position + Vector2(used_rect.size.x, used_rect.size.y));
+ chart.vertices.push_back(used_rect.position + Vector2(0, used_rect.size.y));
+ EditorAtlasPacker::Chart::Face f;
+ f.vertex[0] = 0;
+ f.vertex[1] = 1;
+ f.vertex[2] = 2;
+ chart.faces.push_back(f);
+ f.vertex[0] = 0;
+ f.vertex[1] = 2;
+ f.vertex[2] = 3;
+ chart.faces.push_back(f);
+ chart.can_transpose = false;
+ pack_data.chart_vertices.push_back(chart.vertices);
+ pack_data.chart_pieces.push_back(charts.size());
+ charts.push_back(chart);
+
+ } else {
+ pack_data.is_mesh = true;
+
+ Ref<BitMap> bit_map;
+ bit_map.instance();
+ bit_map->create_from_image_alpha(image);
+ Vector<Vector<Vector2> > polygons = bit_map->clip_opaque_to_polygons(Rect2(0, 0, image->get_width(), image->get_height()));
+
+ for (int j = 0; j < polygons.size(); j++) {
+
+ EditorAtlasPacker::Chart chart;
+ chart.vertices = polygons[j];
+ chart.can_transpose = true;
+
+ Vector<int> poly = Geometry::triangulate_polygon(polygons[j]);
+ for (int i = 0; i < poly.size(); i += 3) {
+
+ EditorAtlasPacker::Chart::Face f;
+ f.vertex[0] = poly[i + 0];
+ f.vertex[1] = poly[i + 1];
+ f.vertex[2] = poly[i + 2];
+ chart.faces.push_back(f);
+ }
+
+ pack_data.chart_pieces.push_back(charts.size());
+ charts.push_back(chart);
+
+ pack_data.chart_vertices.push_back(polygons[j]);
+ }
+ }
+ }
+
+ //pack the charts
+ int atlas_width, atlas_height;
+ EditorAtlasPacker::chart_pack(charts, atlas_width, atlas_height);
+
+ //blit the atlas
+ Ref<Image> new_atlas;
+ new_atlas.instance();
+ new_atlas->create(atlas_width, atlas_height, false, Image::FORMAT_RGBA8);
+
+ new_atlas->lock();
+
+ for (int i = 0; i < pack_data_files.size(); i++) {
+
+ PackData &pack_data = pack_data_files.write[i];
+ pack_data.image->lock();
+ for (int j = 0; j < pack_data.chart_pieces.size(); j++) {
+ const EditorAtlasPacker::Chart &chart = charts[pack_data.chart_pieces[j]];
+ for (int k = 0; k < chart.faces.size(); k++) {
+ Vector2 positions[3];
+ for (int l = 0; l < 3; l++) {
+ int vertex_idx = chart.faces[k].vertex[l];
+ positions[l] = chart.vertices[vertex_idx];
+ }
+
+ _plot_triangle(positions, chart.final_offset, chart.transposed, new_atlas, pack_data.image);
+ }
+ }
+ pack_data.image->unlock();
+ }
+ new_atlas->unlock();
+
+ //save the atlas
+
+ new_atlas->save_png(p_group_file);
+
+ //update cache if existing, else create
+ Ref<Texture> cache;
+ if (ResourceCache::has(p_group_file)) {
+ Resource *resptr = ResourceCache::get(p_group_file);
+ cache.reference_ptr(resptr);
+ } else {
+ Ref<ImageTexture> res_cache;
+ res_cache.instance();
+ res_cache->create_from_image(new_atlas);
+ res_cache->set_path(p_group_file);
+ cache = res_cache;
+ }
+
+ //save the images
+ idx = 0;
+ for (const Map<String, Map<StringName, Variant> >::Element *E = p_source_file_options.front(); E; E = E->next(), idx++) {
+
+ PackData &pack_data = pack_data_files.write[idx];
+
+ Ref<Texture> texture;
+
+ if (!pack_data.is_mesh) {
+ Vector2 offset = charts[pack_data.chart_pieces[0]].vertices[0] + charts[pack_data.chart_pieces[0]].final_offset;
+
+ //region
+ Ref<AtlasTexture> atlas_texture;
+ atlas_texture.instance();
+ atlas_texture->set_atlas(cache);
+ atlas_texture->set_region(Rect2(offset, pack_data.region.size));
+ atlas_texture->set_margin(Rect2(pack_data.region.position, Size2(pack_data.image->get_width(), pack_data.image->get_height()) - pack_data.region.size));
+
+ texture = atlas_texture;
+ } else {
+ Ref<ArrayMesh> mesh;
+ mesh.instance();
+
+ for (int i = 0; i < pack_data.chart_pieces.size(); i++) {
+ const EditorAtlasPacker::Chart &chart = charts[pack_data.chart_pieces[i]];
+ PoolVector<Vector2> vertices;
+ PoolVector<int> indices;
+ PoolVector<Vector2> uvs;
+ int vc = chart.vertices.size();
+ int fc = chart.faces.size();
+ vertices.resize(vc);
+ uvs.resize(vc);
+ indices.resize(fc * 3);
+
+ {
+ PoolVector<Vector2>::Write vw = vertices.write();
+ PoolVector<int>::Write iw = indices.write();
+ PoolVector<Vector2>::Write uvw = uvs.write();
+
+ for (int j = 0; j < vc; j++) {
+ vw[j] = chart.vertices[j];
+ Vector2 uv = chart.vertices[j];
+ if (chart.transposed) {
+ SWAP(uv.x, uv.y);
+ }
+ uv += chart.final_offset;
+ uv /= new_atlas->get_size(); //normalize uv to 0-1 range
+ uvw[j] = uv;
+ }
+
+ for (int j = 0; j < fc; j++) {
+ iw[j * 3 + 0] = chart.faces[j].vertex[0];
+ iw[j * 3 + 1] = chart.faces[j].vertex[1];
+ iw[j * 3 + 2] = chart.faces[j].vertex[2];
+ }
+ }
+
+ Array arrays;
+ arrays.resize(Mesh::ARRAY_MAX);
+ arrays[Mesh::ARRAY_VERTEX] = vertices;
+ arrays[Mesh::ARRAY_TEX_UV] = uvs;
+ arrays[Mesh::ARRAY_INDEX] = indices;
+
+ mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arrays);
+ }
+
+ Ref<MeshTexture> mesh_texture;
+ mesh_texture.instance();
+ mesh_texture->set_base_texture(cache);
+ mesh_texture->set_image_size(pack_data.image->get_size());
+ mesh_texture->set_mesh(mesh);
+
+ texture = mesh_texture;
+ //mesh
+ }
+
+ String save_path = p_base_paths[E->key()] + ".res";
+ ResourceSaver::save(save_path, texture);
+ }
+
+ return OK;
+}
+
+ResourceImporterTextureAtlas::ResourceImporterTextureAtlas() {
+}
diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h
new file mode 100644
index 0000000000..042deacfe3
--- /dev/null
+++ b/editor/import/resource_importer_texture_atlas.h
@@ -0,0 +1,72 @@
+/*************************************************************************/
+/* resource_importer_texture_atlas.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* 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 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 */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef RESOURCE_IMPORTER_TEXTURE_ATLAS_H
+#define RESOURCE_IMPORTER_TEXTURE_ATLAS_H
+
+#include "core/image.h"
+#include "core/io/resource_importer.h"
+class ResourceImporterTextureAtlas : public ResourceImporter {
+ GDCLASS(ResourceImporterTextureAtlas, ResourceImporter)
+
+ struct PackData {
+ Rect2 region;
+ bool is_mesh;
+ Vector<int> chart_pieces; //one for region, many for mesh
+ Vector<Vector<Vector2> > chart_vertices; //for mesh
+ Ref<Image> image;
+ };
+
+public:
+ enum ImportMode {
+ IMPORT_MODE_REGION,
+ IMPORT_MODE_2D_MESH
+ };
+
+ virtual String get_importer_name() const;
+ virtual String get_visible_name() const;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+
+ virtual int get_preset_count() const;
+ virtual String get_preset_name(int p_idx) const;
+
+ virtual void get_import_options(List<ImportOption> *r_options, int p_preset = 0) const;
+ virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
+ virtual String get_option_group_file() const;
+
+ virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
+ virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths);
+
+ ResourceImporterTextureAtlas();
+};
+
+#endif // RESOURCE_IMPORTER_TEXTURE_ATLAS_H
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 857d8992fd..e39f2dabaa 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -35,6 +35,9 @@
#include "core/os/file_access.h"
#include "scene/resources/audio_stream_sample.h"
+const float TRIM_DB_LIMIT = -50;
+const int TRIM_FADE_OUT_FRAMES = 500;
+
String ResourceImporterWAV::get_importer_name() const {
return "wav";
@@ -116,7 +119,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
file->close();
memdelete(file);
- ERR_EXPLAIN("Not a WAV file (no WAVE RIFF Header)")
+ ERR_EXPLAIN("Not a WAV file (no WAVE RIFF Header)");
ERR_FAIL_V(ERR_FILE_UNRECOGNIZED);
}
@@ -393,11 +396,17 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
if (trim && !loop && format_channels > 0) {
int first = 0;
- int last = (frames * format_channels) - 1;
+ int last = (frames / format_channels) - 1;
bool found = false;
- float limit = Math::db2linear((float)-30);
- for (int i = 0; i < data.size(); i++) {
- float amp = Math::abs(data[i]);
+ float limit = Math::db2linear(TRIM_DB_LIMIT);
+
+ for (int i = 0; i < data.size() / format_channels; i++) {
+ float ampChannelSum = 0;
+ for (int j = 0; j < format_channels; j++) {
+ ampChannelSum += Math::abs(data[(i * format_channels) + j]);
+ }
+
+ float amp = Math::abs(ampChannelSum / (float)format_channels);
if (!found && amp > limit) {
first = i;
@@ -409,15 +418,20 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
- first /= format_channels;
- last /= format_channels;
-
if (first < last) {
-
Vector<float> new_data;
- new_data.resize((last - first + 1) * format_channels);
- for (int i = first * format_channels; i < (last + 1) * format_channels; i++) {
- new_data.write[i - first * format_channels] = data[i];
+ new_data.resize((last - first) * format_channels);
+ for (int i = first; i < last; i++) {
+
+ float fadeOutMult = 1;
+
+ if (last - i < TRIM_FADE_OUT_FRAMES) {
+ fadeOutMult = ((float)(last - i - 1) / (float)TRIM_FADE_OUT_FRAMES);
+ }
+
+ for (int j = 0; j < format_channels; j++) {
+ new_data.write[((i - first) * format_channels) + j] = data[(i * format_channels) + j] * fadeOutMult;
+ }
}
data = new_data;