diff options
-rw-r--r-- | SConstruct | 4 | ||||
-rw-r--r-- | core/error_list.h | 2 | ||||
-rw-r--r-- | core/global_constants.cpp | 2 | ||||
-rw-r--r-- | core/globals.cpp | 42 | ||||
-rw-r--r-- | core/image.cpp | 55 | ||||
-rw-r--r-- | core/image.h | 2 | ||||
-rw-r--r-- | core/io/resource_import.cpp | 25 | ||||
-rw-r--r-- | core/io/resource_import.h | 1 | ||||
-rw-r--r-- | core/os/os.h | 2 | ||||
-rw-r--r-- | core/translation.cpp | 1 | ||||
-rw-r--r-- | core/variant_parser.cpp | 18 | ||||
-rw-r--r-- | doc/base/classes.xml | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 1 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 84 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 6 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 88 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.h | 21 | ||||
-rw-r--r-- | drivers/gles3/shader_compiler_gles3.cpp | 1 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 131 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 8 | ||||
-rw-r--r-- | drivers/unix/os_unix.h | 2 | ||||
-rw-r--r-- | main/main.cpp | 12 | ||||
-rw-r--r-- | misc/dist/docker/Dockerfile (renamed from tools/dist/docker/Dockerfile) | 0 | ||||
-rw-r--r-- | misc/dist/docker/README.md (renamed from tools/dist/docker/README.md) | 0 | ||||
-rw-r--r-- | misc/dist/docker/scripts/install-android-tools (renamed from tools/dist/docker/scripts/install-android-tools) | 0 | ||||
-rw-r--r-- | misc/dist/html_fs/godotfs.js (renamed from tools/dist/html_fs/godotfs.js) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/data.pck (renamed from tools/dist/ios_xcode/godot_xcode/data.pck) | 0 | ||||
-rwxr-xr-x | misc/dist/ios_xcode/godot_xcode/godot_debug.iphone (renamed from tools/dist/ios_xcode/godot_xcode/godot_debug.iphone) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png) | bin | 564 -> 564 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png) | bin | 683 -> 683 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png) | bin | 817 -> 817 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png) | bin | 1676 -> 1676 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png) | bin | 2582 -> 2582 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png) | bin | 2582 -> 2582 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png) | bin | 3131 -> 3131 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png) | bin | 634 -> 634 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png) | bin | 3070 -> 3070 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png) | bin | 589 -> 589 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png) | bin | 515 -> 515 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png) | bin | 309 -> 309 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png) | bin | 250 -> 250 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png) | bin | 253 -> 253 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png) | bin | 253 -> 253 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png) | bin | 259 -> 259 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png) | bin | 260 -> 260 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png) | bin | 265 -> 265 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png) | bin | 242 -> 242 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png) | bin | 240 -> 240 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png) | bin | 243 -> 243 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png) | bin | 243 -> 243 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png) | bin | 243 -> 243 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png) | bin | 244 -> 244 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png) | bin | 244 -> 244 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png) | bin | 246 -> 246 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png) | bin | 245 -> 245 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png) | bin | 262 -> 262 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png) | bin | 247 -> 247 bytes | |||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist) | 0 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_xcode/godot_ios/main.m (renamed from tools/dist/ios_xcode/godot_xcode/godot_ios/main.m) | 0 | ||||
-rwxr-xr-x | misc/dist/ios_xcode/godot_xcode/godot_opt.iphone (renamed from tools/dist/ios_xcode/godot_xcode/godot_opt.iphone) | 0 | ||||
-rwxr-xr-x | misc/dist/osx_template.app/Contents/Info.plist (renamed from tools/dist/osx_template.app/Contents/Info.plist) | 0 | ||||
-rw-r--r-- | misc/dist/osx_template.app/Contents/PkgInfo (renamed from tools/dist/osx_template.app/Contents/PkgInfo) | 0 | ||||
-rw-r--r-- | misc/dist/osx_template.app/Contents/Resources/icon.icns (renamed from tools/dist/osx_template.app/Contents/Resources/icon.icns) | bin | 120942 -> 120942 bytes | |||
-rwxr-xr-x | misc/dist/osx_tools.app/Contents/Info.plist (renamed from tools/dist/osx_tools.app/Contents/Info.plist) | 0 | ||||
-rw-r--r-- | misc/dist/osx_tools.app/Contents/PkgInfo (renamed from tools/dist/osx_tools.app/Contents/PkgInfo) | 0 | ||||
-rw-r--r-- | misc/dist/osx_tools.app/Contents/Resources/Godot.icns (renamed from tools/dist/osx_tools.app/Contents/Resources/Godot.icns) | bin | 120942 -> 120942 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/AppxManifest.xml (renamed from tools/dist/uwp_template/AppxManifest.xml) | 0 | ||||
-rw-r--r-- | misc/dist/uwp_template/Assets/SplashScreen.scale-100.png (renamed from tools/dist/uwp_template/Assets/SplashScreen.scale-100.png) | bin | 14919 -> 14919 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png (renamed from tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png) | bin | 7001 -> 7001 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png (renamed from tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png) | bin | 14490 -> 14490 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png (renamed from tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png) | bin | 2067 -> 2067 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png (renamed from tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png) | bin | 3369 -> 3369 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/Assets/StoreLogo.scale-100.png (renamed from tools/dist/uwp_template/Assets/StoreLogo.scale-100.png) | bin | 2339 -> 2339 bytes | |||
-rw-r--r-- | misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png (renamed from tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png) | bin | 7390 -> 7390 bytes | |||
-rw-r--r-- | misc/scripts/addheader.py (renamed from tools/scripts/addheader.py) | 0 | ||||
-rwxr-xr-x | misc/scripts/file-hex-array.py (renamed from tools/scripts/file-hex-array.py) | 0 | ||||
-rw-r--r-- | misc/scripts/make_bmfhdr.py (renamed from tools/scripts/make_bmfhdr.py) | 0 | ||||
-rw-r--r-- | misc/scripts/make_glwrapper.py (renamed from tools/scripts/make_glwrapper.py) | 0 | ||||
-rw-r--r-- | misc/scripts/make_icons.sh (renamed from tools/scripts/make_icons.sh) | 0 | ||||
-rw-r--r-- | misc/scripts/makeargs.py (renamed from tools/scripts/makeargs.py) | 0 | ||||
-rw-r--r-- | misc/scripts/memsort.py (renamed from tools/scripts/memsort.py) | 0 | ||||
-rw-r--r-- | misc/scripts/sort-demos.sh (renamed from tools/scripts/sort-demos.sh) | 4 | ||||
-rw-r--r-- | misc/scripts/svgs_2_pngs.py (renamed from tools/scripts/svgs_2_pngs.py) | 0 | ||||
-rw-r--r-- | modules/etc1/image_etc.cpp | 19 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.cpp | 5 | ||||
-rw-r--r-- | modules/stb_vorbis/audio_stream_ogg_vorbis.cpp | 120 | ||||
-rw-r--r-- | modules/stb_vorbis/audio_stream_ogg_vorbis.h | 17 | ||||
-rw-r--r-- | modules/stb_vorbis/register_types.cpp | 11 | ||||
-rw-r--r-- | modules/stb_vorbis/resource_importer_ogg_vorbis.cpp | 84 | ||||
-rw-r--r-- | modules/stb_vorbis/resource_importer_ogg_vorbis.h | 28 | ||||
-rw-r--r-- | scene/2d/screen_button.cpp | 70 | ||||
-rw-r--r-- | scene/2d/screen_button.h | 11 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 52 | ||||
-rw-r--r-- | scene/3d/gi_probe.h | 11 | ||||
-rw-r--r-- | scene/3d/light.cpp | 3 | ||||
-rw-r--r-- | scene/3d/light.h | 1 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 39 | ||||
-rw-r--r-- | scene/register_scene_types.cpp | 2 | ||||
-rw-r--r-- | scene/resources/audio_stream_sample.cpp | 557 | ||||
-rw-r--r-- | scene/resources/audio_stream_sample.h | 128 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 44 | ||||
-rw-r--r-- | scene/resources/texture.h | 10 | ||||
-rw-r--r-- | servers/physics/joints/generic_6dof_joint_sw.cpp | 2 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 6 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 6 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 8 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.cpp | 41 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.h | 3 | ||||
-rw-r--r-- | servers/visual_server.h | 11 | ||||
-rw-r--r-- | thirdparty/README.md | 14 | ||||
-rw-r--r-- | thirdparty/certs/ca-certificates.crt (renamed from tools/certs/ca-certificates.crt) | 0 | ||||
-rw-r--r-- | thirdparty/fonts/DroidSans.ttf (renamed from tools/editor_fonts/DroidSans.ttf) | bin | 190044 -> 190044 bytes | |||
-rw-r--r-- | thirdparty/fonts/DroidSansArabic.ttf (renamed from tools/editor_fonts/DroidSansArabic.ttf) | bin | 35908 -> 35908 bytes | |||
-rw-r--r-- | thirdparty/fonts/DroidSansFallback.ttf (renamed from tools/editor_fonts/DroidSansFallback.ttf) | bin | 3640264 -> 3640264 bytes | |||
-rw-r--r-- | thirdparty/fonts/DroidSansHebrew.ttf (renamed from tools/editor_fonts/DroidSansHebrew.ttf) | bin | 23076 -> 23076 bytes | |||
-rw-r--r-- | thirdparty/fonts/DroidSansJapanese.ttf (renamed from tools/editor_fonts/DroidSansJapanese.ttf) | bin | 1173140 -> 1173140 bytes | |||
-rw-r--r-- | thirdparty/fonts/DroidSansThai.ttf (renamed from tools/editor_fonts/DroidSansThai.ttf) | bin | 36028 -> 36028 bytes | |||
-rw-r--r-- | thirdparty/fonts/LICENSE.DroidSans.txt (renamed from tools/editor_fonts/LICENSE.DroidSans.txt) | 0 | ||||
-rw-r--r-- | thirdparty/fonts/LICENSE.SourceCodePro.txt (renamed from tools/editor_fonts/LICENSE.SourceCodePro.txt) | 0 | ||||
-rw-r--r-- | thirdparty/fonts/source_code_pro.otf (renamed from tools/editor_fonts/source_code_pro.otf) | bin | 140088 -> 140088 bytes | |||
-rw-r--r-- | tools/SCsub | 121 | ||||
-rw-r--r-- | tools/editor/SCsub | 147 | ||||
-rw-r--r-- | tools/editor/collada/SCsub (renamed from tools/doc/SCsub) | 2 | ||||
-rw-r--r-- | tools/editor/collada/collada.cpp (renamed from tools/collada/collada.cpp) | 0 | ||||
-rw-r--r-- | tools/editor/collada/collada.h (renamed from tools/collada/collada.h) | 0 | ||||
-rw-r--r-- | tools/editor/doc/SCsub (renamed from tools/collada/SCsub) | 2 | ||||
-rw-r--r-- | tools/editor/doc/doc_data.cpp (renamed from tools/doc/doc_data.cpp) | 0 | ||||
-rw-r--r-- | tools/editor/doc/doc_data.h (renamed from tools/doc/doc_data.h) | 0 | ||||
-rw-r--r-- | tools/editor/doc/doc_dump.cpp (renamed from tools/doc/doc_dump.cpp) | 0 | ||||
-rw-r--r-- | tools/editor/doc/doc_dump.h (renamed from tools/doc/doc_dump.h) | 0 | ||||
-rw-r--r-- | tools/editor/editor_file_system.cpp | 64 | ||||
-rw-r--r-- | tools/editor/editor_file_system.h | 2 | ||||
-rw-r--r-- | tools/editor/editor_help.h | 2 | ||||
-rw-r--r-- | tools/editor/editor_import_export.cpp | 10 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 70 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 8 | ||||
-rw-r--r-- | tools/editor/fileserver/SCsub | 2 | ||||
-rw-r--r-- | tools/editor/icons/SCsub | 2 | ||||
-rw-r--r-- | tools/editor/import/SCsub | 2 | ||||
-rw-r--r-- | tools/editor/import/editor_import_collada.cpp (renamed from tools/editor/io_plugins/editor_import_collada.cpp) | 62 | ||||
-rw-r--r-- | tools/editor/import/editor_import_collada.h (renamed from tools/editor/io_plugins/editor_import_collada.h) | 6 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_obj.cpp | 231 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_obj.h | 28 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_scene.cpp | 1328 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_scene.h | 93 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_texture.cpp (renamed from tools/editor/import/resource_import_texture.cpp) | 141 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_texture.h (renamed from tools/editor/import/resource_import_texture.h) | 29 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_wav.cpp | 619 | ||||
-rw-r--r-- | tools/editor/import/resource_importer_wav.h | 30 | ||||
-rw-r--r-- | tools/editor/io_plugins/SCsub | 2 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_translation_import_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/SCsub | 2 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 43 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.h | 11 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 90 | ||||
-rw-r--r-- | tools/editor/project_export.cpp | 6 | ||||
-rw-r--r-- | tools/editor/project_manager.cpp | 22 | ||||
-rw-r--r-- | tools/editor/project_settings.cpp | 2 | ||||
-rw-r--r-- | tools/editor/spatial_editor_gizmos.cpp | 4 | ||||
-rw-r--r-- | tools/editor/translations/Makefile (renamed from tools/translations/Makefile) | 0 | ||||
-rw-r--r-- | tools/editor/translations/README.md (renamed from tools/translations/README.md) | 0 | ||||
-rw-r--r-- | tools/editor/translations/ar.po (renamed from tools/translations/ar.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/bg.po (renamed from tools/translations/bg.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/bn.po (renamed from tools/translations/bn.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/ca.po (renamed from tools/translations/ca.po) | 12 | ||||
-rw-r--r-- | tools/editor/translations/cs.po (renamed from tools/translations/cs.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/da.po (renamed from tools/translations/da.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/de.po (renamed from tools/translations/de.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/de_CH.po (renamed from tools/translations/de_CH.po) | 18 | ||||
-rw-r--r-- | tools/editor/translations/es.po (renamed from tools/translations/es.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/es_AR.po (renamed from tools/translations/es_AR.po) | 20 | ||||
-rwxr-xr-x | tools/editor/translations/extract.py (renamed from tools/translations/extract.py) | 0 | ||||
-rw-r--r-- | tools/editor/translations/fa.po (renamed from tools/translations/fa.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/fr.po (renamed from tools/translations/fr.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/hu.po (renamed from tools/translations/hu.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/id.po (renamed from tools/translations/id.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/it.po (renamed from tools/translations/it.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/ja.po (renamed from tools/translations/ja.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/ko.po (renamed from tools/translations/ko.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/nb.po (renamed from tools/translations/nb.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/pl.po (renamed from tools/translations/pl.po) | 26 | ||||
-rw-r--r-- | tools/editor/translations/pr.po (renamed from tools/translations/pr.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/pt_BR.po (renamed from tools/translations/pt_BR.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/pt_PT.po (renamed from tools/translations/pt_PT.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/ru.po (renamed from tools/translations/ru.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/sk.po (renamed from tools/translations/sk.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/sl.po (renamed from tools/translations/sl.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/tools.pot (renamed from tools/translations/tools.pot) | 10 | ||||
-rw-r--r-- | tools/editor/translations/tr.po (renamed from tools/translations/tr.po) | 20 | ||||
-rw-r--r-- | tools/editor/translations/ur_PK.po (renamed from tools/translations/ur_PK.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/zh_CN.po (renamed from tools/translations/zh_CN.po) | 16 | ||||
-rw-r--r-- | tools/editor/translations/zh_HK.po (renamed from tools/translations/zh_HK.po) | 10 | ||||
-rw-r--r-- | tools/editor/translations/zh_TW.po (renamed from tools/translations/zh_TW.po) | 10 |
198 files changed, 4690 insertions, 754 deletions
diff --git a/SConstruct b/SConstruct index 2ecfea92e3..4c79304ef2 100644 --- a/SConstruct +++ b/SConstruct @@ -358,7 +358,7 @@ if selected_platform in platform_list: SConscript("core/SCsub") SConscript("servers/SCsub") SConscript("scene/SCsub") - SConscript("tools/SCsub") + SConscript("tools/editor/SCsub") SConscript("drivers/SCsub") SConscript("modules/SCsub") @@ -374,7 +374,7 @@ if selected_platform in platform_list: AddToVSProject(env.modules_sources) AddToVSProject(env.scene_sources) AddToVSProject(env.servers_sources) - AddToVSProject(env.tool_sources) + AddToVSProject(env.editor_sources) # this env flag won't work, it needs to be set in env_base=Environment(MSVC_VERSION='9.0') # Even then, SCons still seems to ignore it and builds with the latest MSVC... diff --git a/core/error_list.h b/core/error_list.h index c3cd9b399d..f4063a9285 100644 --- a/core/error_list.h +++ b/core/error_list.h @@ -58,7 +58,7 @@ enum Error { ERR_FILE_EOF, ERR_CANT_OPEN, ///< Can't open a resource/socket/file ERR_CANT_CREATE, // (20) - ERROR_QUERY_FAILED, + ERR_QUERY_FAILED, ERR_ALREADY_IN_USE, ERR_LOCKED, ///< resource is locked ERR_TIMEOUT, diff --git a/core/global_constants.cpp b/core/global_constants.cpp index be619d9ee3..be811ccbd2 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -434,7 +434,7 @@ static _GlobalConstant _global_constants[]={ BIND_GLOBAL_CONSTANT( ERR_CANT_OPEN ), ///< Can't open a resource/socket/file BIND_GLOBAL_CONSTANT( ERR_CANT_CREATE ), BIND_GLOBAL_CONSTANT( ERR_PARSE_ERROR ), - BIND_GLOBAL_CONSTANT( ERROR_QUERY_FAILED ), + BIND_GLOBAL_CONSTANT( ERR_QUERY_FAILED ), BIND_GLOBAL_CONSTANT( ERR_ALREADY_IN_USE ), BIND_GLOBAL_CONSTANT( ERR_LOCKED ), ///< resource is locked BIND_GLOBAL_CONSTANT( ERR_TIMEOUT ), diff --git a/core/globals.cpp b/core/globals.cpp index af3ec403d5..ed0b6f6d8b 100644 --- a/core/globals.cpp +++ b/core/globals.cpp @@ -38,6 +38,8 @@ #include "io/file_access_network.h" #include "variant_parser.h" +#define FORMAT_VERSION 3 + GlobalConfig *GlobalConfig::singleton=NULL; GlobalConfig *GlobalConfig::get_singleton() { @@ -123,6 +125,7 @@ bool GlobalConfig::_set(const StringName& p_name, const Variant& p_value) { _THREAD_SAFE_METHOD_ + if (p_value.get_type()==Variant::NIL) props.erase(p_name); else { @@ -253,7 +256,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { bool ok = _load_resource_pack(p_main_pack); ERR_FAIL_COND_V(!ok,ERR_CANT_OPEN); - if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { _load_settings("res://override.cfg"); @@ -275,7 +278,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { memdelete(d); } - if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { _load_settings("res://override.cfg"); @@ -291,7 +294,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { if (FileAccessNetworkClient::get_singleton()) { - if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { _load_settings("res://override.cfg"); @@ -311,9 +314,9 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { if (!_load_resource_pack("res://data.pck")) _load_resource_pack("res://data.zip"); // make sure this is load from the resource path - print_line("exists engine cfg? "+itos(FileAccess::exists("/engine.cfg"))); - if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { - print_line("loaded engine.cfg"); + print_line("exists engine cfg? "+itos(FileAccess::exists("/godot.cfg"))); + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { + print_line("loaded godot.cfg"); _load_settings("res://override.cfg"); } @@ -341,7 +344,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { //tries to open pack, but only first time if (first_time && (_load_resource_pack(current_dir+"/"+exec_name+".pck") || _load_resource_pack(current_dir+"/"+exec_name+".zip") )) { - if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { _load_settings("res://override.cfg"); found=true; @@ -350,7 +353,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { } break; } else if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.zip") )) { - if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { + if (_load_settings("res://godot.cfg")==OK || _load_settings_binary("res://godot.cfb")==OK) { _load_settings("res://override.cfg"); found=true; @@ -358,7 +361,7 @@ Error GlobalConfig::setup(const String& p_path,const String & p_main_pack) { } break; - } else if (_load_settings(current_dir+"/engine.cfg")==OK || _load_settings_binary(current_dir+"/engine.cfb")==OK) { + } else if (_load_settings(current_dir+"/godot.cfg")==OK || _load_settings_binary(current_dir+"/godot.cfb")==OK) { _load_settings(current_dir+"/override.cfg"); candidate=current_dir; @@ -416,7 +419,7 @@ Error GlobalConfig::_load_settings_binary(const String p_path) { if (hdr[0]!='E'|| hdr[1]!='C' || hdr[2]!='F' || hdr[3]!='G') { memdelete(f); - ERR_EXPLAIN("Corrupted header in binary engine.cfb (not ECFG)"); + ERR_EXPLAIN("Corrupted header in binary godot.cfb (not ECFG)"); ERR_FAIL_V(ERR_FILE_CORRUPT;) } @@ -491,6 +494,14 @@ Error GlobalConfig::_load_settings(const String p_path) { } if (assign!=String()) { + if (section==String() && assign=="config_version") { + int config_version = value; + if (config_version > FORMAT_VERSION) { + memdelete(f); + ERR_FAIL_COND_V(config_version > FORMAT_VERSION,ERR_FILE_CANT_OPEN); + } + + } set(section+"/"+assign,value); } else if (next_tag.name!=String()) { section=next_tag.name; @@ -526,7 +537,7 @@ void GlobalConfig::clear(const String& p_name) { Error GlobalConfig::save() { - return save_custom(get_resource_path()+"/engine.cfg"); + return save_custom(get_resource_path()+"/godot.cfg"); } Error GlobalConfig::_save_settings_binary(const String& p_file,const Map<String,List<String> > &props,const CustomMap& p_custom) { @@ -536,7 +547,7 @@ Error GlobalConfig::_save_settings_binary(const String& p_file,const Map<String, FileAccess *file = FileAccess::open(p_file,FileAccess::WRITE,&err); if (err!=OK) { - ERR_EXPLAIN("Coudln't save engine.cfb at "+p_file); + ERR_EXPLAIN("Coudln't save godot.cfb at "+p_file); ERR_FAIL_COND_V(err,err) } @@ -604,10 +615,13 @@ Error GlobalConfig::_save_settings_text(const String& p_file,const Map<String,Li FileAccess *file = FileAccess::open(p_file,FileAccess::WRITE,&err); if (err) { - ERR_EXPLAIN("Coudln't save engine.cfg - "+p_file); + ERR_EXPLAIN("Coudln't save godot.cfg - "+p_file); ERR_FAIL_COND_V(err,err) } + file->store_string("config_version="+itos(FORMAT_VERSION)+"\n"); + + for(Map<String,List<String> >::Element *E=props.front();E;E=E->next()) { if (E!=props.front()) @@ -734,7 +748,7 @@ Error GlobalConfig::save_custom(const String& p_path,const CustomMap& p_custom,c Error err = file->open(dst_file,FileAccess::WRITE); if (err) { memdelete(file); - ERR_EXPLAIN("Coudln't save engine.cfg"); + ERR_EXPLAIN("Coudln't save godot.cfg"); ERR_FAIL_COND_V(err,err) } diff --git a/core/image.cpp b/core/image.cpp index 2d038691f2..037ff82452 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -245,7 +245,7 @@ void Image::_get_mipmap_offset_and_size(int p_mipmap,int &r_offset, int &r_width } int Image::get_mipmap_offset(int p_mipmap) const { - ERR_FAIL_INDEX_V(p_mipmap,(mipmaps+1),-1); + ERR_FAIL_INDEX_V(p_mipmap,get_mipmap_count()+1,-1); int ofs,w,h; _get_mipmap_offset_and_size(p_mipmap,ofs,w,h); @@ -1011,7 +1011,7 @@ void Image::shrink_x2() { } } -Error Image::generate_mipmaps(bool p_keep_existing) { +Error Image::generate_mipmaps() { if (!_can_modify(format)) { ERR_EXPLAIN("Cannot generate mipmaps in indexed, compressed or custom image formats."); @@ -1019,15 +1019,14 @@ Error Image::generate_mipmaps(bool p_keep_existing) { } - int mmcount = get_mipmap_count(); + ERR_FAIL_COND_V(width==0 || height==0,ERR_UNCONFIGURED); + + int mmcount; - int from_mm=1; - if (p_keep_existing) { - from_mm=mmcount+1; - } int size = _get_dst_image_size(width,height,format,mmcount); data.resize(size); + print_line("to gen mipmaps w "+itos(width)+" h "+itos(height) +" format "+get_format_name(format)+" mipmaps " +itos(mmcount)+" new size is: "+itos(size)); PoolVector<uint8_t>::Write wp=data.write(); @@ -1043,18 +1042,16 @@ Error Image::generate_mipmaps(bool p_keep_existing) { int ofs,w,h; _get_mipmap_offset_and_size(i,ofs, w,h); - if (i>=from_mm) { - switch(format) { + switch(format) { - case FORMAT_L8: - case FORMAT_R8: _generate_po2_mipmap<1>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - case FORMAT_LA8: - case FORMAT_RG8: _generate_po2_mipmap<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - case FORMAT_RGB8: _generate_po2_mipmap<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - case FORMAT_RGBA8: _generate_po2_mipmap<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; - default: {} - } + case FORMAT_L8: + case FORMAT_R8: _generate_po2_mipmap<1>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_LA8: + case FORMAT_RG8: _generate_po2_mipmap<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_RGB8: _generate_po2_mipmap<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + case FORMAT_RGBA8: _generate_po2_mipmap<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h); break; + default: {} } prev_ofs=ofs; @@ -1077,18 +1074,15 @@ Error Image::generate_mipmaps(bool p_keep_existing) { int ofs,w,h; _get_mipmap_offset_and_size(i,ofs, w,h); - if (i>=from_mm) { - - switch(format) { + switch(format) { - case FORMAT_L8: - case FORMAT_R8: _scale_bilinear<1>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - case FORMAT_LA8: - case FORMAT_RG8: _scale_bilinear<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - case FORMAT_RGB8:_scale_bilinear<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - case FORMAT_RGBA8: _scale_bilinear<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; - default: {} - } + case FORMAT_L8: + case FORMAT_R8: _scale_bilinear<1>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_LA8: + case FORMAT_RG8: _scale_bilinear<2>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_RGB8:_scale_bilinear<3>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + case FORMAT_RGBA8: _scale_bilinear<4>(&wp[prev_ofs], &wp[ofs], prev_w,prev_h,w,h); break; + default: {} } prev_ofs=ofs; @@ -1096,8 +1090,11 @@ Error Image::generate_mipmaps(bool p_keep_existing) { prev_h=h; } + + } + mipmaps=true; return OK; } @@ -1154,7 +1151,7 @@ void Image::create(int p_width, int p_height, bool p_use_mipmaps, Format p_forma ERR_FAIL_INDEX(p_height-1,MAX_HEIGHT); int mm; - int size = _get_dst_image_size(p_width,p_height,p_format,mm,p_use_mipmaps); + int size = _get_dst_image_size(p_width,p_height,p_format,mm,p_use_mipmaps?-1:0); if (size!=p_data.size()) { ERR_EXPLAIN("Expected data size of "+itos(size)+" in Image::create()"); diff --git a/core/image.h b/core/image.h index 620160147b..1a257f28a0 100644 --- a/core/image.h +++ b/core/image.h @@ -196,7 +196,7 @@ public: /** * Generate a mipmap to an image (creates an image 1/4 the size, with averaging of 4->1) */ - Error generate_mipmaps(bool p_keep_existing=false); + Error generate_mipmaps(); void clear_mipmaps(); diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp index d0799cdbe6..556dff3125 100644 --- a/core/io/resource_import.cpp +++ b/core/io/resource_import.cpp @@ -1,5 +1,6 @@ #include "resource_import.h" #include "variant_parser.h" +#include "os/os.h" Error ResourceFormatImporter::_get_path_and_type(const String& p_path, PathAndType &r_path_and_type) const { @@ -36,7 +37,13 @@ Error ResourceFormatImporter::_get_path_and_type(const String& p_path, PathAndTy } if (assign!=String()) { - if (assign=="path") { + if (assign.begins_with("path.") && r_path_and_type.path==String()) { + String feature = assign.get_slicec('.',1); + if (OS::get_singleton()->check_feature_support(feature)) { + r_path_and_type.path=value; + } + + } else if (assign=="path") { r_path_and_type.path=value; } else if (assign=="type") { r_path_and_type.type=value; @@ -84,7 +91,6 @@ RES ResourceFormatImporter::load(const String &p_path,const String& p_original_p void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const{ - print_line("getting exts from: "+itos(importers.size())); Set<String> found; for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) { @@ -92,7 +98,6 @@ void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extension E->get()->get_recognized_extensions(&local_exts); for (List<String>::Element *F=local_exts.front();F;F=F->next()) { if (!found.has(F->get())) { - print_line("adding ext "+String(F->get())); p_extensions->push_back(F->get()); found.insert(F->get()); } @@ -154,6 +159,20 @@ bool ResourceFormatImporter::handles_type(const String& p_type) const { return true; } + +String ResourceFormatImporter::get_internal_resource_path(const String& p_path) const { + + PathAndType pat; + Error err = _get_path_and_type(p_path,pat); + + if (err!=OK) { + + return String(); + } + + return pat.path; +} + String ResourceFormatImporter::get_resource_type(const String &p_path) const { PathAndType pat; diff --git a/core/io/resource_import.h b/core/io/resource_import.h index 939cecfbd9..387b3902fe 100644 --- a/core/io/resource_import.h +++ b/core/io/resource_import.h @@ -31,6 +31,7 @@ public: virtual bool can_be_imported(const String& p_path) const; + String get_internal_resource_path(const String& p_path) const; void add_importer(const Ref<ResourceImporter>& p_importer) { importers.insert(p_importer); } Ref<ResourceImporter> get_importer_by_name(const String& p_name); diff --git a/core/os/os.h b/core/os/os.h index 42c7c18b0c..e179b82dae 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -403,6 +403,8 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsync_enabled() const; + virtual bool check_feature_support(const String& p_feature)=0; + bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); virtual ~OS(); diff --git a/core/translation.cpp b/core/translation.cpp index 8835cb133c..2fee0e6550 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -670,6 +670,7 @@ static const char* locale_names[]={ "Sanskrit (India)", "Santali (India)", "Sardinian (Italy)", +"Scots (Scotland)", "Sindhi (India)", "Northern Sami (Norway)", "Samogitian (Lithuania)", diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 1e938b4899..3507501f27 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -430,7 +430,7 @@ Error VariantParser::_parse_enginecfg(Stream *p_stream, Vector<String>& strings, Token token; get_token(p_stream,token,line,r_err_str); if (token.type!=TK_PARENTHESIS_OPEN) { - r_err_str="Expected '(' in old-style engine.cfg construct"; + r_err_str="Expected '(' in old-style godot.cfg construct"; return ERR_PARSE_ERROR; } @@ -442,7 +442,7 @@ Error VariantParser::_parse_enginecfg(Stream *p_stream, Vector<String>& strings, CharType c=p_stream->get_char(); if (p_stream->is_eof()) { - r_err_str="Unexpected EOF while parsing old-style engine.cfg construct"; + r_err_str="Unexpected EOF while parsing old-style godot.cfg construct"; return ERR_PARSE_ERROR; } @@ -1328,7 +1328,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=arr; return OK; - } else if (id=="key") { // compatibility with engine.cfg + } else if (id=="key") { // compatibility with godot.cfg Vector<String> params; Error err = _parse_enginecfg(p_stream,params,line,r_err_str); @@ -1364,7 +1364,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=ie; return OK; - } else if (id=="mbutton") { // compatibility with engine.cfg + } else if (id=="mbutton") { // compatibility with godot.cfg Vector<String> params; Error err = _parse_enginecfg(p_stream,params,line,r_err_str); @@ -1379,7 +1379,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=ie; return OK; - } else if (id=="jbutton") { // compatibility with engine.cfg + } else if (id=="jbutton") { // compatibility with godot.cfg Vector<String> params; Error err = _parse_enginecfg(p_stream,params,line,r_err_str); @@ -1394,7 +1394,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value=ie; return OK; - } else if (id=="jaxis") { // compatibility with engine.cfg + } else if (id=="jaxis") { // compatibility with godot.cfg Vector<String> params; Error err = _parse_enginecfg(p_stream,params,line,r_err_str); @@ -1412,19 +1412,19 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in value= ie; return OK; - } else if (id=="img") { // compatibility with engine.cfg + } else if (id=="img") { // compatibility with godot.cfg Token token; get_token(p_stream,token,line,r_err_str); if (token.type!=TK_PARENTHESIS_OPEN) { - r_err_str="Expected '(' in old-style engine.cfg construct"; + r_err_str="Expected '(' in old-style godot.cfg construct"; return ERR_PARSE_ERROR; } while(true) { CharType c = p_stream->get_char(); if (p_stream->is_eof()) { - r_err_str="Unexpected EOF in old style engine.cfg img()"; + r_err_str="Unexpected EOF in old style godot.cfg img()"; return ERR_PARSE_ERROR; } if (c==')') diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 9223b887a3..8204af9fd4 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -14300,7 +14300,7 @@ Contains global variables accessible from everywhere. </brief_description> <description> - Contains global variables accessible from everywhere. Use the normal [Object] API, such as "Globals.get(variable)", "Globals.set(variable,value)" or "Globals.has(variable)" to access them. Variables stored in engine.cfg are also loaded into globals, making this object very useful for reading custom game configuration options. + Contains global variables accessible from everywhere. Use the normal [Object] API, such as "Globals.get(variable)", "Globals.set(variable,value)" or "Globals.has(variable)" to access them. Variables stored in godot.cfg are also loaded into globals, making this object very useful for reading custom game configuration options. </description> <methods> <method name="add_property_info"> diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 5c6b9c5410..e1ddad0dc9 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -167,6 +167,7 @@ void RasterizerGLES3::initialize() { void RasterizerGLES3::begin_frame(){ + uint64_t tick = OS::get_singleton()->get_ticks_usec(); double time_total = double(tick)/1000000.0; diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index c0af9b3bcf..b504ef819f 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -148,6 +148,9 @@ void RasterizerSceneGLES3::shadow_atlas_set_size(RID p_atlas,int p_size){ glClearDepth(0.0f); glClear(GL_DEPTH_BUFFER_BIT); + glBindFramebuffer(GL_FRAMEBUFFER,0); + + } } @@ -557,6 +560,8 @@ void RasterizerSceneGLES3::reflection_atlas_set_size(RID p_ref_atlas,int p_size) } + + void RasterizerSceneGLES3::reflection_atlas_set_subdivision(RID p_ref_atlas,int p_subdiv) { ReflectionAtlas *reflection_atlas = reflection_atlas_owner.getornull(p_ref_atlas); @@ -1081,6 +1086,18 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m state.current_line_width=p_material->line_width; } + if (state.current_depth_test!=(!p_material->shader->spatial.ontop)) { + if (p_material->shader->spatial.ontop) { + glDisable(GL_DEPTH_TEST); + + } else { + glEnable(GL_DEPTH_TEST); + + } + + state.current_depth_test=!p_material->shader->spatial.ontop; + } + if (state.current_depth_draw!=p_material->shader->spatial.depth_draw_mode) { switch(p_material->shader->spatial.depth_draw_mode) { case RasterizerStorageGLES3::Shader::Spatial::DEPTH_DRAW_ALPHA_PREPASS: @@ -1204,6 +1221,11 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m } else { +#ifdef TOOLS_ENABLED + if (t->detect_3d) { + t->detect_3d(t->detect_3d_ud); + } +#endif if (storage->config.srgb_decode_supported) { //if SRGB decode extension is present, simply switch the texture to whathever is needed bool must_srgb=false; @@ -1216,9 +1238,8 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material* p_m if (must_srgb) { glTexParameteri(t->target,_TEXTURE_SRGB_DECODE_EXT,_DECODE_EXT); #ifdef TOOLS_ENABLED - if (!(t->flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)) { - t->flags|=VS::TEXTURE_FLAG_CONVERT_TO_LINEAR; - //notify that texture must be set to linear beforehand, so it works in other platforms when exported + if (t->detect_srgb) { + t->detect_srgb(t->detect_srgb_ud); } #endif @@ -1714,6 +1735,9 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements,int p_e state.cull_front=false; glCullFace(GL_BACK); + state.current_depth_test=true; + glEnable(GL_DEPTH_TEST); + state.scene_shader.set_conditional(SceneShaderGLES3::USE_SKELETON,false); state.current_blend_mode=-1; @@ -2297,10 +2321,10 @@ void RasterizerSceneGLES3::_setup_directional_light(int p_index,const Transform& ubo_data.light_params[3]=0; Color shadow_color = li->light_ptr->shadow_color.to_linear(); - ubo_data.light_shadow_color[0]=shadow_color.r; - ubo_data.light_shadow_color[1]=shadow_color.g; - ubo_data.light_shadow_color[2]=shadow_color.b; - ubo_data.light_shadow_color[3]=1.0; + ubo_data.light_shadow_color_contact[0]=shadow_color.r; + ubo_data.light_shadow_color_contact[1]=shadow_color.g; + ubo_data.light_shadow_color_contact[2]=shadow_color.b; + ubo_data.light_shadow_color_contact[3]=li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE]; if (p_use_shadows && li->light_ptr->shadow) { @@ -2456,10 +2480,10 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu ubo_data.light_params[3]=0; Color shadow_color = li->light_ptr->shadow_color.to_linear(); - ubo_data.light_shadow_color[0]=shadow_color.r; - ubo_data.light_shadow_color[1]=shadow_color.g; - ubo_data.light_shadow_color[2]=shadow_color.b; - ubo_data.light_shadow_color[3]=1.0; + ubo_data.light_shadow_color_contact[0]=shadow_color.r; + ubo_data.light_shadow_color_contact[1]=shadow_color.g; + ubo_data.light_shadow_color_contact[2]=shadow_color.b; + ubo_data.light_shadow_color_contact[3]=li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE]; if (li->light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(li->self)) { // fill in the shadow information @@ -2549,10 +2573,10 @@ void RasterizerSceneGLES3::_setup_lights(RID *p_light_cull_result,int p_light_cu ubo_data.light_params[3]=0; Color shadow_color = li->light_ptr->shadow_color.to_linear(); - ubo_data.light_shadow_color[0]=shadow_color.r; - ubo_data.light_shadow_color[1]=shadow_color.g; - ubo_data.light_shadow_color[2]=shadow_color.b; - ubo_data.light_shadow_color[3]=1.0; + ubo_data.light_shadow_color_contact[0]=shadow_color.r; + ubo_data.light_shadow_color_contact[1]=shadow_color.g; + ubo_data.light_shadow_color_contact[2]=shadow_color.b; + ubo_data.light_shadow_color_contact[3]=li->light_ptr->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE]; if (li->light_ptr->shadow && shadow_atlas && shadow_atlas->shadow_owners.has(li->self)) { // fill in the shadow information @@ -3736,14 +3760,20 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C state.ubo_data.shadow_dual_paraboloid_render_side=0; state.ubo_data.shadow_dual_paraboloid_render_zfar=0; + if (storage->frame.current_rt) { + state.ubo_data.screen_pixel_size[0]=1.0/storage->frame.current_rt->width; + state.ubo_data.screen_pixel_size[1]=1.0/storage->frame.current_rt->height; + } + _setup_environment(env,p_cam_projection,p_cam_transform); bool fb_cleared=false; glDepthFunc(GL_LEQUAL); + state.used_contact_shadows=true; - if (storage->frame.current_rt && true) { + if (storage->frame.current_rt && true) { //detect with state.used_contact_shadows too //pre z pass @@ -3770,6 +3800,19 @@ void RasterizerSceneGLES3::render_scene(const Transform& p_cam_transform,const C glColorMask(1,1,1,1); + if (state.used_contact_shadows) { + + glBindFramebuffer(GL_READ_FRAMEBUFFER, storage->frame.current_rt->buffers.fbo); + glReadBuffer(GL_COLOR_ATTACHMENT0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, storage->frame.current_rt->fbo); + glBlitFramebuffer(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, 0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height, GL_DEPTH_BUFFER_BIT, GL_NEAREST); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + //bind depth for read + glActiveTexture(GL_TEXTURE0+storage->config.max_texture_image_units-8); + glBindTexture(GL_TEXTURE_2D,storage->frame.current_rt->depth); + } + fb_cleared=true; render_pass++; } @@ -4403,18 +4446,18 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa render_list.sort_by_depth(false); //shadow is front to back for performance - glDepthMask(true); - glColorMask(1,1,1,1); glDisable(GL_BLEND); glDisable(GL_DITHER); glEnable(GL_DEPTH_TEST); glBindFramebuffer(GL_FRAMEBUFFER,fbo); + glDepthMask(true); + glColorMask(0,0,0,0); + if (custom_vp_size) { glViewport(0,0,custom_vp_size,custom_vp_size); glScissor(0,0,custom_vp_size,custom_vp_size); - } else { glViewport(x,y,width,height); glScissor(x,y,width,height); @@ -4434,7 +4477,7 @@ void RasterizerSceneGLES3::render_shadow(RID p_light,RID p_shadow_atlas,int p_pa state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH,true); - _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,0,!flip_facing,false,true,false,false); + _render_list(render_list.elements,render_list.element_count,light_transform,light_projection,0,flip_facing,false,true,false,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH,false); state.scene_shader.set_conditional(SceneShaderGLES3::RENDER_DEPTH_DUAL_PARABOLOID,false); @@ -5009,5 +5052,4 @@ void RasterizerSceneGLES3::finalize(){ RasterizerSceneGLES3::RasterizerSceneGLES3() { - } diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 7838345e59..81dfa1bf46 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -61,6 +61,7 @@ public: int current_blend_mode; float current_line_width; int current_depth_draw; + bool current_depth_test; GLuint current_main_tex; SceneShaderGLES3 scene_shader; @@ -90,6 +91,7 @@ public: float shadow_slope_scale; float shadow_dual_paraboloid_render_zfar; float shadow_dual_paraboloid_render_side; + float screen_pixel_size[2]; float shadow_atlas_pixel_size[2]; float shadow_directional_pixel_size[2]; float reflection_multiplier; @@ -135,6 +137,7 @@ public: int max_ubo_reflections; int max_skeleton_bones; + bool used_contact_shadows; int spot_light_count; @@ -209,7 +212,6 @@ public: bool _shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow); bool shadow_atlas_update_light(RID p_atlas,RID p_light_intance,float p_coverage,uint64_t p_light_version); - struct DirectionalShadow { GLuint fbo; GLuint depth; @@ -467,7 +469,7 @@ public: float light_color_energy[4]; float light_params[4]; //spot attenuation, spot angle, specular, shadow enabled float light_clamp[4]; - float light_shadow_color[4]; + float light_shadow_color_contact[4]; float shadow_matrix1[16]; //up to here for spot and omni, rest is for directional float shadow_matrix2[16]; float shadow_matrix3[16]; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index a96fd8dd41..06daebbf82 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -218,7 +218,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima if (config.s3tc_supported) { - r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; + r_gl_internal_format=(config.srgb_decode_supported || p_flags&VS::TEXTURE_FLAG_CONVERT_TO_LINEAR)?_EXT_COMPRESSED_SRGB_S3TC_DXT1_NV:_EXT_COMPRESSED_RGBA_S3TC_DXT1_EXT; r_gl_format=GL_RGBA; r_gl_type=GL_UNSIGNED_BYTE; r_compressed=true; @@ -785,7 +785,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image if (texture->compressed) { glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glCompressedTexImage2D( blit_target, i, format,w,h,0,size,&read[ofs] ); + glCompressedTexImage2D( blit_target, i, internal_format,w,h,0,size,&read[ofs] ); } else { glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -814,6 +814,10 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture,const Image& p_image if (texture->flags&VS::TEXTURE_FLAG_MIPMAPS && mipmaps==1 && !texture->ignore_mipmaps && (!(texture->flags&VS::TEXTURE_FLAG_CUBEMAP) || texture->stored_cube_sides==(1<<6)-1)) { //generate mipmaps if they were requested and the image does not contain them glGenerateMipmap(texture->target); + } else if (mipmaps>1) { + glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, 0); + glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, mipmaps-1); + } texture->mipmaps=mipmaps; @@ -1066,6 +1070,26 @@ void RasterizerStorageGLES3::textures_keep_original(bool p_enable) { config.keep_original_textures=p_enable; } +void RasterizerStorageGLES3::texture_set_detect_3d_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void* p_userdata) { + + Texture * texture = texture_owner.get(p_texture); + ERR_FAIL_COND(!texture); + + texture->detect_3d=p_callback; + texture->detect_3d_ud=p_userdata; +} + +void RasterizerStorageGLES3::texture_set_detect_srgb_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void* p_userdata){ + Texture * texture = texture_owner.get(p_texture); + ERR_FAIL_COND(!texture); + + texture->detect_srgb=p_callback; + texture->detect_srgb_ud=p_userdata; + +} + + + RID RasterizerStorageGLES3::texture_create_radiance_cubemap(RID p_source,int p_resolution) const { Texture * texture = texture_owner.get(p_source); @@ -1515,12 +1539,12 @@ void RasterizerStorageGLES3::_update_shader(Shader* p_shader) const { actions->uniforms=&p_shader->uniforms; - } + } break; case VS::SHADER_PARTICLES: { actions=&shaders.actions_particles; actions->uniforms=&p_shader->uniforms; - } + } break; } @@ -2471,6 +2495,7 @@ RID RasterizerStorageGLES3::mesh_create(){ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const PoolVector<uint8_t>& p_array,int p_vertex_count,const PoolVector<uint8_t>& p_index_array,int p_index_count,const Rect3& p_aabb,const Vector<PoolVector<uint8_t> >& p_blend_shapes,const Vector<Rect3>& p_bone_aabbs){ + PoolVector<uint8_t> array = p_array; Mesh *mesh = mesh_owner.getornull(p_mesh); @@ -2669,8 +2694,6 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P int array_size = stride * p_vertex_count; int index_array_size=0; - - print_line("desired size: "+itos(array_size)+" vcount "+itos(p_vertex_count)+" should be: "+itos(array.size()+p_vertex_count*2)+" but is "+itos(array.size())); if (array.size()!=array_size && array.size()+p_vertex_count*2 == array_size) { //old format, convert array = PoolVector<uint8_t>(); @@ -4267,6 +4290,7 @@ RID RasterizerStorageGLES3::light_create(VS::LightType p_type){ light->param[VS::LIGHT_PARAM_SPECULAR]=0.5; light->param[VS::LIGHT_PARAM_RANGE]=1.0; light->param[VS::LIGHT_PARAM_SPOT_ANGLE]=45; + light->param[VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE]=45; light->param[VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE]=0; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET]=0.1; light->param[VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET]=0.3; @@ -4753,6 +4777,7 @@ RID RasterizerStorageGLES3::gi_probe_create() { gip->bounds=Rect3(Vector3(),Vector3(1,1,1)); gip->dynamic_range=1.0; gip->energy=1.0; + gip->propagation=1.0; gip->interior=false; gip->compress=false; gip->version=1; @@ -4858,6 +4883,15 @@ void RasterizerStorageGLES3::gi_probe_set_energy(RID p_probe,float p_range){ } +void RasterizerStorageGLES3::gi_probe_set_propagation(RID p_probe,float p_range){ + + GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND(!gip); + + gip->propagation=p_range; + +} + void RasterizerStorageGLES3::gi_probe_set_interior(RID p_probe,bool p_enable) { GIProbe *gip = gi_probe_owner.getornull(p_probe); @@ -4902,6 +4936,16 @@ float RasterizerStorageGLES3::gi_probe_get_energy(RID p_probe) const{ return gip->energy; } +float RasterizerStorageGLES3::gi_probe_get_propagation(RID p_probe) const{ + + const GIProbe *gip = gi_probe_owner.getornull(p_probe); + ERR_FAIL_COND_V(!gip,0); + + return gip->propagation; +} + + + uint32_t RasterizerStorageGLES3::gi_probe_get_version(RID p_probe) { @@ -5403,12 +5447,14 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base,RasterizerSce void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { + if (rt->fbo) { glDeleteFramebuffers(1,&rt->fbo); glDeleteTextures(1,&rt->color); rt->fbo=0; } + if (rt->buffers.fbo) { glDeleteFramebuffers(1,&rt->buffers.fbo); glDeleteRenderbuffers(1,&rt->buffers.depth); @@ -5422,11 +5468,13 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { rt->buffers.fbo=0; } + if (rt->depth) { glDeleteTextures(1,&rt->depth); rt->depth=0; } + if (rt->effects.ssao.blur_fbo[0]) { glDeleteFramebuffers(1,&rt->effects.ssao.blur_fbo[0]); glDeleteTextures(1,&rt->effects.ssao.blur_red[0]); @@ -5439,11 +5487,16 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { rt->effects.ssao.depth_mipmap_fbos.clear(); glDeleteTextures(1,&rt->effects.ssao.linear_depth); + + rt->effects.ssao.blur_fbo[0]=0; + rt->effects.ssao.blur_fbo[1]=0; } + if (rt->exposure.fbo) { glDeleteFramebuffers(1,&rt->exposure.fbo); glDeleteTextures(1,&rt->exposure.color); + rt->exposure.fbo=0; } Texture *tex = texture_owner.get(rt->texture); tex->alloc_height=0; @@ -5451,6 +5504,7 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { tex->width=0; tex->height=0; + for(int i=0;i<2;i++) { for(int j=0;j<rt->effects.mip_maps[i].sizes.size();j++) { glDeleteFramebuffers(1,&rt->effects.mip_maps[i].sizes[j].fbo); @@ -5460,6 +5514,8 @@ void RasterizerStorageGLES3::_render_target_clear(RenderTarget *rt) { rt->effects.mip_maps[i].sizes.clear(); rt->effects.mip_maps[i].levels=0; } + + /* if (rt->effects.screen_space_depth) { glDeleteTextures(1,&rt->effects.screen_space_depth); @@ -5474,7 +5530,6 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt){ if (rt->width<=0 || rt->height<=0) return; - GLuint color_internal_format; GLuint color_format; GLuint color_type; @@ -6294,6 +6349,25 @@ bool RasterizerStorageGLES3::free(RID p_rid){ return true; } + +bool RasterizerStorageGLES3::has_os_feature(const String& p_feature) const { + + if (p_feature=="s3tc") + return config.s3tc_supported; + + if (p_feature=="etc") + return config.etc_supported; + + if (p_feature=="etc2") + return config.etc2_supported; + + if (p_feature=="pvrtc") + return config.pvrtc_supported; + + return false; + +} + //////////////////////////////////////////// diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index c8f04f72c1..07998886a8 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -228,6 +228,12 @@ public: Image images[6]; + VisualServer::TextureDetectCallback detect_3d; + void *detect_3d_ud; + + VisualServer::TextureDetectCallback detect_srgb; + void *detect_srgb_ud; + Texture() { using_srgb=false; @@ -243,6 +249,10 @@ public: total_data_size=0; target=GL_TEXTURE_2D; mipmaps=0; + detect_3d=NULL; + detect_3d_ud=NULL; + detect_srgb=NULL; + detect_srgb_ud=NULL; } @@ -281,6 +291,10 @@ public: virtual void textures_keep_original(bool p_enable); + virtual void texture_set_detect_3d_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void* p_userdata); + virtual void texture_set_detect_srgb_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void* p_userdata); + + /* SKYBOX API */ struct SkyBox : public RID_Data { @@ -907,6 +921,7 @@ public: int dynamic_range; float energy; + float propagation; bool interior; bool compress; @@ -939,6 +954,9 @@ public: virtual void gi_probe_set_energy(RID p_probe,float p_range); virtual float gi_probe_get_energy(RID p_probe) const; + virtual void gi_probe_set_propagation(RID p_probe,float p_range); + virtual float gi_probe_get_propagation(RID p_probe) const; + virtual void gi_probe_set_interior(RID p_probe,bool p_enable); virtual bool gi_probe_is_interior(RID p_probe) const; @@ -1160,9 +1178,11 @@ public: height=0; depth=0; fbo=0; + exposure.fbo=0; buffers.fbo=0; used_in_frame=false; + flags[RENDER_TARGET_VFLIP]=false; flags[RENDER_TARGET_TRANSPARENT]=false; flags[RENDER_TARGET_NO_3D]=false; @@ -1237,6 +1257,7 @@ public: void initialize(); void finalize(); + virtual bool has_os_feature(const String& p_feature) const; RasterizerStorageGLES3(); diff --git a/drivers/gles3/shader_compiler_gles3.cpp b/drivers/gles3/shader_compiler_gles3.cpp index 97872226a4..12aac79912 100644 --- a/drivers/gles3/shader_compiler_gles3.cpp +++ b/drivers/gles3/shader_compiler_gles3.cpp @@ -582,6 +582,7 @@ Error ShaderCompilerGLES3::compile(VS::ShaderMode p_mode, const String& p_code, used_name_defines.clear(); used_rmode_defines.clear(); + used_flag_pointers.clear(); _dump_node_code(parser.get_shader(),1,r_gen_code,*p_actions,actions[p_mode]); diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 66123193e6..200c0c0cac 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -71,6 +71,7 @@ layout(std140) uniform SceneData { //ubo:0 float shadow_dual_paraboloid_render_zfar; float shadow_dual_paraboloid_render_side; + highp vec2 screen_pixel_size; vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; @@ -91,7 +92,7 @@ layout(std140) uniform DirectionalLightData { //ubo:3 mediump vec4 light_color_energy; mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; - mediump vec4 shadow_color; + mediump vec4 shadow_color_contact; highp mat4 shadow_matrix1; highp mat4 shadow_matrix2; highp mat4 shadow_matrix3; @@ -126,13 +127,6 @@ out vec3 binormal_interp; #endif -#if !defined(USE_DEPTH_SHADOWS) && defined(USE_SHADOW_PASS) - -varying vec4 position_interp; - -#endif - - VERTEX_SHADER_GLOBALS @@ -161,6 +155,8 @@ layout(std140) uniform SkeletonData { //ubo:7 #endif +out highp vec4 position_interp; + void main() { highp vec4 vertex = vertex_attrib; // vec4(vertex_attrib.xyz * data_attrib.x,1.0); @@ -293,7 +289,7 @@ VERTEX_SHADER_CODE gl_Position = vertex; #endif - + position_interp=gl_Position; } @@ -375,6 +371,8 @@ layout(std140) uniform SceneData { highp vec4 ambient_light_color; highp vec4 bg_color; + + float ambient_energy; float bg_energy; @@ -383,6 +381,7 @@ layout(std140) uniform SceneData { float shadow_dual_paraboloid_render_zfar; float shadow_dual_paraboloid_render_side; + highp vec2 screen_pixel_size; vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; @@ -403,7 +402,7 @@ layout(std140) uniform DirectionalLightData { mediump vec4 light_color_energy; mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; - mediump vec4 shadow_color; + mediump vec4 shadow_color_contact; highp mat4 shadow_matrix1; highp mat4 shadow_matrix2; highp mat4 shadow_matrix3; @@ -425,7 +424,7 @@ struct LightData { mediump vec4 light_color_energy; mediump vec4 light_params; //cone attenuation, angle, specular, shadow enabled, mediump vec4 light_clamp; - mediump vec4 shadow_color; + mediump vec4 shadow_color_contact; highp mat4 shadow_matrix; }; @@ -493,6 +492,69 @@ layout(location=0) out vec4 frag_color; #endif +in highp vec4 position_interp; +uniform highp sampler2D depth_buffer; //texunit:-8 + +float contact_shadow_compute(vec3 pos, vec3 dir, float max_distance) { + + if (abs(dir.z)>0.99) + return 1.0; + + vec3 endpoint = pos+dir*max_distance; + vec4 source = position_interp; + vec4 dest = projection_matrix * vec4(endpoint, 1.0); + + vec2 from_screen = (source.xy / source.w) * 0.5 + 0.5; + vec2 to_screen = (dest.xy / dest.w) * 0.5 + 0.5; + + vec2 screen_rel = to_screen - from_screen; + + /*float pixel_size; //approximate pixel size + + if (screen_rel.x > screen_rel.y) { + + pixel_size = abs((pos.x-endpoint.x)/(screen_rel.x/screen_pixel_size.x)); + } else { + pixel_size = abs((pos.y-endpoint.y)/(screen_rel.y/screen_pixel_size.y)); + + }*/ + vec4 bias = projection_matrix * vec4(pos+vec3(0.0,0.0,0.04), 1.0); //todo un-harcode the 0.04 + + + + vec2 pixel_incr = normalize(screen_rel)*screen_pixel_size; + + float steps = length(screen_rel) / length(pixel_incr); + + //steps=10.0; + + vec4 incr = (dest - source)/steps; + float ratio=0.0; + float ratio_incr = 1.0/steps; + + do { + source += incr*2; + bias+=incr*2; + + vec3 uv_depth = (source.xyz / source.w) * 0.5 + 0.5; + float depth = texture(depth_buffer,uv_depth.xy).r; + + if (depth < uv_depth.z) { + if (depth > (bias.z/bias.w) * 0.5 + 0.5) { + return min(pow(ratio,4.0),1.0); + } else { + return 1.0; + } + } + + + ratio+=ratio_incr; + steps-=1.0; + } while (steps>0.0); + + return 1.0; +} + // GGX Specular // Source: http://www.filmicworlds.com/images/ggx-opt/optimized-ggx.hlsl @@ -517,6 +579,8 @@ float GTR1(float NdotH, float a) return (a2-1.0) / (M_PI*log(a2)*t); } + + void light_compute(vec3 N, vec3 L,vec3 V,vec3 B, vec3 T,vec3 light_color,vec3 diffuse_color, vec3 specular_color, float specular_blob_intensity, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse, inout vec3 specular) { float dotNL = max(dot(N,L), 0.0 ); @@ -660,7 +724,8 @@ vec3 light_transmittance(float translucency,vec3 light_vec, vec3 normal, vec3 po void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 binormal, vec3 tangent, vec3 albedo, vec3 specular, float roughness, float rim, float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy,inout vec3 diffuse_light, inout vec3 specular_light) { vec3 light_rel_vec = omni_lights[idx].light_pos_inv_radius.xyz-vertex; - float normalized_distance = length( light_rel_vec )*omni_lights[idx].light_pos_inv_radius.w; + float light_length = length( light_rel_vec ); + float normalized_distance = light_length*omni_lights[idx].light_pos_inv_radius.w; vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), omni_lights[idx].light_direction_attenuation.w )); if (omni_lights[idx].light_params.w>0.5) { @@ -696,8 +761,15 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino splane.z = shadow_len * omni_lights[idx].light_pos_inv_radius.w; splane.xy = clamp_rect.xy+splane.xy*clamp_rect.zw; + float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,clamp_rect); + if (shadow>0.01 && omni_lights[idx].shadow_color_contact.a>0.0) { + + float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,omni_lights[idx].shadow_color_contact.a)); + shadow=min(shadow,contact_shadow); - light_attenuation*=mix(omni_lights[idx].shadow_color.rgb,vec3(1.0),sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,clamp_rect)); + + } + light_attenuation*=mix(omni_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow); } light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,omni_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,omni_lights[idx].light_params.z,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); @@ -707,7 +779,8 @@ void light_process_omni(int idx, vec3 vertex, vec3 eye_vec,vec3 normal,vec3 bino void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 binormal, vec3 tangent,vec3 albedo, vec3 specular, float roughness, float rim,float rim_tint, float clearcoat, float clearcoat_gloss,float anisotropy, inout vec3 diffuse_light, inout vec3 specular_light) { vec3 light_rel_vec = spot_lights[idx].light_pos_inv_radius.xyz-vertex; - float normalized_distance = length( light_rel_vec )*spot_lights[idx].light_pos_inv_radius.w; + float light_length = length( light_rel_vec ); + float normalized_distance = light_length*spot_lights[idx].light_pos_inv_radius.w; vec3 light_attenuation = vec3(pow( max(1.0 - normalized_distance, 0.0), spot_lights[idx].light_direction_attenuation.w )); vec3 spot_dir = spot_lights[idx].light_direction_attenuation.xyz; float spot_cutoff=spot_lights[idx].light_params.y; @@ -719,7 +792,17 @@ void light_process_spot(int idx, vec3 vertex, vec3 eye_vec, vec3 normal, vec3 bi //there is a shadowmap highp vec4 splane=(spot_lights[idx].shadow_matrix * vec4(vertex,1.0)); splane.xyz/=splane.w; - light_attenuation*=mix(spot_lights[idx].shadow_color.rgb,vec3(1.0),sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp)); + + float shadow = sample_shadow(shadow_atlas,shadow_atlas_pixel_size,splane.xy,splane.z,spot_lights[idx].light_clamp); + + if (shadow>0.01 && spot_lights[idx].shadow_color_contact.a>0.0) { + + float contact_shadow = contact_shadow_compute(vertex,normalize(light_rel_vec),min(light_length,spot_lights[idx].shadow_color_contact.a)); + shadow=min(shadow,contact_shadow); + + } + + light_attenuation*=mix(spot_lights[idx].shadow_color_contact.rgb,vec3(1.0),shadow); } light_compute(normal,normalize(light_rel_vec),eye_vec,binormal,tangent,spot_lights[idx].light_color_energy.rgb*light_attenuation,albedo,specular,spot_lights[idx].light_params.z,roughness,rim,rim_tint,clearcoat,clearcoat_gloss,anisotropy,diffuse_light,specular_light); @@ -1268,6 +1351,8 @@ FRAGMENT_SHADER_CODE } } + + #endif //LIGHT_USE_PSSM4 #ifdef LIGHT_USE_PSSM2 @@ -1306,16 +1391,26 @@ FRAGMENT_SHADER_CODE //one one sample - light_attenuation=mix(shadow_color.rgb,vec3(1.0),sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp)); + float shadow = sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord.xy,pssm_coord.z,light_clamp); #if defined(LIGHT_USE_PSSM_BLEND) + if (use_blend) { - vec3 light_attenuation2=mix(shadow_color.rgb,vec3(1.0),sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp)); - light_attenuation=mix(light_attenuation,light_attenuation2,pssm_blend); + shadow=mix(shadow, sample_shadow(directional_shadow,directional_shadow_pixel_size,pssm_coord2.xy,pssm_coord2.z,light_clamp)); } #endif + if (shadow>0.01 && shadow_color_contact.a>0.0) { + + float contact_shadow = contact_shadow_compute(vertex,-light_direction_attenuation.xyz,shadow_color_contact.a); + shadow=min(shadow,contact_shadow); + + } + + light_attenuation=mix(shadow_color_contact.rgb,vec3(1.0),shadow); + + } #endif //LIGHT_DIRECTIONAL_SHADOW diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 283cff0486..cc69283f97 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -30,6 +30,7 @@ #ifdef UNIX_ENABLED +#include "servers/visual_server.h" #include "thread_posix.h" #include "semaphore_posix.h" @@ -478,6 +479,13 @@ String OS_Unix::get_data_dir() const { } +bool OS_Unix::check_feature_support(const String& p_feature) { + + return VisualServer::get_singleton()->has_os_feature(p_feature); + +} + + String OS_Unix::get_installed_templates_path() const { String p=get_global_settings_path(); if (p!="") diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index b28adc2ee0..220f818ff6 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -117,6 +117,8 @@ public: virtual String get_executable_path() const; virtual String get_data_dir() const; + virtual bool check_feature_support(const String& p_feature); + //virtual void run( MainLoop * p_main_loop ); diff --git a/main/main.cpp b/main/main.cpp index 094b6aedae..21a839a25f 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -54,18 +54,14 @@ #include "scene/main/viewport.h" #ifdef TOOLS_ENABLED +#include "tools/editor/doc/doc_data.h" #include "tools/editor/editor_node.h" #include "tools/editor/project_manager.h" - #endif #include "io/file_access_network.h" -#include "tools/doc/doc_data.h" - - #include "servers/physics_2d_server.h" - #include "core/io/stream_peer_tcp.h" #include "core/os/thread.h" #include "core/io/file_access_pack.h" @@ -130,7 +126,7 @@ void Main::print_help(const char* p_binary) { OS::get_singleton()->print(VERSION_FULL_NAME" (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("Usage: %s [options] [scene]\n",p_binary); OS::get_singleton()->print("Options:\n"); - OS::get_singleton()->print("\t-path [dir] : Path to a game, containing engine.cfg\n"); + OS::get_singleton()->print("\t-path [dir] : Path to a game, containing godot.cfg\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n"); #endif @@ -707,7 +703,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas else input_map->load_from_globals(); //keys for game - if (video_driver=="") // specified in engine.cfg + if (video_driver=="") // specified in godot.cfg video_driver=GLOBAL_DEF("display/driver/name",Variant((const char*)OS::get_singleton()->get_video_driver_name(0))); if (!force_res && use_custom_res && globals->has("display/window/width")) @@ -763,7 +759,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas /* Determine Video Driver */ - if (audio_driver=="") { // specified in engine.cfg + if (audio_driver=="") { // specified in godot.cfg audio_driver=GLOBAL_DEF("audio/driver",OS::get_singleton()->get_audio_driver_name(0)); } diff --git a/tools/dist/docker/Dockerfile b/misc/dist/docker/Dockerfile index 428de9d1a7..428de9d1a7 100644 --- a/tools/dist/docker/Dockerfile +++ b/misc/dist/docker/Dockerfile diff --git a/tools/dist/docker/README.md b/misc/dist/docker/README.md index 7f10b46ad8..7f10b46ad8 100644 --- a/tools/dist/docker/README.md +++ b/misc/dist/docker/README.md diff --git a/tools/dist/docker/scripts/install-android-tools b/misc/dist/docker/scripts/install-android-tools index 8a617d9942..8a617d9942 100644 --- a/tools/dist/docker/scripts/install-android-tools +++ b/misc/dist/docker/scripts/install-android-tools diff --git a/tools/dist/html_fs/godotfs.js b/misc/dist/html_fs/godotfs.js index 2c59344cf5..2c59344cf5 100644 --- a/tools/dist/html_fs/godotfs.js +++ b/misc/dist/html_fs/godotfs.js diff --git a/tools/dist/ios_xcode/godot_xcode/data.pck b/misc/dist/ios_xcode/godot_xcode/data.pck index e69de29bb2..e69de29bb2 100644 --- a/tools/dist/ios_xcode/godot_xcode/data.pck +++ b/misc/dist/ios_xcode/godot_xcode/data.pck diff --git a/tools/dist/ios_xcode/godot_xcode/godot_debug.iphone b/misc/dist/ios_xcode/godot_xcode/godot_debug.iphone index e69de29bb2..e69de29bb2 100755 --- a/tools/dist/ios_xcode/godot_xcode/godot_debug.iphone +++ b/misc/dist/ios_xcode/godot_xcode/godot_debug.iphone diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj index bdba8488c8..bdba8488c8 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.pbxproj diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/misc/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 3c9ba38bbe..3c9ba38bbe 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png Binary files differindex 1d5e472665..1d5e472665 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-568h@2x~iphone.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png Binary files differindex b13a399c83..b13a399c83 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-667h.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png Binary files differindex b51598fed0..b51598fed0 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-667h@2x.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png Binary files differindex 8c44edbccd..8c44edbccd 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-736h.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png Binary files differindex 33847ac136..33847ac136 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-736h@3x.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png Binary files differindex 2a025b745b..2a025b745b 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape-736h.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png Binary files differindex 7099f3e18d..7099f3e18d 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape@2x~ipad.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png Binary files differindex 4a761c339a..4a761c339a 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Landscape~ipad.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png Binary files differindex b09cf21186..b09cf21186 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait@2x~ipad.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png Binary files differindex fa698eb70c..fa698eb70c 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default-Portrait~ipad.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png Binary files differindex ddf2861f4d..ddf2861f4d 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default@2x~iphone.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png Binary files differindex c485a33b03..c485a33b03 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Default~iphone.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json index a458b67873..a458b67873 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png Binary files differindex 165f4423b3..165f4423b3 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-100.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png Binary files differindex 2e205e920c..2e205e920c 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-114.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png Binary files differindex 6245f83f48..6245f83f48 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-120.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png Binary files differindex 7b24e01bc6..7b24e01bc6 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-144.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png Binary files differindex 344b470fa3..344b470fa3 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-152.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png Binary files differindex 0dcebbc3f2..0dcebbc3f2 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-180.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png Binary files differindex 9ae94e9aaf..9ae94e9aaf 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-29.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png Binary files differindex 569f24df91..569f24df91 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-40.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png Binary files differindex 9e69ed3121..9e69ed3121 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-50.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png Binary files differindex b970fa3067..b970fa3067 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-57.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png Binary files differindex 6097a6c73b..6097a6c73b 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-58.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png Binary files differindex 21b9622eb6..21b9622eb6 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-60.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png Binary files differindex 34dea8e6ad..34dea8e6ad 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-72.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png Binary files differindex f72eb0b345..f72eb0b345 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-76.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png Binary files differindex 793c9b1f5f..793c9b1f5f 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/Icon-80.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png Binary files differindex 7cd0e054ab..7cd0e054ab 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-167.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png Binary files differindex e9b2429754..e9b2429754 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/icon-87.png diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes index e328a62cb6..e328a62cb6 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/Images.xcassets/AppIcon.appiconset/sizes diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings b/misc/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings index 477b28ff8f..477b28ff8f 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/en.lproj/InfoPlist.strings diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist b/misc/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist index f97b0fca36..f97b0fca36 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/godot_ios-Info.plist diff --git a/tools/dist/ios_xcode/godot_xcode/godot_ios/main.m b/misc/dist/ios_xcode/godot_xcode/godot_ios/main.m index 88b8e60670..88b8e60670 100644 --- a/tools/dist/ios_xcode/godot_xcode/godot_ios/main.m +++ b/misc/dist/ios_xcode/godot_xcode/godot_ios/main.m diff --git a/tools/dist/ios_xcode/godot_xcode/godot_opt.iphone b/misc/dist/ios_xcode/godot_xcode/godot_opt.iphone index e69de29bb2..e69de29bb2 100755 --- a/tools/dist/ios_xcode/godot_xcode/godot_opt.iphone +++ b/misc/dist/ios_xcode/godot_xcode/godot_opt.iphone diff --git a/tools/dist/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist index eee787bdaf..eee787bdaf 100755 --- a/tools/dist/osx_template.app/Contents/Info.plist +++ b/misc/dist/osx_template.app/Contents/Info.plist diff --git a/tools/dist/osx_template.app/Contents/PkgInfo b/misc/dist/osx_template.app/Contents/PkgInfo index 6f749b0f37..6f749b0f37 100644 --- a/tools/dist/osx_template.app/Contents/PkgInfo +++ b/misc/dist/osx_template.app/Contents/PkgInfo diff --git a/tools/dist/osx_template.app/Contents/Resources/icon.icns b/misc/dist/osx_template.app/Contents/Resources/icon.icns Binary files differindex 375f61437d..375f61437d 100644 --- a/tools/dist/osx_template.app/Contents/Resources/icon.icns +++ b/misc/dist/osx_template.app/Contents/Resources/icon.icns diff --git a/tools/dist/osx_tools.app/Contents/Info.plist b/misc/dist/osx_tools.app/Contents/Info.plist index 4d88e97503..4d88e97503 100755 --- a/tools/dist/osx_tools.app/Contents/Info.plist +++ b/misc/dist/osx_tools.app/Contents/Info.plist diff --git a/tools/dist/osx_tools.app/Contents/PkgInfo b/misc/dist/osx_tools.app/Contents/PkgInfo index 6f749b0f37..6f749b0f37 100644 --- a/tools/dist/osx_tools.app/Contents/PkgInfo +++ b/misc/dist/osx_tools.app/Contents/PkgInfo diff --git a/tools/dist/osx_tools.app/Contents/Resources/Godot.icns b/misc/dist/osx_tools.app/Contents/Resources/Godot.icns Binary files differindex 375f61437d..375f61437d 100644 --- a/tools/dist/osx_tools.app/Contents/Resources/Godot.icns +++ b/misc/dist/osx_tools.app/Contents/Resources/Godot.icns diff --git a/tools/dist/uwp_template/AppxManifest.xml b/misc/dist/uwp_template/AppxManifest.xml index d5e653708c..d5e653708c 100644 --- a/tools/dist/uwp_template/AppxManifest.xml +++ b/misc/dist/uwp_template/AppxManifest.xml diff --git a/tools/dist/uwp_template/Assets/SplashScreen.scale-100.png b/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png Binary files differindex 540bfb1c01..540bfb1c01 100644 --- a/tools/dist/uwp_template/Assets/SplashScreen.scale-100.png +++ b/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png Binary files differindex 6cff663eb5..6cff663eb5 100644 --- a/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png +++ b/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png Binary files differindex 12ec232c87..12ec232c87 100644 --- a/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png +++ b/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png Binary files differindex ad059994ed..ad059994ed 100644 --- a/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png +++ b/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png Binary files differindex b1bf331365..b1bf331365 100644 --- a/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png +++ b/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png b/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png Binary files differindex 8d7a625c82..8d7a625c82 100644 --- a/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png +++ b/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png diff --git a/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png b/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png Binary files differindex b06f1ad50f..b06f1ad50f 100644 --- a/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png +++ b/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png diff --git a/tools/scripts/addheader.py b/misc/scripts/addheader.py index 056e807c81..056e807c81 100644 --- a/tools/scripts/addheader.py +++ b/misc/scripts/addheader.py diff --git a/tools/scripts/file-hex-array.py b/misc/scripts/file-hex-array.py index a6cdfe541f..a6cdfe541f 100755 --- a/tools/scripts/file-hex-array.py +++ b/misc/scripts/file-hex-array.py diff --git a/tools/scripts/make_bmfhdr.py b/misc/scripts/make_bmfhdr.py index 1d3c40f9c6..1d3c40f9c6 100644 --- a/tools/scripts/make_bmfhdr.py +++ b/misc/scripts/make_bmfhdr.py diff --git a/tools/scripts/make_glwrapper.py b/misc/scripts/make_glwrapper.py index 5694d2327e..5694d2327e 100644 --- a/tools/scripts/make_glwrapper.py +++ b/misc/scripts/make_glwrapper.py diff --git a/tools/scripts/make_icons.sh b/misc/scripts/make_icons.sh index 71037cd1c3..71037cd1c3 100644 --- a/tools/scripts/make_icons.sh +++ b/misc/scripts/make_icons.sh diff --git a/tools/scripts/makeargs.py b/misc/scripts/makeargs.py index 2cd47ae087..2cd47ae087 100644 --- a/tools/scripts/makeargs.py +++ b/misc/scripts/makeargs.py diff --git a/tools/scripts/memsort.py b/misc/scripts/memsort.py index fb636b0f78..fb636b0f78 100644 --- a/tools/scripts/memsort.py +++ b/misc/scripts/memsort.py diff --git a/tools/scripts/sort-demos.sh b/misc/scripts/sort-demos.sh index d4770b337e..2121d78c15 100644 --- a/tools/scripts/sort-demos.sh +++ b/misc/scripts/sort-demos.sh @@ -1,7 +1,7 @@ #!/bin/bash # When scanning for demos, the project manager sorts them based on their # timestamp, i.e. last modification date. This can make for a pretty -# messy output, so this script 'touches' each engine.cfg file in reverse +# messy output, so this script 'touches' each godot.cfg file in reverse # alphabetical order to ensure a nice listing. # # It's good practice to run it once before packaging demos on the build @@ -17,7 +17,7 @@ if [ -e demos.list ]; then fi for dir in 2d 3d gui misc viewport; do - find "demos/$dir" -name "engine.cfg" |sort >> demos.list + find "demos/$dir" -name "godot.cfg" |sort >> demos.list done cat demos.list |sort -r > demos_r.list diff --git a/tools/scripts/svgs_2_pngs.py b/misc/scripts/svgs_2_pngs.py index b24324dcd7..b24324dcd7 100644 --- a/tools/scripts/svgs_2_pngs.py +++ b/misc/scripts/svgs_2_pngs.py diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp index 36ff1b86df..2d883bff0f 100644 --- a/modules/etc1/image_etc.cpp +++ b/modules/etc1/image_etc.cpp @@ -95,7 +95,7 @@ static void _decompress_etc(Image *p_img) { //print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps())); *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst); if (p_img->has_mipmaps()) - p_img->generate_mipmaps(true); + p_img->generate_mipmaps(); } @@ -112,16 +112,17 @@ static void _compress_etc(Image *p_img) { img.convert(Image::FORMAT_RGB8); - int mmc=img.get_mipmap_count(); - if (mmc==0) - img.generate_mipmaps(); // force mipmaps, so it works on most hardware - - PoolVector<uint8_t> res_data; PoolVector<uint8_t> dst_data; PoolVector<uint8_t>::Read r = img.get_data().read(); + int target_size = Image::get_image_data_size(p_img->get_width(),p_img->get_height(),Image::FORMAT_ETC,p_img->has_mipmaps()?-1:0); + int mmc = p_img->has_mipmaps() ? Image::get_image_required_mipmaps(p_img->get_width(),p_img->get_height(),Image::FORMAT_ETC) : 0; + + dst_data.resize(target_size); int mc=0; + int ofs=0; + PoolVector<uint8_t>::Write w=dst_data.write(); rg_etc1::etc1_pack_params pp; @@ -133,9 +134,9 @@ static void _compress_etc(Image *p_img) { int bh=MAX(imgh/4,1); const uint8_t *src = &r[img.get_mipmap_offset(i)]; int mmsize = MAX(bw,1)*MAX(bh,1)*8; - dst_data.resize(dst_data.size()+mmsize); - PoolVector<uint8_t>::Write w=dst_data.write(); - uint8_t *dst = &w[dst_data.size()-mmsize]; + + uint8_t *dst = &w[ofs]; + ofs+=mmsize; //print_line("bh: "+itos(bh)+" bw: "+itos(bw)); diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index a48c1f3485..28c200596b 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -64,10 +64,9 @@ void image_compress_squish(Image *p_image) { p_image->convert(Image::FORMAT_RGBA8); //always expects rgba - int mm_count = p_image->get_mipmap_count(); - PoolVector<uint8_t> data; - int target_size = Image::get_image_data_size(w,h,target_format,mm_count); + int target_size = Image::get_image_data_size(w,h,target_format,p_image->has_mipmaps()?-1:0); + int mm_count = p_image->has_mipmaps() ? Image::get_image_required_mipmaps(w,h,target_format) : 0; data.resize(target_size); PoolVector<uint8_t>::Read rb = p_image->get_data().read(); diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 31bf5ac292..4b4c57fbdd 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -17,7 +17,7 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame* p_buffer,int p_fram if (todo) { //end of file! - if (false) { + if (vorbis_stream->loop) { //loop seek_pos(0); loops++; @@ -120,9 +120,9 @@ String AudioStreamOGGVorbis::get_stream_name() const { return "";//return stream_name; } -Error AudioStreamOGGVorbis::setup(const uint8_t *p_data,uint32_t p_data_len) { - +void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t>& p_data) { + int src_data_len=p_data.size(); #define MAX_TEST_MEM (1<<20) uint32_t alloc_try=1024; @@ -139,98 +139,94 @@ Error AudioStreamOGGVorbis::setup(const uint8_t *p_data,uint32_t p_data_len) { ogg_alloc.alloc_buffer=w.ptr(); ogg_alloc.alloc_buffer_length_in_bytes=alloc_try; + PoolVector<uint8_t>::Read src_datar = p_data.read(); + int error; - ogg_stream = stb_vorbis_open_memory( (const unsigned char*)p_data, p_data_len, &error, &ogg_alloc ); + ogg_stream = stb_vorbis_open_memory( (const unsigned char*)src_datar.ptr(), src_data_len, &error, &ogg_alloc ); if (!ogg_stream && error==VORBIS_outofmem) { w = PoolVector<char>::Write(); alloc_try*=2; } else { - break; - } - } - ERR_FAIL_COND_V(alloc_try==MAX_TEST_MEM,ERR_OUT_OF_MEMORY); - ERR_FAIL_COND_V(ogg_stream==NULL,ERR_FILE_CORRUPT); - stb_vorbis_info info = stb_vorbis_get_info(ogg_stream); + ERR_FAIL_COND(alloc_try==MAX_TEST_MEM); + ERR_FAIL_COND(ogg_stream==NULL); - channels = info.channels; - sample_rate = info.sample_rate; - decode_mem_size = alloc_try; - //does this work? (it's less mem..) - //decode_mem_size = ogg_alloc.alloc_buffer_length_in_bytes + info.setup_memory_required + info.temp_memory_required + info.max_frame_size; + stb_vorbis_info info = stb_vorbis_get_info(ogg_stream); - //print_line("succeded "+itos(ogg_alloc.alloc_buffer_length_in_bytes)+" setup "+itos(info.setup_memory_required)+" setup temp "+itos(info.setup_temp_memory_required)+" temp "+itos(info.temp_memory_required)+" maxframe"+itos(info.max_frame_size)); + channels = info.channels; + sample_rate = info.sample_rate; + decode_mem_size = alloc_try; + //does this work? (it's less mem..) + //decode_mem_size = ogg_alloc.alloc_buffer_length_in_bytes + info.setup_memory_required + info.temp_memory_required + info.max_frame_size; - length=stb_vorbis_stream_length_in_seconds(ogg_stream); - stb_vorbis_close(ogg_stream); + //print_line("succeded "+itos(ogg_alloc.alloc_buffer_length_in_bytes)+" setup "+itos(info.setup_memory_required)+" setup temp "+itos(info.setup_temp_memory_required)+" temp "+itos(info.temp_memory_required)+" maxframe"+itos(info.max_frame_size)); - data = AudioServer::get_singleton()->audio_data_alloc(p_data_len,p_data); - data_len=p_data_len; + length=stb_vorbis_stream_length_in_seconds(ogg_stream); + stb_vorbis_close(ogg_stream); - printf("create at %p, data %p\n",this,data); - return OK; -} + data = AudioServer::get_singleton()->audio_data_alloc(src_data_len,src_datar.ptr()); + data_len=src_data_len; -AudioStreamOGGVorbis::AudioStreamOGGVorbis() { + break; + } + } - data=NULL; - length=0; - sample_rate=1; - channels=1; - decode_mem_size=0; -} + printf("create at %p, data %p\n",this,data); +} +PoolVector<uint8_t> AudioStreamOGGVorbis::get_data() const { + PoolVector<uint8_t> vdata; -RES ResourceFormatLoaderAudioStreamOGGVorbis::load(const String &p_path, const String& p_original_path, Error *r_error) { - if (r_error) - *r_error=OK; + if (data_len && data) { + vdata.resize(data_len); + { + PoolVector<uint8_t>::Write w = vdata.write(); + copymem(w.ptr(),data,data_len); + } - FileAccess *f = FileAccess::open(p_path,FileAccess::READ); - if (!f) { - *r_error=ERR_CANT_OPEN; - ERR_FAIL_COND_V(!f,RES()); } - size_t len = f->get_len(); + return vdata; +} - PoolVector<uint8_t> data; - data.resize(len); - PoolVector<uint8_t>::Write w = data.write(); +void AudioStreamOGGVorbis::set_loop(bool p_enable) { + loop=p_enable; +} - f->get_buffer(w.ptr(),len); +bool AudioStreamOGGVorbis::has_loop() const { - memdelete(f); + return loop; +} - Ref<AudioStreamOGGVorbis> ogg_stream; - ogg_stream.instance(); - Error err = ogg_stream->setup(w.ptr(),len); +void AudioStreamOGGVorbis::_bind_methods() { - if (err!=OK) { - *r_error=err; - ogg_stream.unref(); - ERR_FAIL_V(RES()); - } + ClassDB::bind_method(_MD("set_data","data"),&AudioStreamOGGVorbis::set_data); + ClassDB::bind_method(_MD("get_data"),&AudioStreamOGGVorbis::get_data); - return ogg_stream; -} + ClassDB::bind_method(_MD("set_loop","enable"),&AudioStreamOGGVorbis::set_loop); + ClassDB::bind_method(_MD("has_loop"),&AudioStreamOGGVorbis::has_loop); -void ResourceFormatLoaderAudioStreamOGGVorbis::get_recognized_extensions(List<String> *p_extensions) const { + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY,"data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_data"),_SCS("get_data")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"loop",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_loop"),_SCS("has_loop")); - p_extensions->push_back("ogg"); } -String ResourceFormatLoaderAudioStreamOGGVorbis::get_resource_type(const String &p_path) const { - if (p_path.get_extension().to_lower()=="ogg") - return "AudioStreamOGGVorbis"; - return ""; -} +AudioStreamOGGVorbis::AudioStreamOGGVorbis() { -bool ResourceFormatLoaderAudioStreamOGGVorbis::handles_type(const String& p_type) const { - return (p_type=="AudioStream" || p_type=="AudioStreamOGG" || p_type=="AudioStreamOGGVorbis"); + + data=NULL; + length=0; + sample_rate=1; + channels=1; + decode_mem_size=0; + loop=false; } + + + diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h index 4555423f85..21ce23740c 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h @@ -49,6 +49,7 @@ class AudioStreamOGGVorbis : public AudioStream { GDCLASS( AudioStreamOGGVorbis, AudioStream ) OBJ_SAVE_TYPE( AudioStream ) //children are all saved as AudioStream, so they can be exchanged + RES_BASE_EXTENSION("asogg"); friend class AudioStreamPlaybackOGGVorbis; @@ -59,26 +60,24 @@ friend class AudioStreamPlaybackOGGVorbis; float sample_rate; int channels; float length; + bool loop; +protected: + static void _bind_methods(); public: + void set_loop(bool p_enable); + bool has_loop() const; virtual Ref<AudioStreamPlayback> instance_playback(); virtual String get_stream_name() const; - Error setup(const uint8_t *p_data, uint32_t p_data_len); + void set_data(const PoolVector<uint8_t>& p_data); + PoolVector<uint8_t> get_data() const; AudioStreamOGGVorbis(); }; -class ResourceFormatLoaderAudioStreamOGGVorbis : public ResourceFormatLoader { -public: - virtual RES load(const String &p_path,const String& p_original_path="",Error *r_error=NULL); - virtual void get_recognized_extensions(List<String> *p_extensions) const; - virtual bool handles_type(const String& p_type) const; - virtual String get_resource_type(const String &p_path) const; -}; - #endif diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp index 143ad6f47e..41fbc6fbd7 100644 --- a/modules/stb_vorbis/register_types.cpp +++ b/modules/stb_vorbis/register_types.cpp @@ -28,17 +28,18 @@ /*************************************************************************/ #include "register_types.h" #include "audio_stream_ogg_vorbis.h" - -static ResourceFormatLoaderAudioStreamOGGVorbis *vorbis_stream_loader = NULL; +#include "resource_importer_ogg_vorbis.h" void register_stb_vorbis_types() { - vorbis_stream_loader = memnew( ResourceFormatLoaderAudioStreamOGGVorbis ); - ResourceLoader::add_resource_format_loader(vorbis_stream_loader); +#ifdef TOOLS_ENABLED + Ref<ResourceImporterOGGVorbis> ogg_import; + ogg_import.instance(); + ResourceFormatImporter::get_singleton()->add_importer(ogg_import); +#endif ClassDB::register_class<AudioStreamOGGVorbis>(); } void unregister_stb_vorbis_types() { - memdelete( vorbis_stream_loader ); } diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp new file mode 100644 index 0000000000..6f90c8587b --- /dev/null +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -0,0 +1,84 @@ +#include "resource_importer_ogg_vorbis.h" + +#include "io/resource_saver.h" +#include "os/file_access.h" +#include "scene/resources/texture.h" + +String ResourceImporterOGGVorbis::get_importer_name() const { + + return "ogg_vorbis"; +} + +String ResourceImporterOGGVorbis::get_visible_name() const{ + + return "OGGVorbis"; +} +void ResourceImporterOGGVorbis::get_recognized_extensions(List<String> *p_extensions) const{ + + p_extensions->push_back("ogg"); +} + +String ResourceImporterOGGVorbis::get_save_extension() const { + return "asogg"; +} + +String ResourceImporterOGGVorbis::get_resource_type() const{ + + return "AudioStreamOGGVorbis"; +} + +bool ResourceImporterOGGVorbis::get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const { + + return true; +} + +int ResourceImporterOGGVorbis::get_preset_count() const { + return 0; +} +String ResourceImporterOGGVorbis::get_preset_name(int p_idx) const { + + return String(); +} + + +void ResourceImporterOGGVorbis::get_import_options(List<ImportOption> *r_options,int p_preset) const { + + + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"loop"),true)); + +} + + + +Error ResourceImporterOGGVorbis::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) { + + bool loop = p_options["loop"]; + + FileAccess *f = FileAccess::open(p_source_file,FileAccess::READ); + if (!f) { + ERR_FAIL_COND_V(!f,ERR_CANT_OPEN); + } + + size_t len = f->get_len(); + + PoolVector<uint8_t> data; + data.resize(len); + PoolVector<uint8_t>::Write w = data.write(); + + f->get_buffer(w.ptr(),len); + + memdelete(f); + + Ref<AudioStreamOGGVorbis> ogg_stream; + ogg_stream.instance(); + + ogg_stream->set_data(data); + ogg_stream->set_loop(loop); + + return ResourceSaver::save(p_save_path+".asogg",ogg_stream); +} + +ResourceImporterOGGVorbis::ResourceImporterOGGVorbis() +{ + +} diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h new file mode 100644 index 0000000000..8a3b2d8ec6 --- /dev/null +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h @@ -0,0 +1,28 @@ +#ifndef RESOURCEIMPORTEROGGVORBIS_H +#define RESOURCEIMPORTEROGGVORBIS_H + + +#include "io/resource_import.h" +#include "audio_stream_ogg_vorbis.h" + +class ResourceImporterOGGVorbis : public ResourceImporter { + GDCLASS(ResourceImporterOGGVorbis,ResourceImporter) +public: + 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 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); + + ResourceImporterOGGVorbis(); +}; + +#endif // RESOURCEIMPORTEROGGVORBIS_H diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 0e87e96d4a..94678e5e94 100644 --- a/scene/2d/screen_button.cpp +++ b/scene/2d/screen_button.cpp @@ -63,6 +63,38 @@ Ref<BitMap> TouchScreenButton::get_bitmask() const{ return bitmask; } +void TouchScreenButton::set_shape(const Ref<Shape2D>& p_shape){ + + shape=p_shape; + + if (!is_inside_tree()) + return; + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) + return; + update(); +} + +Ref<Shape2D> TouchScreenButton::get_shape() const{ + + return shape; +} + +void TouchScreenButton::set_shape_centered(bool p_shape_centered) { + + shape_centered=p_shape_centered; + + if (!is_inside_tree()) + return; + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) + return; + update(); +} + +bool TouchScreenButton::is_shape_centered() const { + + return shape_centered; +} + void TouchScreenButton::_notification(int p_what) { switch(p_what) { @@ -86,6 +118,15 @@ void TouchScreenButton::_notification(int p_what) { draw_texture(texture,Point2()); } + if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) + return; + if (shape.is_valid()) { + Color draw_col=get_tree()->get_debug_collisions_color(); + Vector2 pos=shape_centered ? get_item_rect().size*0.5f : Vector2(); + draw_set_transform_matrix(get_canvas_transform().translated(pos)); + shape->draw(get_canvas_item(),draw_col); + } + } break; case NOTIFICATION_ENTER_TREE: { @@ -201,18 +242,30 @@ void TouchScreenButton::_input(const InputEvent& p_event) { return; //already fingering Point2 coord = (get_global_transform_with_canvas()).affine_inverse().xform(Point2(p_event.screen_touch.x,p_event.screen_touch.y)); + Rect2 item_rect = get_item_rect(); bool touched=false; + bool check_rect=true; + if (shape.is_valid()) { + + check_rect=false; + Transform2D xform=shape_centered ? Transform2D().translated(get_item_rect().size*0.5f) : Transform2D(); + touched=shape->collide(xform, unit_rect, Transform2D(0, coord + Vector2(0.5,0.5))); + } + if (bitmask.is_valid()) { - if (Rect2(Point2(),bitmask->get_size()).has_point(coord)) { + check_rect=false; + if (!touched && Rect2(Point2(),bitmask->get_size()).has_point(coord)) { if (bitmask->get_bit(coord)) touched=true; } - } else { + } + + if (!touched && check_rect) { if (!texture.is_null()) - touched=Rect2(Point2(),texture->get_size()).has_point(coord); + touched=item_rect.has_point(coord); } @@ -315,6 +368,12 @@ void TouchScreenButton::_bind_methods() { ClassDB::bind_method(_MD("set_bitmask","bitmask"),&TouchScreenButton::set_bitmask); ClassDB::bind_method(_MD("get_bitmask"),&TouchScreenButton::get_bitmask); + ClassDB::bind_method(_MD("set_shape","shape"),&TouchScreenButton::set_shape); + ClassDB::bind_method(_MD("get_shape"),&TouchScreenButton::get_shape); + + ClassDB::bind_method(_MD("set_shape_centered","bool"),&TouchScreenButton::set_shape_centered); + ClassDB::bind_method(_MD("is_shape_centered"),&TouchScreenButton::is_shape_centered); + ClassDB::bind_method(_MD("set_action","action"),&TouchScreenButton::set_action); ClassDB::bind_method(_MD("get_action"),&TouchScreenButton::get_action); @@ -331,6 +390,8 @@ void TouchScreenButton::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"normal",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture"),_SCS("get_texture")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"pressed",PROPERTY_HINT_RESOURCE_TYPE,"Texture"),_SCS("set_texture_pressed"),_SCS("get_texture_pressed")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"bitmask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"),_SCS("set_bitmask"),_SCS("get_bitmask")); + ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"shape",PROPERTY_HINT_RESOURCE_TYPE,"Shape2D"),_SCS("set_shape"),_SCS("get_shape")); + ADD_PROPERTY( PropertyInfo(Variant::BOOL,"shape_centered"),_SCS("set_shape_centered"),_SCS("is_shape_centered")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"passby_press"),_SCS("set_passby_press"),_SCS("is_passby_press_enabled")); ADD_PROPERTY( PropertyInfo(Variant::STRING,"action"),_SCS("set_action"),_SCS("get_action")); ADD_PROPERTY( PropertyInfo(Variant::INT,"visibility_mode",PROPERTY_HINT_ENUM,"Always,TouchScreen Only"),_SCS("set_visibility_mode"),_SCS("get_visibility_mode")); @@ -349,4 +410,7 @@ TouchScreenButton::TouchScreenButton() { action_id=-1; passby_press=false; visibility=VISIBILITY_ALWAYS; + shape_centered=true; + unit_rect=Ref<RectangleShape2D>(memnew(RectangleShape2D)); + unit_rect->set_extents(Vector2(0.5,0.5)); } diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h index a2df03204f..8ce378c660 100644 --- a/scene/2d/screen_button.h +++ b/scene/2d/screen_button.h @@ -32,6 +32,7 @@ #include "scene/2d/node_2d.h" #include "scene/resources/texture.h" #include "scene/resources/bit_mask.h" +#include "scene/resources/rectangle_shape_2d.h" class TouchScreenButton : public Node2D { @@ -47,6 +48,10 @@ private: Ref<Texture> texture; Ref<Texture> texture_pressed; Ref<BitMap> bitmask; + Ref<Shape2D> shape; + bool shape_centered; + + Ref<RectangleShape2D> unit_rect; StringName action; bool passby_press; @@ -77,6 +82,12 @@ public: void set_bitmask(const Ref<BitMap>& p_bitmask); Ref<BitMap> get_bitmask() const; + void set_shape(const Ref<Shape2D>& p_shape); + Ref<Shape2D> get_shape() const; + + void set_shape_centered(bool p_shape_centered); + bool is_shape_centered() const; + void set_action(const String& p_action); String get_action() const; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index b29ae211de..4c33590568 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -64,6 +64,18 @@ float GIProbeData::get_energy() const{ } +void GIProbeData::set_propagation(float p_range) { + + VS::get_singleton()->gi_probe_set_propagation(probe,p_range); +} + +float GIProbeData::get_propagation() const{ + + return VS::get_singleton()->gi_probe_get_propagation(probe); + +} + + void GIProbeData::set_interior(bool p_enable) { VS::get_singleton()->gi_probe_set_interior(probe,p_enable); @@ -121,6 +133,9 @@ void GIProbeData::_bind_methods() { ClassDB::bind_method(_MD("set_energy","energy"),&GIProbeData::set_energy); ClassDB::bind_method(_MD("get_energy"),&GIProbeData::get_energy); + ClassDB::bind_method(_MD("set_propagation","propagation"),&GIProbeData::set_propagation); + ClassDB::bind_method(_MD("get_propagation"),&GIProbeData::get_propagation); + ClassDB::bind_method(_MD("set_interior","interior"),&GIProbeData::set_interior); ClassDB::bind_method(_MD("is_interior"),&GIProbeData::is_interior); @@ -134,6 +149,7 @@ void GIProbeData::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY,"dynamic_data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_data"),_SCS("get_dynamic_data")); ADD_PROPERTY(PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_energy"),_SCS("get_energy")); + ADD_PROPERTY(PropertyInfo(Variant::REAL,"propagation",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_propagation"),_SCS("get_propagation")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"interior",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_interior"),_SCS("is_interior")); ADD_PROPERTY(PropertyInfo(Variant::BOOL,"compress",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_compress"),_SCS("is_compressed")); @@ -214,6 +230,18 @@ float GIProbe::get_energy() const { return energy; } +void GIProbe::set_propagation(float p_propagation) { + + propagation=p_propagation; + if (probe_data.is_valid()) { + probe_data->set_propagation(propagation); + } +} +float GIProbe::get_propagation() const { + + return propagation; +} + void GIProbe::set_interior(bool p_enable) { interior=p_enable; @@ -906,7 +934,7 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater } -void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_baker) { +void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_baker, const Vector<Ref<Material> > &p_materials, const Ref<Material> &p_override_material) { for(int i=0;i<p_mesh->get_surface_count();i++) { @@ -914,7 +942,16 @@ void GIProbe::_plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_b if (p_mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) continue; //only triangles - Baker::MaterialCache material = _get_material_cache(p_mesh->surface_get_material(i),p_baker); + Ref<Material> src_material; + + if (p_override_material.is_valid()) { + src_material=p_override_material; + } else if (i<p_materials.size() && p_materials[i].is_valid()) { + src_material=p_materials[i]; + } else { + src_material=p_mesh->surface_get_material(i); + } + Baker::MaterialCache material = _get_material_cache(src_material,p_baker); Array a = p_mesh->surface_get_arrays(i); @@ -1009,6 +1046,10 @@ void GIProbe::_find_meshes(Node *p_at_node,Baker *p_baker){ Baker::PlotMesh pm; pm.local_xform=xf; pm.mesh=mesh; + for(int i=0;i<mesh->get_surface_count();i++) { + pm.instance_materials.push_back(mi->get_surface_material(i)); + } + pm.override_material=mi->get_material_override(); p_baker->mesh_list.push_back(pm); } @@ -1083,7 +1124,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug){ print_line("plotting mesh "+itos(pmc++)+"/"+itos(baker.mesh_list.size())); - _plot_mesh(E->get().local_xform,E->get().mesh,&baker); + _plot_mesh(E->get().local_xform,E->get().mesh,&baker,E->get().instance_materials,E->get().override_material); } _fixup_plot(0,0,0,0,0,&baker); @@ -1358,6 +1399,9 @@ void GIProbe::_bind_methods() { ClassDB::bind_method(_MD("set_energy","max"),&GIProbe::set_energy); ClassDB::bind_method(_MD("get_energy"),&GIProbe::get_energy); + ClassDB::bind_method(_MD("set_propagation","max"),&GIProbe::set_propagation); + ClassDB::bind_method(_MD("get_propagation"),&GIProbe::get_propagation); + ClassDB::bind_method(_MD("set_interior","enable"),&GIProbe::set_interior); ClassDB::bind_method(_MD("is_interior"),&GIProbe::is_interior); @@ -1372,6 +1416,7 @@ void GIProbe::_bind_methods() { ADD_PROPERTY( PropertyInfo(Variant::VECTOR3,"extents"),_SCS("set_extents"),_SCS("get_extents")); ADD_PROPERTY( PropertyInfo(Variant::INT,"dynamic_range",PROPERTY_HINT_RANGE,"1,16,1"),_SCS("set_dynamic_range"),_SCS("get_dynamic_range")); ADD_PROPERTY( PropertyInfo(Variant::REAL,"energy",PROPERTY_HINT_RANGE,"0,16,0.01"),_SCS("set_energy"),_SCS("get_energy")); + ADD_PROPERTY( PropertyInfo(Variant::REAL,"propagation",PROPERTY_HINT_RANGE,"0,1,0.01"),_SCS("set_propagation"),_SCS("get_propagation")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"interior"),_SCS("set_interior"),_SCS("is_interior")); ADD_PROPERTY( PropertyInfo(Variant::BOOL,"compress"),_SCS("set_compress"),_SCS("is_compressed")); ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"data",PROPERTY_HINT_RESOURCE_TYPE,"GIProbeData"),_SCS("set_probe_data"),_SCS("get_probe_data")); @@ -1389,6 +1434,7 @@ GIProbe::GIProbe() { subdiv=SUBDIV_128; dynamic_range=4; energy=1.0; + propagation=1.0; extents=Vector3(10,10,10); color_scan_cell_width=4; bake_texture_size=128; diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h index e416b28791..f03a558908 100644 --- a/scene/3d/gi_probe.h +++ b/scene/3d/gi_probe.h @@ -32,6 +32,9 @@ public: void set_dynamic_range(int p_range); int get_dynamic_range() const; + void set_propagation(float p_range); + float get_propagation() const; + void set_energy(float p_range); float get_energy() const; @@ -114,6 +117,8 @@ private: int axis_cell_size[3]; struct PlotMesh { + Ref<Material> override_material; + Vector<Ref<Material> > instance_materials; Ref<Mesh> mesh; Transform local_xform; }; @@ -132,6 +137,7 @@ private: Vector3 extents; int dynamic_range; float energy; + float propagation; bool interior; bool compress; @@ -141,7 +147,7 @@ private: Vector<Color> _get_bake_texture(Image &p_image,const Color& p_color); Baker::MaterialCache _get_material_cache(Ref<Material> p_material,Baker *p_baker); void _plot_face(int p_idx, int p_level, int p_x,int p_y,int p_z,const Vector3 *p_vtx, const Vector2* p_uv, const Baker::MaterialCache& p_material, const Rect3 &p_aabb,Baker *p_baker); - void _plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_baker); + void _plot_mesh(const Transform& p_xform, Ref<Mesh>& p_mesh, Baker *p_baker,const Vector<Ref<Material> >& p_materials,const Ref<Material>& p_override_material); void _find_meshes(Node *p_at_node,Baker *p_baker); void _fixup_plot(int p_idx, int p_level,int p_x,int p_y, int p_z,Baker *p_baker); @@ -170,6 +176,9 @@ public: void set_energy(float p_energy); float get_energy() const; + void set_propagation(float p_propagation); + float get_propagation() const; + void set_interior(bool p_enable); bool is_interior() const; diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 0c6c113dd2..799c00d266 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -253,6 +253,7 @@ void Light::_bind_methods() { ADD_PROPERTY( PropertyInfo( Variant::BOOL, "shadow_enabled"), _SCS("set_shadow"), _SCS("has_shadow")); ADD_PROPERTY( PropertyInfo( Variant::COLOR, "shadow_color",PROPERTY_HINT_COLOR_NO_ALPHA), _SCS("set_shadow_color"), _SCS("get_shadow_color")); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow_bias",PROPERTY_HINT_RANGE,"-16,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_BIAS); + ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow_contact",PROPERTY_HINT_RANGE,"0,16,0.01"), _SCS("set_param"), _SCS("get_param"), PARAM_CONTACT_SHADOW_SIZE); ADD_PROPERTYI( PropertyInfo( Variant::REAL, "shadow_max_distance",PROPERTY_HINT_RANGE,"0,65536,0.1"), _SCS("set_param"), _SCS("get_param"), PARAM_SHADOW_MAX_DISTANCE); ADD_GROUP("Editor",""); ADD_PROPERTY( PropertyInfo( Variant::BOOL, "editor_only"), _SCS("set_editor_only"), _SCS("is_editor_only")); @@ -264,6 +265,7 @@ void Light::_bind_methods() { BIND_CONSTANT( PARAM_ATTENUATION ); BIND_CONSTANT( PARAM_SPOT_ANGLE ); BIND_CONSTANT( PARAM_SPOT_ATTENUATION ); + BIND_CONSTANT( PARAM_CONTACT_SHADOW_SIZE ); BIND_CONSTANT( PARAM_SHADOW_MAX_DISTANCE ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_1_OFFSET ); BIND_CONSTANT( PARAM_SHADOW_SPLIT_2_OFFSET ); @@ -297,6 +299,7 @@ Light::Light(VisualServer::LightType p_type) { set_param(PARAM_ATTENUATION,1); set_param(PARAM_SPOT_ANGLE,45); set_param(PARAM_SPOT_ATTENUATION,1); + set_param(PARAM_CONTACT_SHADOW_SIZE,0); set_param(PARAM_SHADOW_MAX_DISTANCE,0); set_param(PARAM_SHADOW_SPLIT_1_OFFSET,0.1); set_param(PARAM_SHADOW_SPLIT_2_OFFSET,0.2); diff --git a/scene/3d/light.h b/scene/3d/light.h index d27b9fed12..4cf0156d5c 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -55,6 +55,7 @@ public: PARAM_ATTENUATION = VS::LIGHT_PARAM_ATTENUATION, PARAM_SPOT_ANGLE = VS::LIGHT_PARAM_SPOT_ANGLE, PARAM_SPOT_ATTENUATION = VS::LIGHT_PARAM_SPOT_ATTENUATION, + PARAM_CONTACT_SHADOW_SIZE= VS::LIGHT_PARAM_CONTACT_SHADOW_SIZE, PARAM_SHADOW_MAX_DISTANCE = VS::LIGHT_PARAM_SHADOW_MAX_DISTANCE, PARAM_SHADOW_SPLIT_1_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, PARAM_SHADOW_SPLIT_2_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET, diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 6036b3f9df..4ca95294ca 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2431,6 +2431,8 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) { if (k.mod.shift) _post_shift_selection(); + else if(k.mod.command || k.mod.control) + deselect(); } break; #else @@ -2440,25 +2442,30 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) { if (k.mod.shift) _pre_shift_selection(); - // compute whitespace symbols seq length - int current_line_whitespace_len = 0; - while(current_line_whitespace_len < text[cursor.line].length()) { - CharType c = text[cursor.line][current_line_whitespace_len]; - if(c != '\t' && c != ' ') - break; - current_line_whitespace_len++; - } - - if(cursor_get_column() == current_line_whitespace_len) + if (k.mod.command) { + cursor_set_line(0); cursor_set_column(0); - else - cursor_set_column(current_line_whitespace_len); + } + else { + // compute whitespace symbols seq length + int current_line_whitespace_len = 0; + while( current_line_whitespace_len < text[cursor.line].length() ) { + CharType c = text[cursor.line][current_line_whitespace_len]; + if( c != '\t' && c != ' ' ) + break; + current_line_whitespace_len++; + } - if (k.mod.command) - cursor_set_line(0); + if( cursor_get_column() == current_line_whitespace_len ) + cursor_set_column(0); + else + cursor_set_column(current_line_whitespace_len); + } if (k.mod.shift) _post_shift_selection(); + else if(k.mod.command || k.mod.control) + deselect(); _cancel_completion(); completion_hint=""; @@ -2481,6 +2488,8 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) { if (k.mod.shift) _post_shift_selection(); + else if(k.mod.command || k.mod.control) + deselect(); } break; #else @@ -2495,6 +2504,8 @@ void TextEdit::_gui_input(const InputEvent& p_gui_input) { if (k.mod.shift) _post_shift_selection(); + else if(k.mod.command || k.mod.control) + deselect(); _cancel_completion(); completion_hint=""; diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 0ad140f7c3..c0eaca24a3 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -85,6 +85,7 @@ #include "scene/gui/graph_node.h" #include "scene/gui/graph_edit.h" #include "scene/gui/tool_button.h" +#include "scene/resources/audio_stream_sample.h" #include "scene/resources/video_stream.h" #include "scene/2d/particles_2d.h" #include "scene/2d/path_2d.h" @@ -596,6 +597,7 @@ void register_scene_types() { ClassDB::register_class<AudioPlayer>(); ClassDB::register_virtual_class<VideoStream>(); + ClassDB::register_class<AudioStreamSample>(); OS::get_singleton()->yield(); //may take time to init diff --git a/scene/resources/audio_stream_sample.cpp b/scene/resources/audio_stream_sample.cpp new file mode 100644 index 0000000000..21339cb90b --- /dev/null +++ b/scene/resources/audio_stream_sample.cpp @@ -0,0 +1,557 @@ +#include "audio_stream_sample.h" + +void AudioStreamPlaybackSample::start(float p_from_pos) { + + for(int i=0;i<2;i++) { + ima_adpcm[i].step_index=0; + ima_adpcm[i].predictor=0; + ima_adpcm[i].loop_step_index=0; + ima_adpcm[i].loop_predictor=0; + ima_adpcm[i].last_nibble=-1; + ima_adpcm[i].loop_pos=0x7FFFFFFF; + ima_adpcm[i].window_ofs=0; + ima_adpcm[i].ptr=(const uint8_t*)base->data; + ima_adpcm[i].ptr+=AudioStreamSample::DATA_PAD; + } + + seek_pos(p_from_pos); + sign=1; + active=true; +} + +void AudioStreamPlaybackSample::stop() { + + active=false; +} + +bool AudioStreamPlaybackSample::is_playing() const { + + return active; +} + +int AudioStreamPlaybackSample::get_loop_count() const { + + return 0; +} + +float AudioStreamPlaybackSample::get_pos() const { + + return float(offset>>MIX_FRAC_BITS)/base->mix_rate; +} +void AudioStreamPlaybackSample::seek_pos(float p_time) { + + if (base->format==AudioStreamSample::FORMAT_IMA_ADPCM) + return; //no seeking in ima-adpcm + + float max=get_length(); + if (p_time<0) { + p_time=0; + } else if (p_time>=max) { + p_time=max-0.001; + } + + offset = uint64_t(p_time * base->mix_rate)<<MIX_FRAC_BITS; +} + + +template<class Depth,bool is_stereo,bool is_ima_adpcm> +void AudioStreamPlaybackSample::do_resample(const Depth* p_src, AudioFrame *p_dst,int64_t &offset,int32_t &increment,uint32_t amount,IMA_ADPCM_State *ima_adpcm) { + + // this function will be compiled branchless by any decent compiler + + int32_t final,final_r,next,next_r; + while (amount--) { + + int64_t pos=offset >> MIX_FRAC_BITS; + if (is_stereo && !is_ima_adpcm) + pos<<=1; + + if (is_ima_adpcm) { + + int64_t sample_pos = pos + ima_adpcm[0].window_ofs; + + while(sample_pos>ima_adpcm[0].last_nibble) { + + + static const int16_t _ima_adpcm_step_table[89] = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, + 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, + 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, + 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, + 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, + 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, + 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, + 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, + 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 + }; + + static const int8_t _ima_adpcm_index_table[16] = { + -1, -1, -1, -1, 2, 4, 6, 8, + -1, -1, -1, -1, 2, 4, 6, 8 + }; + + for(int i=0;i<(is_stereo?2:1);i++) { + + + int16_t nibble,diff,step; + + ima_adpcm[i].last_nibble++; + const uint8_t *src_ptr=ima_adpcm[i].ptr; + + + uint8_t nbb = src_ptr[ (ima_adpcm[i].last_nibble>>1) * (is_stereo?2:1) + i ]; + nibble = (ima_adpcm[i].last_nibble&1)?(nbb>>4):(nbb&0xF); + step=_ima_adpcm_step_table[ima_adpcm[i].step_index]; + + + ima_adpcm[i].step_index += _ima_adpcm_index_table[nibble]; + if (ima_adpcm[i].step_index<0) + ima_adpcm[i].step_index=0; + if (ima_adpcm[i].step_index>88) + ima_adpcm[i].step_index=88; + + diff = step >> 3 ; + if (nibble & 1) + diff += step >> 2 ; + if (nibble & 2) + diff += step >> 1 ; + if (nibble & 4) + diff += step ; + if (nibble & 8) + diff = -diff ; + + ima_adpcm[i].predictor+=diff; + if (ima_adpcm[i].predictor<-0x8000) + ima_adpcm[i].predictor=-0x8000; + else if (ima_adpcm[i].predictor>0x7FFF) + ima_adpcm[i].predictor=0x7FFF; + + + /* store loop if there */ + if (ima_adpcm[i].last_nibble==ima_adpcm[i].loop_pos) { + + ima_adpcm[i].loop_step_index = ima_adpcm[i].step_index; + ima_adpcm[i].loop_predictor = ima_adpcm[i].predictor; + } + + //printf("%i - %i - pred %i\n",int(ima_adpcm[i].last_nibble),int(nibble),int(ima_adpcm[i].predictor)); + + } + + } + + final=ima_adpcm[0].predictor; + if (is_stereo) { + final_r=ima_adpcm[1].predictor; + } + + } else { + final=p_src[pos]; + if (is_stereo) + final_r=p_src[pos+1]; + + if (sizeof(Depth)==1) { /* conditions will not exist anymore when compiled! */ + final<<=8; + if (is_stereo) + final_r<<=8; + } + + if (is_stereo) { + + next=p_src[pos+2]; + next_r=p_src[pos+3]; + } else { + next=p_src[pos+1]; + } + + if (sizeof(Depth)==1) { + next<<=8; + if (is_stereo) + next_r<<=8; + } + + int32_t frac=int64_t(offset&MIX_FRAC_MASK); + + final=final+((next-final)*frac >> MIX_FRAC_BITS); + if (is_stereo) + final_r=final_r+((next_r-final_r)*frac >> MIX_FRAC_BITS); + + } + + + if (!is_stereo) { + final_r=final; //copy to right channel if stereo + } + + p_dst->l=final/32767.0; + p_dst->r=final_r/32767.0; + p_dst++; + + offset+=increment; + } +} + +void AudioStreamPlaybackSample::mix(AudioFrame* p_buffer,float p_rate_scale,int p_frames) { + + if (!base->data || !active) { + for(int i=0;i<p_frames;i++) { + p_buffer[i]=AudioFrame(0,0); + } + return; + } + + int len = base->data_bytes; + switch(base->format) { + case AudioStreamSample::FORMAT_8_BITS: len/=1; break; + case AudioStreamSample::FORMAT_16_BITS: len/=2; break; + case AudioStreamSample::FORMAT_IMA_ADPCM: len*=2; break; + } + + if (base->stereo) { + len/=2; + } + + /* some 64-bit fixed point precaches */ + + int64_t loop_begin_fp=((int64_t)len<< MIX_FRAC_BITS); + int64_t loop_end_fp=((int64_t)base->loop_end << MIX_FRAC_BITS); + int64_t length_fp=((int64_t)len << MIX_FRAC_BITS); + int64_t begin_limit=(base->loop_mode!=AudioStreamSample::LOOP_DISABLED)?loop_begin_fp:0; + int64_t end_limit=(base->loop_mode!=AudioStreamSample::LOOP_DISABLED)?loop_end_fp:length_fp; + bool is_stereo=base->stereo; + + int32_t todo=p_frames; + + float base_rate = AudioServer::get_singleton()->get_mix_rate(); + float srate = base->mix_rate; + srate*=p_rate_scale; + float fincrement = srate / base_rate; + int32_t increment = int32_t(fincrement * MIX_FRAC_LEN); + increment*=sign; + + + //looping + + AudioStreamSample::LoopMode loop_format=base->loop_mode; + AudioStreamSample::Format format = base->format; + + + /* audio data */ + + uint8_t *dataptr=(uint8_t*)base->data; + const void *data=dataptr+AudioStreamSample::DATA_PAD; + AudioFrame *dst_buff=p_buffer; + + + if (format==AudioStreamSample::FORMAT_IMA_ADPCM) { + + if (loop_format!=AudioStreamSample::LOOP_DISABLED) { + ima_adpcm[0].loop_pos=loop_begin_fp>>MIX_FRAC_BITS; + ima_adpcm[1].loop_pos=loop_begin_fp>>MIX_FRAC_BITS; + loop_format=AudioStreamSample::LOOP_FORWARD; + } + } + + while (todo>0) { + + int64_t limit=0; + int32_t target=0,aux=0; + + /** LOOP CHECKING **/ + + if ( increment < 0 ) { + /* going backwards */ + + if ( loop_format!=AudioStreamSample::LOOP_DISABLED && offset < loop_begin_fp ) { + /* loopstart reached */ + if ( loop_format==AudioStreamSample::LOOP_PING_PONG ) { + /* bounce ping pong */ + offset= loop_begin_fp + ( loop_begin_fp-offset ); + increment=-increment; + sign*=-1; + } else { + /* go to loop-end */ + offset=loop_end_fp-(loop_begin_fp-offset); + } + } else { + /* check for sample not reaching begining */ + if(offset < 0) { + + active=false; + break; + } + } + } else { + /* going forward */ + if( loop_format!=AudioStreamSample::LOOP_DISABLED && offset >= loop_end_fp ) { + /* loopend reached */ + + if ( loop_format==AudioStreamSample::LOOP_PING_PONG ) { + /* bounce ping pong */ + offset=loop_end_fp-(offset-loop_end_fp); + increment=-increment; + sign*=-1; + } else { + /* go to loop-begin */ + + if (format==AudioStreamSample::FORMAT_IMA_ADPCM) { + for(int i=0;i<2;i++) { + ima_adpcm[i].step_index=ima_adpcm[i].loop_step_index; + ima_adpcm[i].predictor=ima_adpcm[i].loop_predictor; + ima_adpcm[i].last_nibble=loop_begin_fp>>MIX_FRAC_BITS; + } + offset=loop_begin_fp; + } else { + offset=loop_begin_fp+(offset-loop_end_fp); + } + + } + } else { + /* no loop, check for end of sample */ + if(offset >= length_fp) { + + active=false; + break; + } + } + } + + /** MIXCOUNT COMPUTING **/ + + /* next possible limit (looppoints or sample begin/end */ + limit=(increment < 0) ?begin_limit:end_limit; + + /* compute what is shorter, the todo or the limit? */ + aux=(limit-offset)/increment+1; + target=(aux<todo)?aux:todo; /* mix target is the shorter buffer */ + + /* check just in case */ + if ( target<=0 ) { + active=false; + break; + } + + todo-=target; + + switch(base->format) { + case AudioStreamSample::FORMAT_8_BITS: { + + if (is_stereo) + do_resample<int8_t,true,false>((int8_t*)data,dst_buff,offset,increment,target,ima_adpcm); + else + do_resample<int8_t,false,false>((int8_t*)data,dst_buff,offset,increment,target,ima_adpcm); + } break; + case AudioStreamSample::FORMAT_16_BITS: { + if (is_stereo) + do_resample<int16_t,true,false>((int16_t*)data,dst_buff,offset,increment,target,ima_adpcm); + else + do_resample<int16_t,false,false>((int16_t*)data,dst_buff,offset,increment,target,ima_adpcm); + + } break; + case AudioStreamSample::FORMAT_IMA_ADPCM: { + if (is_stereo) + do_resample<int8_t,true,true>((int8_t*)data,dst_buff,offset,increment,target,ima_adpcm); + else + do_resample<int8_t,false,true>((int8_t*)data,dst_buff,offset,increment,target,ima_adpcm); + + } break; + } + + dst_buff+=target; + + } + + +} + +float AudioStreamPlaybackSample::get_length() const { + + int len = base->data_bytes; + switch(base->format) { + case AudioStreamSample::FORMAT_8_BITS: len/=1; break; + case AudioStreamSample::FORMAT_16_BITS: len/=2; break; + case AudioStreamSample::FORMAT_IMA_ADPCM: len*=2; break; + } + + if (base->stereo) { + len/=2; + } + + + return float(len)/base->mix_rate; +} + + +AudioStreamPlaybackSample::AudioStreamPlaybackSample() { + + active=false; + offset=0; + sign=1; +} + + +///////////////////// + + +void AudioStreamSample::set_format(Format p_format) { + + format=p_format; +} + +AudioStreamSample::Format AudioStreamSample::get_format() const{ + + return format; +} + +void AudioStreamSample::set_loop_mode(LoopMode p_loop_mode){ + + loop_mode=p_loop_mode; +} +AudioStreamSample::LoopMode AudioStreamSample::get_loop_mode() const{ + + return loop_mode; +} + +void AudioStreamSample::set_loop_begin(int p_frame){ + + loop_begin=p_frame; +} +int AudioStreamSample::get_loop_begin() const{ + + return loop_begin; +} + +void AudioStreamSample::set_loop_end(int p_frame){ + + loop_end=p_frame; +} +int AudioStreamSample::get_loop_end() const{ + + return loop_end; +} + + +void AudioStreamSample::set_mix_rate(int p_hz){ + + mix_rate=p_hz; +} +int AudioStreamSample::get_mix_rate() const{ + + return mix_rate; +} +void AudioStreamSample::set_stereo(bool p_enable){ + + stereo=p_enable; +} +bool AudioStreamSample::is_stereo() const{ + + return stereo; +} + +void AudioStreamSample::set_data(const PoolVector<uint8_t>& p_data) { + + AudioServer::get_singleton()->lock(); + if (data) { + AudioServer::get_singleton()->audio_data_free(data); + data=NULL; + data_bytes=0; + } + + int datalen = p_data.size(); + if (datalen) { + + PoolVector<uint8_t>::Read r = p_data.read(); + int alloc_len = datalen+DATA_PAD*2; + data = AudioServer::get_singleton()->audio_data_alloc(alloc_len); //alloc with some padding for interpolation + zeromem(data,alloc_len); + uint8_t *dataptr=(uint8_t*)data; + copymem(dataptr+DATA_PAD,r.ptr(),datalen); + data_bytes=datalen; + } + + AudioServer::get_singleton()->unlock(); + +} +PoolVector<uint8_t> AudioStreamSample::get_data() const{ + + PoolVector<uint8_t> pv; + + if (data) { + pv.resize(data_bytes); + { + + PoolVector<uint8_t>::Write w =pv.write(); + copymem(w.ptr(),data,data_bytes); + } + } + + return pv; +} + + +Ref<AudioStreamPlayback> AudioStreamSample::instance_playback() { + + Ref<AudioStreamPlaybackSample> sample; + sample.instance(); + sample->base=Ref<AudioStreamSample>(this); + return sample; +} + +String AudioStreamSample::get_stream_name() const { + + return ""; +} + +void AudioStreamSample::_bind_methods() { + + ClassDB::bind_method(_MD("set_format","format"),&AudioStreamSample::set_format); + ClassDB::bind_method(_MD("get_format"),&AudioStreamSample::get_format); + + ClassDB::bind_method(_MD("set_loop_mode","loop_mode"),&AudioStreamSample::set_loop_mode); + ClassDB::bind_method(_MD("get_loop_mode"),&AudioStreamSample::get_loop_mode); + + ClassDB::bind_method(_MD("set_loop_begin","loop_begin"),&AudioStreamSample::set_loop_begin); + ClassDB::bind_method(_MD("get_loop_begin"),&AudioStreamSample::get_loop_begin); + + ClassDB::bind_method(_MD("set_loop_end","loop_end"),&AudioStreamSample::set_loop_end); + ClassDB::bind_method(_MD("get_loop_end"),&AudioStreamSample::get_loop_end); + + ClassDB::bind_method(_MD("set_mix_rate","mix_rate"),&AudioStreamSample::set_mix_rate); + ClassDB::bind_method(_MD("get_mix_rate"),&AudioStreamSample::get_mix_rate); + + ClassDB::bind_method(_MD("set_stereo","stereo"),&AudioStreamSample::set_stereo); + ClassDB::bind_method(_MD("is_stereo"),&AudioStreamSample::is_stereo); + + ClassDB::bind_method(_MD("set_data","data"),&AudioStreamSample::set_data); + ClassDB::bind_method(_MD("get_data"),&AudioStreamSample::get_data); + + ADD_PROPERTY(PropertyInfo(Variant::INT,"format",PROPERTY_HINT_ENUM,"8-Bit,16-Bit,IMA-ADPCM"),_SCS("set_format"),_SCS("get_format")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"loop_mode",PROPERTY_HINT_ENUM,"Disabled,Forward,Ping-Pong"),_SCS("set_loop_mode"),_SCS("get_loop_mode")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"loop_begin"),_SCS("set_loop_begin"),_SCS("get_loop_begin")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"loop_end"),_SCS("set_loop_end"),_SCS("get_loop_end")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"mix_rate"),_SCS("set_mix_rate"),_SCS("get_mix_rate")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL,"stereo"),_SCS("set_stereo"),_SCS("is_stereo")); + ADD_PROPERTY(PropertyInfo(Variant::POOL_BYTE_ARRAY,"data",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_data"),_SCS("get_data")); + +} + +AudioStreamSample::AudioStreamSample() +{ + format=FORMAT_8_BITS; + loop_mode=LOOP_DISABLED; + stereo=false; + loop_begin=0; + loop_end=0; + mix_rate=44100; + data=NULL; + data_bytes=0; +} +AudioStreamSample::~AudioStreamSample() { + + + if (data) { + AudioServer::get_singleton()->audio_data_free(data); + data=NULL; + data_bytes=0; + } +} diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h new file mode 100644 index 0000000000..8c1e74608b --- /dev/null +++ b/scene/resources/audio_stream_sample.h @@ -0,0 +1,128 @@ +#ifndef AUDIOSTREAMSAMPLE_H +#define AUDIOSTREAMSAMPLE_H + +#include "servers/audio/audio_stream.h" + + +class AudioStreamSample; + +class AudioStreamPlaybackSample : public AudioStreamPlayback { + + GDCLASS( AudioStreamPlaybackSample, AudioStreamPlayback ) + enum { + MIX_FRAC_BITS=13, + MIX_FRAC_LEN=(1<<MIX_FRAC_BITS), + MIX_FRAC_MASK=MIX_FRAC_LEN-1, + }; + + struct IMA_ADPCM_State { + + int16_t step_index; + int32_t predictor; + /* values at loop point */ + int16_t loop_step_index; + int32_t loop_predictor; + int32_t last_nibble; + int32_t loop_pos; + int32_t window_ofs; + const uint8_t *ptr; + } ima_adpcm[2]; + + int64_t offset; + int sign; + bool active; +friend class AudioStreamSample; + Ref<AudioStreamSample> base; + + template<class Depth,bool is_stereo,bool is_ima_adpcm> + void do_resample(const Depth* p_src, AudioFrame *p_dst,int64_t &offset,int32_t &increment,uint32_t amount,IMA_ADPCM_State *ima_adpcm); +public: + + virtual void start(float p_from_pos=0.0); + virtual void stop(); + virtual bool is_playing() const; + + virtual int get_loop_count() const; //times it looped + + virtual float get_pos() const; + virtual void seek_pos(float p_time); + + virtual void mix(AudioFrame* p_buffer,float p_rate_scale,int p_frames); + + virtual float get_length() const; //if supported, otherwise return 0 + + + AudioStreamPlaybackSample(); +}; + +class AudioStreamSample : public AudioStream { + GDCLASS(AudioStreamSample,AudioStream) + RES_BASE_EXTENSION("smp") + +public: + + enum Format { + FORMAT_8_BITS, + FORMAT_16_BITS, + FORMAT_IMA_ADPCM + }; + + enum LoopMode { + LOOP_DISABLED, + LOOP_FORWARD, + LOOP_PING_PONG + }; + + +private: +friend class AudioStreamPlaybackSample; + + enum { + DATA_PAD=16 //padding for interpolation + }; + + Format format; + LoopMode loop_mode; + bool stereo; + int loop_begin; + int loop_end; + int mix_rate; + void *data; + uint32_t data_bytes; +protected: + + static void _bind_methods(); +public: + void set_format(Format p_format); + Format get_format() const; + + void set_loop_mode(LoopMode p_loop_mode); + LoopMode get_loop_mode() const; + + void set_loop_begin(int p_frame); + int get_loop_begin() const; + + void set_loop_end(int p_frame); + int get_loop_end() const; + + void set_mix_rate(int p_hz); + int get_mix_rate() const; + + void set_stereo(bool p_enable); + bool is_stereo() const; + + void set_data(const PoolVector<uint8_t>& p_data); + PoolVector<uint8_t> get_data() const; + + + virtual Ref<AudioStreamPlayback> instance_playback(); + virtual String get_stream_name() const; + + AudioStreamSample(); + ~AudioStreamSample(); +}; + +VARIANT_ENUM_CAST(AudioStreamSample::Format) +VARIANT_ENUM_CAST(AudioStreamSample::LoopMode) + +#endif // AUDIOSTREAMSample_H diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index a853b62254..fa89b7ba00 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -456,6 +456,26 @@ ImageTexture::~ImageTexture() { ////////////////////////////////////////// +void StreamTexture::_requested_3d(void* p_ud) { + + StreamTexture *st = (StreamTexture *)p_ud; + Ref<StreamTexture> stex(st); + ERR_FAIL_COND(!request_3d_callback); + request_3d_callback(stex); +} + +void StreamTexture::_requested_srgb(void* p_ud) { + + StreamTexture *st = (StreamTexture *)p_ud; + Ref<StreamTexture> stex(st); + ERR_FAIL_COND(!request_srgb_callback); + request_srgb_callback(stex); + +} + +StreamTexture::TextureFormatRequestCallback StreamTexture::request_3d_callback=NULL; +StreamTexture::TextureFormatRequestCallback StreamTexture::request_srgb_callback=NULL; + uint32_t StreamTexture::get_flags() const { @@ -490,6 +510,23 @@ Error StreamTexture::_load_data(const String& p_path,int &tw,int &th,int& flags, print_line("flags: "+itos(flags)); print_line("df: "+itos(df)); + + if (request_3d_callback && df&FORMAT_BIT_DETECT_3D) { + print_line("request detect 3D at "+p_path); + VS::get_singleton()->texture_set_detect_3d_callback(texture,_requested_3d,this); + } else { + print_line("not requesting detect 3D at "+p_path); + VS::get_singleton()->texture_set_detect_3d_callback(texture,NULL,NULL); + } + + if (request_srgb_callback && df&FORMAT_BIT_DETECT_SRGB) { + print_line("request detect srgb at "+p_path); + VS::get_singleton()->texture_set_detect_srgb_callback(texture,_requested_srgb,this); + } else { + VS::get_singleton()->texture_set_detect_srgb_callback(texture,NULL,NULL); + print_line("not requesting detect srgb at "+p_path); + } + if (!(df&FORMAT_BIT_STREAM)) { p_size_limit=0; } @@ -635,6 +672,7 @@ Error StreamTexture::_load_data(const String& p_path,int &tw,int &th,int& flags, { PoolVector<uint8_t>::Write w=img_data.write(); int bytes = f->get_buffer(w.ptr(),total_size - ofs); + print_line("requested read: "+itos(total_size - ofs)+" but got: "+itos(bytes)); memdelete(f); @@ -722,6 +760,12 @@ void StreamTexture::set_flags(uint32_t p_flags){ void StreamTexture::reload_from_file() { +#ifdef TOOLS_ENABLED + String ipath = get_import_path(); + if (ipath.is_resource_file() && ipath!=path_to_file) { + path_to_file=ipath; + } +#endif load(path_to_file); } diff --git a/scene/resources/texture.h b/scene/resources/texture.h index 919c588894..f684aeb658 100644 --- a/scene/resources/texture.h +++ b/scene/resources/texture.h @@ -178,6 +178,8 @@ public: FORMAT_BIT_LOSSY=1<<21, FORMAT_BIT_STREAM=1<<22, FORMAT_BIT_HAS_MIPMAPS=1<<23, + FORMAT_BIT_DETECT_3D=1<<24, + FORMAT_BIT_DETECT_SRGB=1<<25, }; private: @@ -191,6 +193,9 @@ private: virtual void reload_from_file(); + static void _requested_3d(void* p_ud); + static void _requested_srgb(void* p_ud); + protected: static void _bind_methods(); @@ -198,6 +203,11 @@ protected: public: + typedef void (*TextureFormatRequestCallback)(const Ref<StreamTexture>&); + + static TextureFormatRequestCallback request_3d_callback; + static TextureFormatRequestCallback request_srgb_callback; + uint32_t get_flags() const; Image::Format get_format() const; Error load(const String& p_path); diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp index 48f70d9077..8d3fc4721a 100644 --- a/servers/physics/joints/generic_6dof_joint_sw.cpp +++ b/servers/physics/joints/generic_6dof_joint_sw.cpp @@ -676,7 +676,7 @@ float Generic6DOFJointSW::get_param(Vector3::Axis p_axis,PhysicsServer::G6DOFJoi } break; case PhysicsServer::G6DOF_JOINT_ANGULAR_MOTOR_FORCE_LIMIT: { - return m_angularLimits[p_axis].m_maxLimitForce; + return m_angularLimits[p_axis].m_maxMotorForce; } break; } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 44bc9bfef5..21f7f0769f 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -196,6 +196,8 @@ public: virtual RID texture_create_radiance_cubemap(RID p_source,int p_resolution=-1) const=0; + virtual void texture_set_detect_3d_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void* p_userdata)=0; + virtual void texture_set_detect_srgb_callback(RID p_texture,VisualServer::TextureDetectCallback p_callback,void* p_userdata)=0; virtual void textures_keep_original(bool p_enable)=0; @@ -430,6 +432,9 @@ public: virtual void gi_probe_set_energy(RID p_probe,float p_range)=0; virtual float gi_probe_get_energy(RID p_probe) const=0; + virtual void gi_probe_set_propagation(RID p_probe,float p_range)=0; + virtual float gi_probe_get_propagation(RID p_probe) const=0; + virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; @@ -512,6 +517,7 @@ public: virtual VS::InstanceType get_base_type(RID p_rid) const=0; virtual bool free(RID p_rid)=0; + virtual bool has_os_feature(const String& p_feature) const=0; static RasterizerStorage*base_signleton; RasterizerStorage(); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 279da9149e..8f87425212 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -157,6 +157,12 @@ RID VisualServerRaster::get_test_cube() { return test_cube; } + +bool VisualServerRaster::has_os_feature(const String& p_feature) const { + + return VSG::storage->has_os_feature(p_feature); +} + VisualServerRaster::VisualServerRaster() { VSG::canvas = memnew( VisualServerCanvas); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 5c8105681a..ad0cb664c5 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -622,7 +622,8 @@ public: BIND3(texture_set_size_override,RID,int,int) BIND2RC(RID,texture_create_radiance_cubemap,RID,int) - + BIND3(texture_set_detect_3d_callback,RID,TextureDetectCallback,void*) + BIND3(texture_set_detect_srgb_callback,RID,TextureDetectCallback,void*) BIND2(texture_set_path,RID,const String&) BIND1RC(String,texture_get_path,RID) @@ -824,6 +825,9 @@ public: BIND2(gi_probe_set_energy,RID,float) BIND1RC(float,gi_probe_get_energy,RID) + BIND2(gi_probe_set_propagation,RID,float) + BIND1RC(float,gi_probe_get_propagation,RID) + BIND2(gi_probe_set_interior,RID,bool) BIND1RC(bool,gi_probe_is_interior,RID) @@ -1135,6 +1139,8 @@ public: virtual bool has_feature(Features p_feature) const; + virtual bool has_os_feature(const String& p_feature) const; + VisualServerRaster(); ~VisualServerRaster(); diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 157a85be98..297413effd 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2239,7 +2239,6 @@ void VisualServerScene::_render_scene(const Transform p_cam_transform,const Came bool redraw = VSG::scene_render->shadow_atlas_update_light(p_shadow_atlas,light->instance,coverage,light->last_version); if (redraw) { - print_line("redraw shadow"); //must redraw! _light_instance_update_shadow(ins,p_cam_transform,p_cam_projection,p_cam_orthogonal,p_shadow_atlas,scenario); } @@ -2448,6 +2447,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { probe->dynamic.bake_dynamic_range=VSG::storage->gi_probe_get_dynamic_range(p_instance->base); probe->dynamic.mipmaps_3d.clear(); + probe->dynamic.propagate=VSG::storage->gi_probe_get_propagation(p_instance->base); probe->dynamic.grid_size[0]=header->width; probe->dynamic.grid_size[1]=header->height; @@ -2942,14 +2942,12 @@ void VisualServerScene::_bake_gi_probe_light(const GIProbeDataHeader *header,con } -void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data) { +void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data,float p_propagate) { //average light to upper level - p_local_data[p_idx].energy[0]=0; - p_local_data[p_idx].energy[1]=0; - p_local_data[p_idx].energy[2]=0; - int divisor=0; + float divisor=0; + float sum[3]={0.0,0.0,0.0}; for(int i=0;i<8;i++) { @@ -2959,20 +2957,25 @@ void VisualServerScene::_bake_gi_downscale_light(int p_idx, int p_level, const G continue; if (p_level+1 < (int)p_header->cell_subdiv-1) { - _bake_gi_downscale_light(child,p_level+1,p_cells,p_header,p_local_data); + _bake_gi_downscale_light(child,p_level+1,p_cells,p_header,p_local_data,p_propagate); } - p_local_data[p_idx].energy[0]+=p_local_data[child].energy[0]; - p_local_data[p_idx].energy[1]+=p_local_data[child].energy[1]; - p_local_data[p_idx].energy[2]+=p_local_data[child].energy[2]; - divisor++; + sum[0]+=p_local_data[child].energy[0]; + sum[1]+=p_local_data[child].energy[1]; + sum[2]+=p_local_data[child].energy[2]; + divisor+=1.0; } + divisor=Math::lerp(8.0,divisor,p_propagate); + sum[0]/=divisor; + sum[1]/=divisor; + sum[2]/=divisor; + //divide by eight for average - p_local_data[p_idx].energy[0]/=divisor; - p_local_data[p_idx].energy[1]/=divisor; - p_local_data[p_idx].energy[2]/=divisor; + p_local_data[p_idx].energy[0]=Math::fast_ftoi(sum[0]); + p_local_data[p_idx].energy[1]=Math::fast_ftoi(sum[1]); + p_local_data[p_idx].energy[2]=Math::fast_ftoi(sum[2]); } @@ -3024,7 +3027,7 @@ void VisualServerScene::_bake_gi_probe(Instance *p_gi_probe) { SWAP(probe_data->dynamic.light_cache_changes,probe_data->dynamic.light_cache); //downscale to lower res levels - _bake_gi_downscale_light(0,0,cells,header,local_data); + _bake_gi_downscale_light(0,0,cells,header,local_data,probe_data->dynamic.propagate); //plot result to 3D texture! @@ -3337,6 +3340,14 @@ void VisualServerScene::render_probes() { force_lighting=true; } + float propagate = VSG::storage->gi_probe_get_propagation(instance_probe->base); + + if (probe->dynamic.propagate!=propagate) { + probe->dynamic.propagate=propagate; + force_lighting=true; + } + + if (probe->invalid==false && probe->dynamic.enabled) { switch(probe->dynamic.updating_stage) { diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 1f7de3d005..f9a5dde1ac 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -445,6 +445,7 @@ public: Vector< PoolVector<CompBlockS3TC> > mipmaps_s3tc; //for s3tc int updating_stage; + float propagate; int grid_size[3]; @@ -570,7 +571,7 @@ public: void _gi_probe_fill_local_data(int p_idx,int p_level,int p_x,int p_y,int p_z,const GIProbeDataCell* p_cell,const GIProbeDataHeader *p_header,InstanceGIProbeData::LocalData *p_local_data,Vector<uint32_t> *prev_cell); _FORCE_INLINE_ uint32_t _gi_bake_find_cell(const GIProbeDataCell *cells,int x,int y, int z,int p_cell_subdiv); - void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data); + void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell* p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, float p_propagate); void _bake_gi_probe_light(const GIProbeDataHeader *header,const GIProbeDataCell *cells,InstanceGIProbeData::LocalData *local_data,const uint32_t *leaves,int p_leaf_count, const InstanceGIProbeData::LightCache& light_cache,int p_sign); void _bake_gi_probe(Instance *p_probe); bool _check_gi_probe(Instance *p_gi_probe); diff --git a/servers/visual_server.h b/servers/visual_server.h index f75223e378..5c835c2287 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -129,6 +129,11 @@ public: virtual void texture_set_shrink_all_x2_on_set_data(bool p_enable)=0; + typedef void (*TextureDetectCallback)(void*); + + virtual void texture_set_detect_3d_callback(RID p_texture,TextureDetectCallback p_callback,void* p_userdata)=0; + virtual void texture_set_detect_srgb_callback(RID p_texture,TextureDetectCallback p_callback,void* p_userdata)=0; + struct TextureInfo { RID texture; Size2 size; @@ -360,6 +365,7 @@ public: LIGHT_PARAM_ATTENUATION, LIGHT_PARAM_SPOT_ANGLE, LIGHT_PARAM_SPOT_ATTENUATION, + LIGHT_PARAM_CONTACT_SHADOW_SIZE, LIGHT_PARAM_SHADOW_MAX_DISTANCE, LIGHT_PARAM_SHADOW_SPLIT_1_OFFSET, LIGHT_PARAM_SHADOW_SPLIT_2_OFFSET, @@ -469,6 +475,9 @@ public: virtual void gi_probe_set_energy(RID p_probe,float p_range)=0; virtual float gi_probe_get_energy(RID p_probe) const=0; + virtual void gi_probe_set_propagation(RID p_probe,float p_range)=0; + virtual float gi_probe_get_propagation(RID p_probe) const=0; + virtual void gi_probe_set_interior(RID p_probe,bool p_enable)=0; virtual bool gi_probe_is_interior(RID p_probe) const=0; @@ -938,6 +947,8 @@ public: virtual bool has_feature(Features p_feature) const=0; + virtual bool has_os_feature(const String& p_feature) const=0; + VisualServer(); virtual ~VisualServer(); diff --git a/thirdparty/README.md b/thirdparty/README.md index d0e8c05183..54930c1ebe 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -1,6 +1,13 @@ # Third party libraries +## certs + +- Upstream: ? + +TODO. + + ## enet - Upstream: http://enet.bespin.org @@ -18,6 +25,13 @@ for all platforms (especially UWP). Check the diff with the 1.3.13 tarball before the next update. +## fonts + +- Upstream: ? + +TODO. + + ## freetype - Upstream: https://www.freetype.org diff --git a/tools/certs/ca-certificates.crt b/thirdparty/certs/ca-certificates.crt index 862096d85a..862096d85a 100644 --- a/tools/certs/ca-certificates.crt +++ b/thirdparty/certs/ca-certificates.crt diff --git a/tools/editor_fonts/DroidSans.ttf b/thirdparty/fonts/DroidSans.ttf Binary files differindex 767c63ad00..767c63ad00 100644 --- a/tools/editor_fonts/DroidSans.ttf +++ b/thirdparty/fonts/DroidSans.ttf diff --git a/tools/editor_fonts/DroidSansArabic.ttf b/thirdparty/fonts/DroidSansArabic.ttf Binary files differindex 660e2a9916..660e2a9916 100644 --- a/tools/editor_fonts/DroidSansArabic.ttf +++ b/thirdparty/fonts/DroidSansArabic.ttf diff --git a/tools/editor_fonts/DroidSansFallback.ttf b/thirdparty/fonts/DroidSansFallback.ttf Binary files differindex 206621fc6c..206621fc6c 100644 --- a/tools/editor_fonts/DroidSansFallback.ttf +++ b/thirdparty/fonts/DroidSansFallback.ttf diff --git a/tools/editor_fonts/DroidSansHebrew.ttf b/thirdparty/fonts/DroidSansHebrew.ttf Binary files differindex 8d77e3e4cf..8d77e3e4cf 100644 --- a/tools/editor_fonts/DroidSansHebrew.ttf +++ b/thirdparty/fonts/DroidSansHebrew.ttf diff --git a/tools/editor_fonts/DroidSansJapanese.ttf b/thirdparty/fonts/DroidSansJapanese.ttf Binary files differindex 412fa3de05..412fa3de05 100644 --- a/tools/editor_fonts/DroidSansJapanese.ttf +++ b/thirdparty/fonts/DroidSansJapanese.ttf diff --git a/tools/editor_fonts/DroidSansThai.ttf b/thirdparty/fonts/DroidSansThai.ttf Binary files differindex f849baeff9..f849baeff9 100644 --- a/tools/editor_fonts/DroidSansThai.ttf +++ b/thirdparty/fonts/DroidSansThai.ttf diff --git a/tools/editor_fonts/LICENSE.DroidSans.txt b/thirdparty/fonts/LICENSE.DroidSans.txt index 636f1e2975..636f1e2975 100644 --- a/tools/editor_fonts/LICENSE.DroidSans.txt +++ b/thirdparty/fonts/LICENSE.DroidSans.txt diff --git a/tools/editor_fonts/LICENSE.SourceCodePro.txt b/thirdparty/fonts/LICENSE.SourceCodePro.txt index f430ee5dbe..f430ee5dbe 100644 --- a/tools/editor_fonts/LICENSE.SourceCodePro.txt +++ b/thirdparty/fonts/LICENSE.SourceCodePro.txt diff --git a/tools/editor_fonts/source_code_pro.otf b/thirdparty/fonts/source_code_pro.otf Binary files differindex 4e3b9d0bcd..4e3b9d0bcd 100644 --- a/tools/editor_fonts/source_code_pro.otf +++ b/thirdparty/fonts/source_code_pro.otf diff --git a/tools/SCsub b/tools/SCsub deleted file mode 100644 index 43cad794d4..0000000000 --- a/tools/SCsub +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python - -Import('env') - -env.tool_sources = [] -env.add_source_files(env.tool_sources, "*.cpp") - -Export('env') - - -def make_translations_header(target, source, env): - - dst = target[0].srcnode().abspath - - g = open(dst, "wb") - - """" - """ - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_TRANSLATIONS_H\n") - g.write("#define _EDITOR_TRANSLATIONS_H\n") - - import zlib - import os.path - - paths = [node.srcnode().abspath for node in source] - sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0]) - - xl_names = [] - for i in range(len(sorted_paths)): - print("Appending translation: " + sorted_paths[i]) - f = open(sorted_paths[i], "rb") - buf = f.read() - decomp_size = len(buf) - buf = zlib.compress(buf) - name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] - - #g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n") - #g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n") - g.write("static const unsigned char _translation_" + name + "_compressed[]={\n") - for i in range(len(buf)): - g.write(str(ord(buf[i])) + ",\n") - - g.write("};\n") - - xl_names.append([name, len(buf), str(decomp_size)]) - - g.write("struct EditorTranslationList {\n") - g.write("\tconst char* lang;\n") - g.write("\tint comp_size;\n") - g.write("\tint uncomp_size;\n") - g.write("\tconst unsigned char* data;\n") - g.write("};\n\n") - g.write("static EditorTranslationList _editor_translations[]={\n") - for x in xl_names: - g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n") - g.write("\t{NULL,0,0,NULL}\n") - g.write("};\n") - - g.write("#endif") - - -def make_fonts_header(target, source, env): - - dst = target[0].srcnode().abspath - - g = open(dst, "wb") - - """" - """ - - g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _EDITOR_FONTS_H\n") - g.write("#define _EDITOR_FONTS_H\n") - - # saving uncompressed, since freetype will reference from memory pointer - xl_names = [] - for i in range(len(source)): - print("Appending font: " + source[i].srcnode().abspath) - f = open(source[i].srcnode().abspath, "rb") - buf = f.read() - import os.path - - name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0] - - g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n") - g.write("static const unsigned char _font_" + name + "[]={\n") - for i in range(len(buf)): - g.write(str(ord(buf[i])) + ",\n") - - g.write("};\n") - - g.write("#endif") - - -if (env["tools"] != "no"): - - import glob - - dir = env.Dir('.').abspath - tlist = glob.glob(dir + "/translations/*.po") - - print("translations: ", tlist) - env.Depends('#tools/editor/translations.h', tlist) - env.Command('#tools/editor/translations.h', tlist, make_translations_header) - - flist = glob.glob(dir + "/editor_fonts/*.ttf") - flist.append(glob.glob(dir + "/editor_fonts/*.otf")) - - print("fonts: ", flist) - env.Depends('#tools/editor/builtin_fonts.h', flist) - env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header) - - SConscript('editor/SCsub') - SConscript('collada/SCsub') - SConscript('doc/SCsub') - - lib = env.Library("tool", env.tool_sources) - - env.Prepend(LIBS=[lib]) diff --git a/tools/editor/SCsub b/tools/editor/SCsub index a0e6802348..710dac3ea7 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -1,9 +1,10 @@ #!/usr/bin/env python Import('env') +env.editor_sources = [] -def make_doc_header(target, source, env): +def make_certs_header(target, source, env): src = source[0].srcnode().abspath dst = target[0].srcnode().abspath @@ -15,18 +16,18 @@ def make_doc_header(target, source, env): buf = zlib.compress(buf) g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _DOC_DATA_RAW_H\n") - g.write("#define _DOC_DATA_RAW_H\n") - g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n") - g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n") - g.write("static const unsigned char _doc_data_compressed[]={\n") + g.write("#ifndef _CERTS_RAW_H\n") + g.write("#define _CERTS_RAW_H\n") + g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n") + g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n") + g.write("static const unsigned char _certs_compressed[]={\n") for i in range(len(buf)): g.write(str(ord(buf[i])) + ",\n") g.write("};\n") g.write("#endif") -def make_certs_header(target, source, env): +def make_doc_header(target, source, env): src = source[0].srcnode().abspath dst = target[0].srcnode().abspath @@ -38,23 +39,104 @@ def make_certs_header(target, source, env): buf = zlib.compress(buf) g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") - g.write("#ifndef _CERTS_RAW_H\n") - g.write("#define _CERTS_RAW_H\n") - g.write("static const int _certs_compressed_size=" + str(len(buf)) + ";\n") - g.write("static const int _certs_uncompressed_size=" + str(decomp_size) + ";\n") - g.write("static const unsigned char _certs_compressed[]={\n") + g.write("#ifndef _DOC_DATA_RAW_H\n") + g.write("#define _DOC_DATA_RAW_H\n") + g.write("static const int _doc_data_compressed_size=" + str(len(buf)) + ";\n") + g.write("static const int _doc_data_uncompressed_size=" + str(decomp_size) + ";\n") + g.write("static const unsigned char _doc_data_compressed[]={\n") for i in range(len(buf)): g.write(str(ord(buf[i])) + ",\n") g.write("};\n") g.write("#endif") +def make_fonts_header(target, source, env): + + dst = target[0].srcnode().abspath + + g = open(dst, "wb") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_FONTS_H\n") + g.write("#define _EDITOR_FONTS_H\n") + + # saving uncompressed, since freetype will reference from memory pointer + xl_names = [] + for i in range(len(source)): + print("Appending font: " + source[i].srcnode().abspath) + f = open(source[i].srcnode().abspath, "rb") + buf = f.read() + import os.path + + name = os.path.splitext(os.path.basename(source[i].srcnode().abspath))[0] + + g.write("static const int _font_" + name + "_size=" + str(len(buf)) + ";\n") + g.write("static const unsigned char _font_" + name + "[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i])) + ",\n") + + g.write("};\n") + + g.write("#endif") + + +def make_translations_header(target, source, env): + + dst = target[0].srcnode().abspath + + g = open(dst, "wb") + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef _EDITOR_TRANSLATIONS_H\n") + g.write("#define _EDITOR_TRANSLATIONS_H\n") + + import zlib + import os.path + + paths = [node.srcnode().abspath for node in source] + sorted_paths = sorted(paths, key=lambda path: os.path.splitext(os.path.basename(path))[0]) + + xl_names = [] + for i in range(len(sorted_paths)): + print("Appending translation: " + sorted_paths[i]) + f = open(sorted_paths[i], "rb") + buf = f.read() + decomp_size = len(buf) + buf = zlib.compress(buf) + name = os.path.splitext(os.path.basename(sorted_paths[i]))[0] + + #g.write("static const int _translation_"+name+"_compressed_size="+str(len(buf))+";\n") + #g.write("static const int _translation_"+name+"_uncompressed_size="+str(decomp_size)+";\n") + g.write("static const unsigned char _translation_" + name + "_compressed[]={\n") + for i in range(len(buf)): + g.write(str(ord(buf[i])) + ",\n") + + g.write("};\n") + + xl_names.append([name, len(buf), str(decomp_size)]) + + g.write("struct EditorTranslationList {\n") + g.write("\tconst char* lang;\n") + g.write("\tint comp_size;\n") + g.write("\tint uncomp_size;\n") + g.write("\tconst unsigned char* data;\n") + g.write("};\n\n") + g.write("static EditorTranslationList _editor_translations[]={\n") + for x in xl_names: + g.write("\t{ \"" + x[0] + "\", " + str(x[1]) + ", " + str(x[2]) + ",_translation_" + x[0] + "_compressed},\n") + g.write("\t{NULL,0,0,NULL}\n") + g.write("};\n") + + g.write("#endif") + + if (env["tools"] == "yes"): + # Register exporters reg_exporters_inc = '#include "register_exporters.h"\n' reg_exporters = 'void register_exporters() {\n' for e in env.platform_exporters: - env.tool_sources.append("#platform/" + e + "/export/export.cpp") + env.editor_sources.append("#platform/" + e + "/export/export.cpp") reg_exporters += '\t//register_' + e + '_exporter();\n' reg_exporters_inc += '#include "platform/' + e + '/export/export.h"\n' reg_exporters += '}\n' @@ -63,19 +145,42 @@ if (env["tools"] == "yes"): f.write(reg_exporters) f.close() + # API documentation env.Depends("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml") env.Command("#tools/editor/doc_data_compressed.h", "#doc/base/classes.xml", make_doc_header) - env.Depends("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt") - env.Command("#tools/editor/certs_compressed.h", "#tools/certs/ca-certificates.crt", make_certs_header) + # Certificates + env.Depends("#tools/editor/certs_compressed.h", "#thirdparty/certs/ca-certificates.crt") + env.Command("#tools/editor/certs_compressed.h", "#thirdparty/certs/ca-certificates.crt", make_certs_header) - # make_doc_header(env.File("#tools/editor/doc_data_raw.h").srcnode().abspath,env.File("#doc/base/classes.xml").srcnode().abspath,env) + import glob + path = env.Dir('.').abspath - env.add_source_files(env.tool_sources, "*.cpp") + # Translations + tlist = glob.glob(path + "/translations/*.po") + print("translations: ", tlist) + env.Depends('#tools/editor/translations.h', tlist) + env.Command('#tools/editor/translations.h', tlist, make_translations_header) - Export('env') - SConscript('icons/SCsub') - SConscript('plugins/SCsub') + # Fonts + flist = glob.glob(path + "/../../thirdparty/fonts/*.ttf") + flist.append(glob.glob(path + "/../../thirdparty/fonts/*.otf")) + print("fonts: ", flist) + env.Depends('#tools/editor/builtin_fonts.h', flist) + env.Command('#tools/editor/builtin_fonts.h', flist, make_fonts_header) + + + env.add_source_files(env.editor_sources, "*.cpp") + + SConscript('collada/SCsub') + SConscript('doc/SCsub') SConscript('fileserver/SCsub') - SConscript('io_plugins/SCsub') + SConscript('icons/SCsub') SConscript('import/SCsub') + SConscript('io_plugins/SCsub') + SConscript('plugins/SCsub') + + lib = env.Library("editor", env.editor_sources) + env.Prepend(LIBS=[lib]) + + Export('env') diff --git a/tools/doc/SCsub b/tools/editor/collada/SCsub index 4bc64ffdc2..04c9a827ef 100644 --- a/tools/doc/SCsub +++ b/tools/editor/collada/SCsub @@ -2,6 +2,6 @@ Import('env') -env.add_source_files(env.tool_sources, "*.cpp") +env.add_source_files(env.editor_sources, "*.cpp") Export('env') diff --git a/tools/collada/collada.cpp b/tools/editor/collada/collada.cpp index a23fd84aa0..a23fd84aa0 100644 --- a/tools/collada/collada.cpp +++ b/tools/editor/collada/collada.cpp diff --git a/tools/collada/collada.h b/tools/editor/collada/collada.h index fd7ad4920d..fd7ad4920d 100644 --- a/tools/collada/collada.h +++ b/tools/editor/collada/collada.h diff --git a/tools/collada/SCsub b/tools/editor/doc/SCsub index 4bc64ffdc2..04c9a827ef 100644 --- a/tools/collada/SCsub +++ b/tools/editor/doc/SCsub @@ -2,6 +2,6 @@ Import('env') -env.add_source_files(env.tool_sources, "*.cpp") +env.add_source_files(env.editor_sources, "*.cpp") Export('env') diff --git a/tools/doc/doc_data.cpp b/tools/editor/doc/doc_data.cpp index d51dc886b2..d51dc886b2 100644 --- a/tools/doc/doc_data.cpp +++ b/tools/editor/doc/doc_data.cpp diff --git a/tools/doc/doc_data.h b/tools/editor/doc/doc_data.h index fead1da510..fead1da510 100644 --- a/tools/doc/doc_data.h +++ b/tools/editor/doc/doc_data.h diff --git a/tools/doc/doc_dump.cpp b/tools/editor/doc/doc_dump.cpp index 5ebba596e9..5ebba596e9 100644 --- a/tools/doc/doc_dump.cpp +++ b/tools/editor/doc/doc_dump.cpp diff --git a/tools/doc/doc_dump.h b/tools/editor/doc/doc_dump.h index 84629b89c8..84629b89c8 100644 --- a/tools/doc/doc_dump.h +++ b/tools/editor/doc/doc_dump.h diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp index 1d7d58591c..c7b50a3c09 100644 --- a/tools/editor/editor_file_system.cpp +++ b/tools/editor/editor_file_system.cpp @@ -544,7 +544,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess if (f.begins_with(".")) //ignore hidden and . / .. continue; - if (FileAccess::exists(cd.plus_file(f).plus_file("engine.cfg"))) // skip if another project inside this + if (FileAccess::exists(cd.plus_file(f).plus_file("godot.cfg"))) // skip if another project inside this continue; dirs.push_back(f); @@ -630,6 +630,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess import_mt=FileAccess::get_modified_time(path+".import"); } + if (fc && fc->modification_time==mt && fc->import_modification_time==import_mt && _check_missing_imported_files(path)) { fi->type=fc->type; @@ -638,7 +639,20 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess } else { - print_line("REIMPORT BECAUSE: time changed"); + if (!fc) { + print_line("REIMPORT BECAUSE: not previously found"); + } else if (fc->modification_time!=mt) { + print_line("REIMPORT BECAUSE: modified resource time "+itos(fc->modification_time)+" vs "+itos(mt)); + + } else if (fc->import_modification_time!=import_mt) { + print_line("REIMPORT BECAUSE: modified .import time"+itos(fc->import_modification_time)+" vs "+itos(import_mt)); + + } else { + + print_line("REIMPORT BECAUSE: missing imported files"); + } + + fi->type=ResourceFormatImporter::get_singleton()->get_resource_type(path); fi->modified_time=0; fi->import_modified_time=0; @@ -719,7 +733,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S int idx = p_dir->find_dir_index(f); if (idx==-1) { - if (FileAccess::exists(cd.plus_file(f).plus_file("engine.cfg"))) // skip if another project inside this + if (FileAccess::exists(cd.plus_file(f).plus_file("godot.cfg"))) // skip if another project inside this continue; EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory ); @@ -774,6 +788,10 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S if (import_extensions.has(ext)) { //if it can be imported, and it was added, it needs to be reimported print_line("REIMPORT: file was not found before, reimport"); + print_line("at dir: "+p_dir->get_path()+" file: "+f); + for(int i=0;i<p_dir->files.size();i++) { + print_line(itos(i)+": "+p_dir->files[i]->file); + } ItemAction ia; ia.action=ItemAction::ACTION_FILE_REIMPORT; ia.dir=p_dir; @@ -826,6 +844,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S } else { uint64_t import_mt=FileAccess::get_modified_time(path+".import"); + print_line(itos(import_mt)+" vs "+itos(p_dir->files[i]->import_modified_time)); if (import_mt!=p_dir->files[i]->import_modified_time) { print_line("REIMPORT: import modified changed, reimport"); reimport=true; @@ -1009,7 +1028,7 @@ void EditorFileSystem::_notification(int p_what) { bool EditorFileSystem::is_scanning() const { - return scanning; + return scanning || scanning_changes; } float EditorFileSystem::get_scanning_progress() const { @@ -1079,6 +1098,8 @@ bool EditorFileSystem::_find_file(const String& p_file,EditorFileSystemDirectory for(int i=0;i<path.size();i++) { + if (path[i].begins_with(".")) + return false; int idx=-1; for(int j=0;j<fs->get_subdir_count();j++) { @@ -1266,6 +1287,7 @@ void EditorFileSystem::update_file(const String& p_file) { EditorFileSystemDirectory::FileInfo *fi = memnew( EditorFileSystemDirectory::FileInfo ); fi->file=p_file.get_file(); + fi->import_modified_time=0; if (idx==fs->files.size()) { fs->files.push_back(fi); @@ -1281,7 +1303,9 @@ void EditorFileSystem::update_file(const String& p_file) { //print_line("UPDATING: "+p_file); fs->files[cpos]->type=type; fs->files[cpos]->modified_time=FileAccess::get_modified_time(p_file); - fs->files[cpos]->import_modified_time=0; + //if (FileAccess::exists(p_file+".import")) { + // fs->files[cpos]->import_modified_time=FileAccess::get_modified_time(p_file+".import"); + //} EditorResourcePreview::get_singleton()->call_deferred("check_for_invalidation",p_file); call_deferred("emit_signal","filesystem_changed"); //update later @@ -1369,6 +1393,7 @@ void EditorFileSystem::_reimport_file(const String& p_file) { f->store_line("type=\""+importer->get_resource_type()+"\""); } + if (importer->get_save_extension()=="") { //no path } else if (import_variants.size()) { @@ -1376,7 +1401,10 @@ void EditorFileSystem::_reimport_file(const String& p_file) { for(List<String>::Element *E=import_variants.front();E;E=E->next()) { - f->store_line("path."+E->get()+"=\""+base_path.c_escape()+"."+E->get()+"."+importer->get_save_extension()+"\""); + String path = base_path.c_escape()+"."+E->get()+"."+importer->get_save_extension(); + + f->store_line("path."+E->get()+"=\""+path+"\""); + } } else { @@ -1402,6 +1430,8 @@ void EditorFileSystem::_reimport_file(const String& p_file) { f->store_line(""); //store options in provided order, to avoid file changing + + for (List<ResourceImporter::ImportOption>::Element *E=opts.front();E;E=E->next()) { String base = E->get().option.name; @@ -1412,16 +1442,31 @@ void EditorFileSystem::_reimport_file(const String& p_file) { } + f->close(); memdelete(f); //update modified times, to avoid reimport fs->files[cpos]->modified_time = FileAccess::get_modified_time(p_file); fs->files[cpos]->import_modified_time = FileAccess::get_modified_time(p_file+".import"); + + //if file is currently up, maybe the source it was loaded from changed, so import math must be updated for it + //to reload properly + if (ResourceCache::has(p_file)) { + + Resource *r = ResourceCache::get(p_file); + + if (r->get_import_path()!=String()) { + + String dst_path = ResourceFormatImporter::get_singleton()->get_internal_resource_path(p_file); + r->set_import_path(dst_path); + r->set_import_last_modified_time(0); + } + } } void EditorFileSystem::reimport_files(const Vector<String>& p_files) { - + importing=true; EditorProgress pr("reimport",TTR("(Re)Importing Assets"),p_files.size()); for(int i=0;i<p_files.size();i++) { pr.step(p_files[i].get_file(),i); @@ -1430,6 +1475,10 @@ void EditorFileSystem::reimport_files(const Vector<String>& p_files) { } _save_filesystem_cache(); + importing=false; + if (!is_scanning()) { + emit_signal("filesystem_changed"); + } } void EditorFileSystem::_bind_methods() { @@ -1478,6 +1527,7 @@ EditorFileSystem::EditorFileSystem() { thread = NULL; scanning=false; + importing=false; use_threads=true; thread_sources=NULL; new_filesystem=NULL; diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h index 92169907a4..10d9b919fc 100644 --- a/tools/editor/editor_file_system.h +++ b/tools/editor/editor_file_system.h @@ -133,6 +133,7 @@ class EditorFileSystem : public Node { bool abort_scan; bool scanning; + bool importing; float scan_total; @@ -210,6 +211,7 @@ public: EditorFileSystemDirectory *get_filesystem(); bool is_scanning() const; + bool is_importing() const { return importing; } float get_scanning_progress() const; void scan(); void scan_changes(); diff --git a/tools/editor/editor_help.h b/tools/editor/editor_help.h index 85bac27705..3c4ba1f43e 100644 --- a/tools/editor/editor_help.h +++ b/tools/editor/editor_help.h @@ -40,7 +40,7 @@ #include "scene/main/timer.h" #include "tools/editor/code_editor.h" -#include "tools/doc/doc_data.h" +#include "tools/editor/doc/doc_data.h" class EditorNode; diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp index b79bf7042b..69a004fc08 100644 --- a/tools/editor/editor_import_export.cpp +++ b/tools/editor/editor_import_export.cpp @@ -390,8 +390,8 @@ Vector<StringName> EditorExportPlatform::get_dependencies(bool p_bundles) const Set<StringName> exported; - if (FileAccess::exists("res://engine.cfg")) - exported.insert("res://engine.cfg"); + if (FileAccess::exists("res://godot.cfg")) + exported.insert("res://godot.cfg"); if (EditorImportExport::get_singleton()->get_export_filter()!=EditorImportExport::EXPORT_SELECTED) { @@ -987,7 +987,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func } - StringName engine_cfg="res://engine.cfg"; + StringName engine_cfg="res://godot.cfg"; StringName boot_splash; { String splash=GlobalConfig::get_singleton()->get("application/boot_splash"); //avoid splash from being converted @@ -1041,7 +1041,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func { - //make binary engine.cfg config + //make binary godot.cfg config Map<String,Variant> custom; @@ -1085,7 +1085,7 @@ Error EditorExportPlatform::export_project_files(EditorExportSaveFunction p_func } - String remap_file="engine.cfb"; + String remap_file="godot.cfb"; String engine_cfb =EditorSettings::get_singleton()->get_settings_path()+"/tmp/tmp"+remap_file; GlobalConfig::get_singleton()->save_custom(engine_cfb,custom); Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index a51507e96f..352b0818b4 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -99,8 +99,11 @@ #include "plugins/color_ramp_editor_plugin.h" #include "plugins/collision_shape_2d_editor_plugin.h" #include "plugins/gi_probe_editor_plugin.h" -#include "import/resource_import_texture.h" +#include "import/resource_importer_texture.h" #include "import/resource_importer_csv_translation.h" +#include "import/resource_importer_wav.h" +#include "import/resource_importer_obj.h" +#include "import/resource_importer_scene.h" // end #include "editor_settings.h" #include "io_plugins/editor_texture_import_plugin.h" @@ -111,7 +114,7 @@ #include "io_plugins/editor_bitmask_import_plugin.h" #include "io_plugins/editor_mesh_import_plugin.h" #include "io_plugins/editor_export_scene.h" -#include "io_plugins/editor_import_collada.h" +#include "import/editor_import_collada.h" #include "io_plugins/editor_scene_importer_fbxconv.h" #include "plugins/editor_preview_plugins.h" @@ -305,6 +308,8 @@ void EditorNode::_notification(int p_what) { } + ResourceImporterTexture::get_singleton()->update_imports(); + } if (p_what==NOTIFICATION_ENTER_TREE) { @@ -408,8 +413,10 @@ void EditorNode::_fs_changed() { if (E->get()->get_import_path()!=String()) { //imported resource uint64_t mt = FileAccess::get_modified_time(E->get()->get_import_path()); + print_line("testing modified: "+E->get()->get_import_path()+" "+itos(mt)+" vs "+itos(E->get()->get_import_last_modified_time())); if (mt!=E->get()->get_import_last_modified_time()) { + print_line("success"); changed.push_back(E->get()); } @@ -3301,7 +3308,10 @@ void EditorNode::fix_dependencies(const String& p_for_file) { dependency_fixer->edit(p_for_file); } -Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bool p_set_inherited,bool p_clear_errors) { + + + +Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps, bool p_set_inherited, bool p_clear_errors, bool p_force_open_imported) { if (!is_inside_tree()) { defer_load_scene = p_scene; @@ -3310,6 +3320,8 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo if(!p_set_inherited) { + + for(int i=0;i<editor_data.get_edited_scene_count();i++) { if (editor_data.get_scene_path(i)==p_scene) { @@ -3317,9 +3329,19 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo return OK; } } + + if (!p_force_open_imported && FileAccess::exists(p_scene+".import")) { + open_imported->set_text(vformat(TTR("Scene '%s' was automatically imported, so it can't be modified.\nTo make changes to it, a new inherited scene can be created."),p_scene.get_file())); + open_imported->popup_centered_minsize(); + new_inherited_button->grab_focus(); + open_import_request=p_scene; + return OK; + } + } + if (p_clear_errors) load_errors->clear(); @@ -4955,6 +4977,19 @@ void EditorNode::_call_build() { } } + +void EditorNode::_inherit_imported(const String& p_action) { + + open_imported->hide(); + load_scene(open_import_request,true,true); + +} + +void EditorNode::_open_imported() { + + load_scene(open_import_request,true,false,true,true); +} + void EditorNode::_bind_methods() { @@ -5032,6 +5067,8 @@ void EditorNode::_bind_methods() { ClassDB::bind_method(_MD("get_gui_base"), &EditorNode::get_gui_base); ClassDB::bind_method(_MD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch); + ClassDB::bind_method(_MD("_open_imported"), &EditorNode::_open_imported); + ClassDB::bind_method(_MD("_inherit_imported"), &EditorNode::_inherit_imported); ADD_SIGNAL( MethodInfo("play_pressed") ); ADD_SIGNAL( MethodInfo("pause_pressed") ); @@ -5126,6 +5163,25 @@ EditorNode::EditorNode() { import_csv_translation.instance(); ResourceFormatImporter::get_singleton()->add_importer(import_csv_translation); + Ref<ResourceImporterWAV> import_wav; + import_wav.instance(); + ResourceFormatImporter::get_singleton()->add_importer(import_wav); + + + Ref<ResourceImporterOBJ> import_obj; + import_obj.instance(); + ResourceFormatImporter::get_singleton()->add_importer(import_obj); + + Ref<ResourceImporterScene> import_scene; + import_scene.instance(); + ResourceFormatImporter::get_singleton()->add_importer(import_scene); + + { + Ref<EditorSceneImporterCollada> import_collada; + import_collada.instance(); + import_scene->add_importer(import_collada); + } + } _pvrtc_register_compressors(); @@ -6335,6 +6391,14 @@ EditorNode::EditorNode() { } } + open_imported = memnew( ConfirmationDialog ); + open_imported->get_ok()->set_text(TTR("Open Anyway")); + new_inherited_button=open_imported->add_button("New Inherited",!OS::get_singleton()->get_swap_ok_cancel(),"inherit"); + open_imported->connect("confirmed",this,"_open_imported"); + open_imported->connect("custom_action",this,"_inherit_imported"); + gui_base->add_child(open_imported); + + //edited_scene=NULL; saved_version=1; diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 785136a968..4aca433f9c 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -346,6 +346,10 @@ private: DependencyErrorDialog *dependency_error; DependencyEditor *dependency_fixer; OrphanResourcesDialog *orphan_resources; + ConfirmationDialog *open_imported; + Button *new_inherited_button; + String open_import_request; + TabContainer *dock_slot[DOCK_SLOT_MAX]; Rect2 dock_select_rect[DOCK_SLOT_MAX]; @@ -584,6 +588,8 @@ private: MAX_BUILD_CALLBACKS=128 }; + void _inherit_imported(const String &p_action); + void _open_imported(); static int plugin_init_callback_count; @@ -684,7 +690,7 @@ public: void fix_dependencies(const String& p_for_file); void clear_scene() { _cleanup_scene(); } - Error load_scene(const String& p_scene, bool p_ignore_broken_deps=false, bool p_set_inherited=false, bool p_clear_errors=true); + Error load_scene(const String& p_scene, bool p_ignore_broken_deps=false, bool p_set_inherited=false, bool p_clear_errors=true,bool p_force_open_imported=false); Error load_resource(const String& p_scene); bool is_scene_open(const String& p_path); diff --git a/tools/editor/fileserver/SCsub b/tools/editor/fileserver/SCsub index 4bf55189cc..f1fa50148f 100644 --- a/tools/editor/fileserver/SCsub +++ b/tools/editor/fileserver/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources, "*.cpp") +env.add_source_files(env.editor_sources, "*.cpp") diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index f86ae2b10d..4af481d1f6 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -92,5 +92,5 @@ make_editor_icons_builder = Builder(action=make_editor_icons_action, env['BUILDERS']['MakeEditorIconsBuilder'] = make_editor_icons_builder env.Alias('editor_icons', [env.MakeEditorIconsBuilder('#tools/editor/editor_icons.cpp', Glob("*.png"))]) -env.tool_sources.append("#tools/editor/editor_icons.cpp") +env.editor_sources.append("#tools/editor/editor_icons.cpp") Export('env') diff --git a/tools/editor/import/SCsub b/tools/editor/import/SCsub index 4bf55189cc..f1fa50148f 100644 --- a/tools/editor/import/SCsub +++ b/tools/editor/import/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources, "*.cpp") +env.add_source_files(env.editor_sources, "*.cpp") diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/import/editor_import_collada.cpp index 963347f18b..a901de1faf 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/import/editor_import_collada.cpp @@ -28,8 +28,7 @@ /*************************************************************************/ #include "editor_import_collada.h" -#if 0 -#include "collada/collada.h" + #include "scene/3d/spatial.h" #include "scene/3d/skeleton.h" #include "scene/3d/path.h" @@ -40,6 +39,7 @@ #include "scene/resources/animation.h" #include "scene/resources/packed_scene.h" #include "os/os.h" +#include "tools/editor/collada/collada.h" #include "tools/editor/editor_node.h" #include <iostream> @@ -65,6 +65,7 @@ struct ColladaImport { bool found_directional; bool force_make_tangents; bool apply_mesh_xform_to_vertices; + bool use_mesh_builtin_materials; float bake_fps; @@ -87,7 +88,7 @@ struct ColladaImport { Error _create_scene(Collada::Node *p_node, Spatial *p_parent); Error _create_resources(Collada::Node *p_node); Error _create_material(const String& p_material); - Error _create_mesh_surfaces(bool p_optimize, Ref<Mesh>& p_mesh, const Map<String,Collada::NodeGeometry::Material>& p_material_map, const Collada::MeshData &meshdata, const Transform& p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >(), bool p_for_morph=false); + Error _create_mesh_surfaces(bool p_optimize, Ref<Mesh>& p_mesh, const Map<String,Collada::NodeGeometry::Material>& p_material_map, const Collada::MeshData &meshdata, const Transform& p_local_xform, const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data, Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >(), bool p_for_morph=false, bool p_use_mesh_material=false); Error load(const String& p_path, int p_flags, bool p_force_make_tangents=false); void _fix_param_animation_tracks(); void create_animation(int p_clip,bool p_make_tracks_in_all_bones, bool p_import_value_tracks); @@ -429,9 +430,10 @@ Error ColladaImport::_create_material(const String& p_target) { } } else { - //material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR,effect.specular.color); + material->set_metalness(effect.specular.color.get_v()); } + // EMISSION if (effect.emission.texture!="") { @@ -442,17 +444,21 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { + material->set_feature(FixedSpatialMaterial::FEATURE_EMISSION,true); material->set_texture(FixedSpatialMaterial::TEXTURE_EMISSION,texture); material->set_emission(Color(1,1,1,1)); //material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,Color(1,1,1,1)); }else { - //missing_textures.push_back(texfile.get_file()); + missing_textures.push_back(texfile.get_file()); } } } else { - //material->set_parameter(FixedSpatialMaterial::PARAM_EMISSION,effect.emission.color); + if (effect.emission.color!=Color()) { + material->set_feature(FixedSpatialMaterial::FEATURE_EMISSION,true); + material->set_emission(effect.emission.color); + } } // NORMAL @@ -464,6 +470,7 @@ Error ColladaImport::_create_material(const String& p_target) { Ref<Texture> texture = ResourceLoader::load(texfile,"Texture"); if (texture.is_valid()) { + material->set_feature(FixedSpatialMaterial::FEATURE_NORMAL_MAPPING,true); material->set_texture(FixedSpatialMaterial::TEXTURE_NORMAL,texture); //material->set_emission(Color(1,1,1,1)); @@ -476,7 +483,9 @@ Error ColladaImport::_create_material(const String& p_target) { } - //material->set_parameter(FixedSpatialMaterial::PARAM_SPECULAR_EXP,effect.shininess); + float roughness = Math::sqrt(1.0-((Math::log(effect.shininess)/Math::log(2.0))/8.0)); //not very right.. + material->set_roughness(roughness); + if (effect.double_sided) { material->set_cull_mode(FixedSpatialMaterial::CULL_DISABLED); } @@ -610,7 +619,7 @@ static void _generate_tangents_and_binormals(const PoolVector<int>& p_indices,co } } -Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes,bool p_for_morph) { +Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes,bool p_for_morph,bool p_use_mesh_material) { bool local_xform_mirror=p_local_xform.basis.determinant() < 0; @@ -1494,7 +1503,9 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,con p_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES,d,mr,p_for_morph?0:Mesh::ARRAY_COMPRESS_DEFAULT); if (material.is_valid()) { - p_mesh->surface_set_material(surface, material); + if (p_use_mesh_material) { + p_mesh->surface_set_material(surface, material); + } p_mesh->surface_set_name(surface, material->get_name()); } } @@ -1753,7 +1764,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) { mesh=Ref<Mesh>(memnew( Mesh )); const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; mesh->set_name( meshdata.name ); - Error err = _create_mesh_surfaces(morphs.size()==0,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,morph,morphs); + Error err = _create_mesh_surfaces(morphs.size()==0,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,morph,morphs,false,use_mesh_builtin_materials); ERR_FAIL_COND_V(err,err); mesh_cache[meshid]=mesh; @@ -1764,7 +1775,33 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) { } if (!mesh.is_null()) { + mi->set_mesh(mesh); + if (!use_mesh_builtin_materials) { + const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid]; + + for(int i=0;i<meshdata.primitives.size();i++) { + + String matname=meshdata.primitives[i].material; + + if (ng->material_map.has(matname)) { + String target=ng->material_map[matname].target; + + Ref<Material> material; + if (!material_cache.has(target)) { + Error err = _create_material(target); + if (!err) + material=material_cache[target]; + } else + material=material_cache[target]; + + mi->set_surface_material(i,material); + } else if (matname!=""){ + print_line("Warning, unreferenced material in geometry instance: "+matname); + } + + } + } } } } @@ -2375,6 +2412,7 @@ Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_ if (p_flags&IMPORT_ANIMATION) flags|=Collada::IMPORT_FLAG_ANIMATION; + state.use_mesh_builtin_materials=!(p_flags&IMPORT_MATERIALS_IN_INSTANCES); state.bake_fps=p_bake_fps; Error err = state.load(p_path,flags,p_flags&EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS); @@ -2435,6 +2473,8 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String& p_path ColladaImport state; + state.use_mesh_builtin_materials=false; + Error err = state.load(p_path,Collada::IMPORT_FLAG_ANIMATION,p_flags&EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS); ERR_FAIL_COND_V(err!=OK,RES()); @@ -2465,4 +2505,4 @@ EditorSceneImporterCollada::EditorSceneImporterCollada() { } -#endif + diff --git a/tools/editor/io_plugins/editor_import_collada.h b/tools/editor/import/editor_import_collada.h index c325b58e32..cd3614bb40 100644 --- a/tools/editor/io_plugins/editor_import_collada.h +++ b/tools/editor/import/editor_import_collada.h @@ -29,9 +29,9 @@ #ifndef EDITOR_IMPORT_COLLADA_H #define EDITOR_IMPORT_COLLADA_H -#include "tools/editor/io_plugins/editor_scene_import_plugin.h" +#include "tools/editor/import/resource_importer_scene.h" + -#if 0 class EditorSceneImporterCollada : public EditorSceneImporter { @@ -46,6 +46,6 @@ public: EditorSceneImporterCollada(); }; -#endif + #endif diff --git a/tools/editor/import/resource_importer_obj.cpp b/tools/editor/import/resource_importer_obj.cpp new file mode 100644 index 0000000000..e6e23366f6 --- /dev/null +++ b/tools/editor/import/resource_importer_obj.cpp @@ -0,0 +1,231 @@ +#include "resource_importer_obj.h" + +#include "io/resource_saver.h" +#include "scene/resources/mesh.h" +#include "scene/resources/surface_tool.h" +#include "scene/resources/surface_tool.h" +#include "os/file_access.h" + +String ResourceImporterOBJ::get_importer_name() const { + + return "obj_mesh"; +} + +String ResourceImporterOBJ::get_visible_name() const{ + + return "OBJ As Mesh"; +} +void ResourceImporterOBJ::get_recognized_extensions(List<String> *p_extensions) const{ + + p_extensions->push_back("obj"); +} +String ResourceImporterOBJ::get_save_extension() const { + return "msh"; +} + +String ResourceImporterOBJ::get_resource_type() const{ + + return "Mesh"; +} + +bool ResourceImporterOBJ::get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const { + + return true; +} + +int ResourceImporterOBJ::get_preset_count() const { + return 0; +} +String ResourceImporterOBJ::get_preset_name(int p_idx) const { + + return String(); +} + + +void ResourceImporterOBJ::get_import_options(List<ImportOption> *r_options,int p_preset) const { + + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"generate/tangents"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"generate/normals"),true)); + //not for nowp + //r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"import/materials"))); + //r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"import/textures"))); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"force/flip_faces"),false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"force/smooth_shading"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"force/weld_vertices"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL,"force/weld_tolerance",PROPERTY_HINT_RANGE,"0.00001,16,0.00001"),0.0001)); + //r_options->push_back(PropertyInfo(Variant::INT,"compress/bitrate",PROPERTY_HINT_ENUM,"64,96,128,192")); + +} + + + +Error ResourceImporterOBJ::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) { + + FileAccessRef f = FileAccess::open(p_source_file,FileAccess::READ); + ERR_FAIL_COND_V(!f,ERR_CANT_OPEN); + + Ref<Mesh> mesh = Ref<Mesh>( memnew( Mesh ) ); + Map<String,Ref<Material> > name_map; + + + + bool generate_normals=p_options["generate/normals"]; + bool generate_tangents=p_options["generate/tangents"]; + bool flip_faces=p_options["force/flip_faces"]; + bool force_smooth=p_options["force/smooth_shading"]; + bool weld_vertices=p_options["force/weld_vertices"]; + float weld_tolerance=p_options["force/weld_tolerance"]; + Vector<Vector3> vertices; + Vector<Vector3> normals; + Vector<Vector2> uvs; + String name; + + Ref<SurfaceTool> surf_tool = memnew( SurfaceTool) ; + surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES); + if (force_smooth) + surf_tool->add_smooth_group(true); + int has_index_data=false; + + while(true) { + + + String l = f->get_line().strip_edges(); + + if (l.begins_with("v ")) { + //vertex + Vector<String> v = l.split(" ",false); + ERR_FAIL_COND_V(v.size()<4,ERR_INVALID_DATA); + Vector3 vtx; + vtx.x=v[1].to_float(); + vtx.y=v[2].to_float(); + vtx.z=v[3].to_float(); + vertices.push_back(vtx); + } else if (l.begins_with("vt ")) { + //uv + Vector<String> v = l.split(" ",false); + ERR_FAIL_COND_V(v.size()<3,ERR_INVALID_DATA); + Vector2 uv; + uv.x=v[1].to_float(); + uv.y=1.0-v[2].to_float(); + uvs.push_back(uv); + + } else if (l.begins_with("vn ")) { + //normal + Vector<String> v = l.split(" ",false); + ERR_FAIL_COND_V(v.size()<4,ERR_INVALID_DATA); + Vector3 nrm; + nrm.x=v[1].to_float(); + nrm.y=v[2].to_float(); + nrm.z=v[3].to_float(); + normals.push_back(nrm); + } if (l.begins_with("f ")) { + //vertex + + has_index_data=true; + Vector<String> v = l.split(" ",false); + ERR_FAIL_COND_V(v.size()<4,ERR_INVALID_DATA); + + //not very fast, could be sped up + + + Vector<String> face[3]; + face[0] = v[1].split("/"); + face[1] = v[2].split("/"); + ERR_FAIL_COND_V(face[0].size()==0,ERR_PARSE_ERROR); + ERR_FAIL_COND_V(face[0].size()!=face[1].size(),ERR_PARSE_ERROR); + for(int i=2;i<v.size()-1;i++) { + + face[2] = v[i+1].split("/"); + ERR_FAIL_COND_V(face[0].size()!=face[2].size(),ERR_PARSE_ERROR); + for(int j=0;j<3;j++) { + + int idx=j; + + if (!flip_faces && idx<2) { + idx=1^idx; + } + + + if (face[idx].size()==3) { + int norm = face[idx][2].to_int()-1; + ERR_FAIL_INDEX_V(norm,normals.size(),ERR_PARSE_ERROR); + surf_tool->add_normal(normals[norm]); + } + + if (face[idx].size()>=2 && face[idx][1]!=String()) { + + int uv = face[idx][1].to_int()-1; + ERR_FAIL_INDEX_V(uv,uvs.size(),ERR_PARSE_ERROR); + surf_tool->add_uv(uvs[uv]); + } + + int vtx = face[idx][0].to_int()-1; + ERR_FAIL_INDEX_V(vtx,vertices.size(),ERR_PARSE_ERROR); + + Vector3 vertex = vertices[vtx]; + if (weld_vertices) + vertex=vertex.snapped(weld_tolerance); + surf_tool->add_vertex(vertex); + } + + face[1]=face[2]; + } + } else if (l.begins_with("s ") && !force_smooth) { //smoothing + String what = l.substr(2,l.length()).strip_edges(); + if (what=="off") + surf_tool->add_smooth_group(false); + else + surf_tool->add_smooth_group(true); + + } else if (l.begins_with("o ") || f->eof_reached()) { //new surface or done + + if (has_index_data) { + //new object/surface + if (generate_normals || force_smooth) + surf_tool->generate_normals(); + if (uvs.size() && (normals.size() || generate_normals) && generate_tangents) + surf_tool->generate_tangents(); + + surf_tool->index(); + mesh = surf_tool->commit(mesh); + if (name=="") + name=vformat(TTR("Surface %d"),mesh->get_surface_count()-1); + mesh->surface_set_name(mesh->get_surface_count()-1,name); + name=""; + surf_tool->clear(); + surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES); + if (force_smooth) + surf_tool->add_smooth_group(true); + + has_index_data=false; + + if (f->eof_reached()) + break; + } + + if (l.begins_with("o ")) //name + name=l.substr(2,l.length()).strip_edges(); + } + } + +/* + TODO, check existing materials and merge? + //re-apply materials if exist + for(int i=0;i<mesh->get_surface_count();i++) { + + String n = mesh->surface_get_name(i); + if (name_map.has(n)) + mesh->surface_set_material(i,name_map[n]); + } +*/ + + Error err = ResourceSaver::save(p_save_path+".msh",mesh); + + return err; + +} + +ResourceImporterOBJ::ResourceImporterOBJ() +{ + +} diff --git a/tools/editor/import/resource_importer_obj.h b/tools/editor/import/resource_importer_obj.h new file mode 100644 index 0000000000..d2a3c4fddd --- /dev/null +++ b/tools/editor/import/resource_importer_obj.h @@ -0,0 +1,28 @@ +#ifndef RESOURCEIMPORTEROBJ_H +#define RESOURCEIMPORTEROBJ_H + + +#include "io/resource_import.h" + +class ResourceImporterOBJ : public ResourceImporter { + GDCLASS(ResourceImporterOBJ,ResourceImporter) +public: + 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 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); + + ResourceImporterOBJ(); +}; + + +#endif // RESOURCEIMPORTEROBJ_H diff --git a/tools/editor/import/resource_importer_scene.cpp b/tools/editor/import/resource_importer_scene.cpp new file mode 100644 index 0000000000..ae840e9e16 --- /dev/null +++ b/tools/editor/import/resource_importer_scene.cpp @@ -0,0 +1,1328 @@ +#include "resource_importer_scene.h" + +#include "scene/resources/packed_scene.h" +#include "io/resource_saver.h" +#include "tools/editor/editor_node.h" + +#include "scene/3d/mesh_instance.h" +#include "scene/3d/navigation.h" +#include "scene/3d/room_instance.h" +#include "scene/3d/body_shape.h" +#include "scene/3d/physics_body.h" +#include "scene/3d/portal.h" +#include "scene/3d/vehicle_body.h" +#include "scene/resources/sphere_shape.h" +#include "scene/resources/box_shape.h" +#include "scene/resources/ray_shape.h" +#include "scene/resources/plane_shape.h" + + +void EditorScenePostImport::_bind_methods() { + + BIND_VMETHOD( MethodInfo("post_import",PropertyInfo(Variant::OBJECT,"scene")) ); + +} + +Node *EditorScenePostImport::post_import(Node* p_scene) { + + if (get_script_instance()) + return get_script_instance()->call("post_import",p_scene); + + return p_scene; +} + +EditorScenePostImport::EditorScenePostImport() { + + +} + + +String ResourceImporterScene::get_importer_name() const { + + return "scene"; +} + +String ResourceImporterScene::get_visible_name() const{ + + return "Scene"; +} + +void ResourceImporterScene::get_recognized_extensions(List<String> *p_extensions) const{ + + for (Set< Ref<EditorSceneImporter> >::Element *E=importers.front();E;E=E->next()) { + E->get()->get_extensions(p_extensions); + } +} + +String ResourceImporterScene::get_save_extension() const { + return "scn"; +} + +String ResourceImporterScene::get_resource_type() const{ + + return "PackedScene"; +} + +bool ResourceImporterScene::get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const { + + if (p_option.begins_with("animation/")) { + if (p_option!="animation/import" && !bool(p_options["animation/import"])) + return false; + + if (p_option.begins_with("animation/optimizer/") && p_option!="animation/optimizer/enabled" && !bool(p_options["animation/optimizer/enabled"])) + return false; + + if (p_option.begins_with("animation/clip_")) { + int max_clip = p_options["animation/clips/amount"]; + int clip = p_option.get_slice("/",1).get_slice("_",1).to_int()-1; + if (clip>=max_clip) + return false; + } + } + + return true; + +} + +int ResourceImporterScene::get_preset_count() const { + return 0; +} +String ResourceImporterScene::get_preset_name(int p_idx) const { + + return ""; +} + + +static bool _teststr(const String& p_what,const String& p_str) { + + if (p_what.findn("$"+p_str)!=-1) //blender and other stuff + return true; + if (p_what.to_lower().ends_with("-"+p_str)) //collada only supports "_" and "-" besides letters + return true; + if (p_what.to_lower().ends_with("_"+p_str)) //collada only supports "_" and "-" besides letters + return true; + return false; +} + +static String _fixstr(const String& p_what,const String& p_str) { + + if (p_what.findn("$"+p_str)!=-1) //blender and other stuff + return p_what.replace("$"+p_str,""); + if (p_what.to_lower().ends_with("-"+p_str)) //collada only supports "_" and "-" besides letters + return p_what.substr(0,p_what.length()-(p_str.length()+1)); + if (p_what.to_lower().ends_with("_"+p_str)) //collada only supports "_" and "-" besides letters + return p_what.substr(0,p_what.length()-(p_str.length()+1)); + return p_what; +} + + +Node* ResourceImporterScene::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>,Ref<Shape> > &collision_map) { + + // children first.. + for(int i=0;i<p_node->get_child_count();i++) { + + + Node *r = _fix_node(p_node->get_child(i),p_root,collision_map); + if (!r) { + print_line("was erased.."); + i--; //was erased + } + } + + String name = p_node->get_name(); + + bool isroot = p_node==p_root; + + + if (!isroot && _teststr(name,"noimp")) { + + memdelete(p_node); + return NULL; + } + + + if (p_node->cast_to<MeshInstance>()) { + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + bool bb=false; + + if ((_teststr(name,"bb"))) { + bb=true; + } else if (mi->get_mesh().is_valid() && (_teststr(mi->get_mesh()->get_name(),"bb"))) { + bb=true; + + } + + if (bb) { + mi->set_flag(GeometryInstance::FLAG_BILLBOARD,true); + if (mi->get_mesh().is_valid()) { + + Ref<Mesh> m = mi->get_mesh(); + for(int i=0;i<m->get_surface_count();i++) { + + Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); + if (fm.is_valid()) { + //fm->set_flag(Material::FLAG_UNSHADED,true); + //fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + //fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + //fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + } + } + } + } + } + + + if (p_node->cast_to<MeshInstance>()) { + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + Ref<Mesh> m = mi->get_mesh(); + + if (m.is_valid()) { + + for(int i=0;i<m->get_surface_count();i++) { + + Ref<FixedSpatialMaterial> mat = m->surface_get_material(i); + if (!mat.is_valid()) + continue; + + if (_teststr(mat->get_name(),"alpha")) { + + mat->set_feature(FixedSpatialMaterial::FEATURE_TRANSPARENT,true); + mat->set_name(_fixstr(mat->get_name(),"alpha")); + } + if (_teststr(mat->get_name(),"vcol")) { + + mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); + mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); + mat->set_name(_fixstr(mat->get_name(),"vcol")); + } + + } + } + } + + if (p_node->cast_to<AnimationPlayer>()) { + //remove animations referencing non-importable nodes + AnimationPlayer *ap = p_node->cast_to<AnimationPlayer>(); + + List<StringName> anims; + ap->get_animation_list(&anims); + for(List<StringName>::Element *E=anims.front();E;E=E->next()) { + + Ref<Animation> anim=ap->get_animation(E->get()); + ERR_CONTINUE(anim.is_null()); + for(int i=0;i<anim->get_track_count();i++) { + NodePath path = anim->track_get_path(i); + + for(int j=0;j<path.get_name_count();j++) { + String node = path.get_name(j); + if (_teststr(node,"noimp")) { + anim->remove_track(i); + i--; + break; + } + } + } + + } + } + + + if (p_node->cast_to<MeshInstance>()) { + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + String str; + + if ((_teststr(name,"imp"))) { + str=name; + } else if (mi->get_mesh().is_valid() && (_teststr(mi->get_mesh()->get_name(),"imp"))) { + str=mi->get_mesh()->get_name(); + + } + + + if (p_node->get_parent() && p_node->get_parent()->cast_to<MeshInstance>()) { + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + MeshInstance *mip = p_node->get_parent()->cast_to<MeshInstance>(); + String d=str.substr(str.find("imp")+3,str.length()); + if (d!="") { + if ((d[0]<'0' || d[0]>'9')) + d=d.substr(1,d.length()); + if (d.length() && d[0]>='0' && d[0]<='9') { + float dist = d.to_double(); + mi->set_flag(GeometryInstance::FLAG_BILLBOARD,true); + mi->set_flag(GeometryInstance::FLAG_BILLBOARD_FIX_Y,true); + //mi->set_draw_range_begin(dist); + //mi->set_draw_range_end(100000); + + //mip->set_draw_range_begin(0); + //mip->set_draw_range_end(dist); + + if (mi->get_mesh().is_valid()) { + + Ref<Mesh> m = mi->get_mesh(); + for(int i=0;i<m->get_surface_count();i++) { + + Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); + if (fm.is_valid()) { + //fm->set_flag(Material::FLAG_UNSHADED,true); + //fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + //fm->set_depth_draw_mode(Material::DEPTH_DRAW_NEVER); + //fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + } + } + } + } + } + } + } +#if 0 + if (p_flags&SCENE_FLAG_CREATE_LODS && p_node->cast_to<MeshInstance>()) { + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + String str; + + if ((_teststr(name,"lod"))) { + str=name; + } else if (mi->get_mesh().is_valid() && (_teststr(mi->get_mesh()->get_name(),"lod"))) { + str=mi->get_mesh()->get_name(); + + } + + + if (p_node->get_parent() && p_node->get_parent()->cast_to<MeshInstance>()) { + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + MeshInstance *mip = p_node->get_parent()->cast_to<MeshInstance>(); + String d=str.substr(str.find("lod")+3,str.length()); + if (d!="") { + if ((d[0]<'0' || d[0]>'9')) + d=d.substr(1,d.length()); + if (d.length() && d[0]>='0' && d[0]<='9') { + float dist = d.to_double(); + /// mi->set_draw_range_begin(dist); + // mi->set_draw_range_end(100000); + + // mip->set_draw_range_begin(0); + // mip->set_draw_range_end(dist); + + /*if (mi->get_mesh().is_valid()) { + + Ref<Mesh> m = mi->get_mesh(); + for(int i=0;i<m->get_surface_count();i++) { + + Ref<FixedSpatialMaterial> fm = m->surface_get_material(i); + if (fm.is_valid()) { + fm->set_flag(Material::FLAG_UNSHADED,true); + fm->set_flag(Material::FLAG_DOUBLE_SIDED,true); + fm->set_hint(Material::HINT_NO_DEPTH_DRAW,true); + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + } + } + }*/ + } + } + } + } + + + if (p_flags&SCENE_FLAG_DETECT_LIGHTMAP_LAYER && _teststr(name,"lm") && p_node->cast_to<MeshInstance>()) { + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + String str=name; + int layer = str.substr(str.find("lm")+3,str.length()).to_int(); + //mi->set_baked_light_texture_id(layer); + } +#endif + if (_teststr(name,"colonly")) { + + if (isroot) + return p_node; + + if (p_node->cast_to<MeshInstance>()) { + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + Node * col = mi->create_trimesh_collision_node(); + ERR_FAIL_COND_V(!col,NULL); + + col->set_name(_fixstr(name,"colonly")); + col->cast_to<Spatial>()->set_transform(mi->get_transform()); + p_node->replace_by(col); + memdelete(p_node); + p_node=col; + + StaticBody *sb = col->cast_to<StaticBody>(); + CollisionShape *colshape = memnew( CollisionShape); + colshape->set_shape(sb->get_shape(0)); + colshape->set_name("shape"); + sb->add_child(colshape); + colshape->set_owner(p_node->get_owner()); + } else if (p_node->has_meta("empty_draw_type")) { + String empty_draw_type = String(p_node->get_meta("empty_draw_type")); + print_line(empty_draw_type); + StaticBody *sb = memnew( StaticBody); + sb->set_name(_fixstr(name,"colonly")); + sb->cast_to<Spatial>()->set_transform(p_node->cast_to<Spatial>()->get_transform()); + p_node->replace_by(sb); + memdelete(p_node); + CollisionShape *colshape = memnew( CollisionShape); + if (empty_draw_type == "CUBE") { + BoxShape *boxShape = memnew( BoxShape); + boxShape->set_extents(Vector3(1, 1, 1)); + colshape->set_shape(boxShape); + colshape->set_name("BoxShape"); + } else if (empty_draw_type == "SINGLE_ARROW") { + RayShape *rayShape = memnew( RayShape); + rayShape->set_length(1); + colshape->set_shape(rayShape); + colshape->set_name("RayShape"); + sb->cast_to<Spatial>()->rotate_x(Math_PI / 2); + } else if (empty_draw_type == "IMAGE") { + PlaneShape *planeShape = memnew( PlaneShape); + colshape->set_shape(planeShape); + colshape->set_name("PlaneShape"); + } else { + SphereShape *sphereShape = memnew( SphereShape); + sphereShape->set_radius(1); + colshape->set_shape(sphereShape); + colshape->set_name("SphereShape"); + } + sb->add_child(colshape); + colshape->set_owner(sb->get_owner()); + } + + } else if (_teststr(name,"rigid") && p_node->cast_to<MeshInstance>()) { + + if (isroot) + return p_node; + + // get mesh instance and bounding box + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + Rect3 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 + col->cast_to<Spatial>()->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 + mesh->cast_to<Spatial>()->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 = col->cast_to<RigidBody>(); + // 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()); + + } else if (_teststr(name,"col") && p_node->cast_to<MeshInstance>()) { + + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + mi->set_name(_fixstr(name,"col")); + Node *col= mi->create_trimesh_collision_node(); + ERR_FAIL_COND_V(!col,NULL); + + col->set_name("col"); + p_node->add_child(col); + + StaticBody *sb=col->cast_to<StaticBody>(); + CollisionShape *colshape = memnew( CollisionShape); + colshape->set_shape(sb->get_shape(0)); + colshape->set_name("shape"); + col->add_child(colshape); + colshape->set_owner(p_node->get_owner()); + sb->set_owner(p_node->get_owner()); + + } else if (_teststr(name,"navmesh") && p_node->cast_to<MeshInstance>()) { + + if (isroot) + return p_node; + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + Ref<Mesh> mesh=mi->get_mesh(); + ERR_FAIL_COND_V(mesh.is_null(),NULL); + NavigationMeshInstance *nmi = memnew( NavigationMeshInstance ); + + + nmi->set_name(_fixstr(name,"navmesh")); + Ref<NavigationMesh> nmesh = memnew( NavigationMesh); + nmesh->create_from_mesh(mesh); + nmi->set_navigation_mesh(nmesh); + nmi->cast_to<Spatial>()->set_transform(mi->get_transform()); + p_node->replace_by(nmi); + memdelete(p_node); + p_node=nmi; + } else if (_teststr(name,"vehicle")) { + + if (isroot) + return p_node; + + Node *owner = p_node->get_owner(); + Spatial *s = p_node->cast_to<Spatial>(); + VehicleBody *bv = memnew( VehicleBody ); + String n = _fixstr(p_node->get_name(),"vehicle"); + bv->set_name(n); + p_node->replace_by(bv); + p_node->set_name(n); + bv->add_child(p_node); + bv->set_owner(owner); + p_node->set_owner(owner); + bv->set_transform(s->get_transform()); + s->set_transform(Transform()); + + p_node=bv; + + + } else if (_teststr(name,"wheel")) { + + if (isroot) + return p_node; + + Node *owner = p_node->get_owner(); + Spatial *s = p_node->cast_to<Spatial>(); + VehicleWheel *bv = memnew( VehicleWheel ); + String n = _fixstr(p_node->get_name(),"wheel"); + bv->set_name(n); + p_node->replace_by(bv); + p_node->set_name(n); + bv->add_child(p_node); + bv->set_owner(owner); + p_node->set_owner(owner); + bv->set_transform(s->get_transform()); + s->set_transform(Transform()); + + p_node=bv; + + } else if (_teststr(name,"room") && p_node->cast_to<MeshInstance>()) { + + + if (isroot) + return p_node; + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); + + + BSP_Tree bsptree(faces); + + Ref<RoomBounds> area = memnew( RoomBounds ); + //area->set_bounds(faces); + //area->set_geometry_hint(faces); + + + Room * room = memnew( Room ); + room->set_name(_fixstr(name,"room")); + room->set_transform(mi->get_transform()); + room->set_room(area); + + p_node->replace_by(room); + memdelete(p_node); + p_node=room; + + } else if (_teststr(name,"room")) { + + if (isroot) + return p_node; + + Spatial *dummy = p_node->cast_to<Spatial>(); + ERR_FAIL_COND_V(!dummy,NULL); + + Room * room = memnew( Room ); + room->set_name(_fixstr(name,"room")); + room->set_transform(dummy->get_transform()); + + p_node->replace_by(room); + memdelete(p_node); + p_node=room; + + //room->compute_room_from_subtree(); + + } else if (_teststr(name,"portal") && p_node->cast_to<MeshInstance>()) { + + if (isroot) + return p_node; + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + PoolVector<Face3> faces = mi->get_faces(VisualInstance::FACES_SOLID); + + ERR_FAIL_COND_V(faces.size()==0,NULL); + //step 1 compute the plane + Set<Vector3> points; + Plane plane; + + Vector3 center; + + for(int i=0;i<faces.size();i++) { + + Face3 f = faces.get(i); + Plane p = f.get_plane(); + plane.normal+=p.normal; + plane.d+=p.d; + + for(int i=0;i<3;i++) { + + Vector3 v = f.vertex[i].snapped(0.01); + if (!points.has(v)) { + points.insert(v); + center+=v; + } + } + } + + plane.normal.normalize(); + plane.d/=faces.size(); + center/=points.size(); + + //step 2, create points + + Transform t; + t.basis.from_z(plane.normal); + t.basis.transpose(); + t.origin=center; + + Vector<Point2> portal_points; + + for(Set<Vector3>::Element *E=points.front();E;E=E->next()) { + + Vector3 local = t.xform_inv(E->get()); + portal_points.push_back(Point2(local.x,local.y)); + } + // step 3 bubbly sort points + + int swaps=0; + + do { + swaps=0; + + for(int i=0;i<portal_points.size()-1;i++) { + + float a = portal_points[i].angle(); + float b = portal_points[i+1].angle(); + + if (a>b) { + SWAP( portal_points[i], portal_points[i+1] ); + swaps++; + } + + } + + } while(swaps); + + + Portal *portal = memnew( Portal ); + + portal->set_shape(portal_points); + portal->set_transform( mi->get_transform() * t); + + p_node->replace_by(portal); + memdelete(p_node); + p_node=portal; + + } else if (p_node->cast_to<MeshInstance>()) { + + //last attempt, maybe collision insde the mesh data + + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + + Ref<Mesh> mesh = mi->get_mesh(); + if (!mesh.is_null()) { + + if (_teststr(mesh->get_name(),"col")) { + + mesh->set_name( _fixstr(mesh->get_name(),"col") ); + Ref<Shape> shape; + + if (collision_map.has(mesh)) { + shape = collision_map[mesh]; + + } else { + + shape = mesh->create_trimesh_shape(); + if (!shape.is_null()) + collision_map[mesh]=shape; + + + } + + if (!shape.is_null()) { +#if 0 + StaticBody* static_body = memnew( StaticBody ); + ERR_FAIL_COND_V(!static_body,NULL); + static_body->set_name( String(mesh->get_name()) + "_col" ); + shape->set_name(static_body->get_name()); + static_body->add_shape(shape); + + mi->add_child(static_body); + if (mi->get_owner()) + static_body->set_owner( mi->get_owner() ); +#endif + } + + } + + for(int i=0;i<mesh->get_surface_count();i++) { + + Ref<FixedSpatialMaterial> fm = mesh->surface_get_material(i); + if (fm.is_valid()) { + String name = fm->get_name(); + /* if (_teststr(name,"alpha")) { + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_ALPHA,true); + name=_fixstr(name,"alpha"); + } + + if (_teststr(name,"vcol")) { + fm->set_fixed_flag(FixedSpatialMaterial::FLAG_USE_COLOR_ARRAY,true); + name=_fixstr(name,"vcol"); + }*/ + fm->set_name(name); + } + } + + } + + } + + + return p_node; +} + + +void ResourceImporterScene::_create_clips(Node *scene, const Array& p_clips,bool p_bake_all) { + + if (!scene->has_node(String("AnimationPlayer"))) + return; + + Node* n = scene->get_node(String("AnimationPlayer")); + ERR_FAIL_COND(!n); + AnimationPlayer *anim = n->cast_to<AnimationPlayer>(); + ERR_FAIL_COND(!anim); + + if (!anim->has_animation("default")) + return; + + + Ref<Animation> default_anim = anim->get_animation("default"); + + for(int i=0;i<p_clips.size();i+=4) { + + String name = p_clips[i]; + float from=p_clips[i+1]; + float to=p_clips[i+2]; + bool loop=p_clips[i+3]; + if (from>=to) + continue; + + Ref<Animation> new_anim = memnew( Animation ); + + for(int j=0;j<default_anim->get_track_count();j++) { + + + List<float> keys; + int kc = default_anim->track_get_key_count(j); + int dtrack=-1; + for(int k=0;k<kc;k++) { + + float kt = default_anim->track_get_key_time(j,k); + if (kt>=from && kt<to) { + + //found a key within range, so create track + if (dtrack==-1) { + new_anim->add_track(default_anim->track_get_type(j)); + dtrack = new_anim->get_track_count()-1; + new_anim->track_set_path(dtrack,default_anim->track_get_path(j)); + + if (kt>(from+0.01) && k>0) { + + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + Quat q; + Vector3 p; + Vector3 s; + 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_TRANSFORM) { + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_get_key(j,k,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,kt-from,p,q,s); + } + + } + + if (dtrack!=-1 && kt>=to) { + + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_interpolate(j,to,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,to-from,p,q,s); + } + } + + } + + if (dtrack==-1 && p_bake_all) { + new_anim->add_track(default_anim->track_get_type(j)); + dtrack = new_anim->get_track_count()-1; + new_anim->track_set_path(dtrack,default_anim->track_get_path(j)); + if (default_anim->track_get_type(j)==Animation::TYPE_TRANSFORM) { + + + Quat q; + Vector3 p; + Vector3 s; + default_anim->transform_track_interpolate(j,from,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,0,p,q,s); + default_anim->transform_track_interpolate(j,to,&p,&q,&s); + new_anim->transform_track_insert_key(dtrack,to-from,p,q,s); + } + + } + } + + + new_anim->set_loop(loop); + new_anim->set_length(to-from); + anim->add_animation(name,new_anim); + } + + anim->remove_animation("default"); //remove default (no longer needed) +} + +void ResourceImporterScene::_filter_anim_tracks(Ref<Animation> anim,Set<String> &keep) { + + Ref<Animation> a = anim; + ERR_FAIL_COND(!a.is_valid()); + + print_line("From Anim "+anim->get_name()+":"); + + for(int j=0;j<a->get_track_count();j++) { + + String path = a->track_get_path(j); + + if (!keep.has(path)) { + + print_line("Remove: "+path); + a->remove_track(j); + j--; + } + + } +} + + +void ResourceImporterScene::_filter_tracks(Node *scene, const String& p_text) { + + if (!scene->has_node(String("AnimationPlayer"))) + return; + Node* n = scene->get_node(String("AnimationPlayer")); + ERR_FAIL_COND(!n); + AnimationPlayer *anim = n->cast_to<AnimationPlayer>(); + ERR_FAIL_COND(!anim); + + Vector<String> strings = p_text.split("\n"); + for(int i=0;i<strings.size();i++) { + + strings[i]=strings[i].strip_edges(); + } + + List<StringName> anim_names; + anim->get_animation_list(&anim_names); + for(List<StringName>::Element *E=anim_names.front();E;E=E->next()) { + + String name = E->get(); + bool valid_for_this=false; + bool valid=false; + + Set<String> keep; + Set<String> keep_local; + + + for(int i=0;i<strings.size();i++) { + + + if (strings[i].begins_with("@")) { + + valid_for_this=false; + for(Set<String>::Element *F=keep_local.front();F;F=F->next()) { + keep.insert(F->get()); + } + keep_local.clear(); + + Vector<String> filters=strings[i].substr(1,strings[i].length()).split(","); + for(int j=0;j<filters.size();j++) { + + String fname = filters[j].strip_edges(); + if (fname=="") + continue; + int fc = fname[0]; + bool plus; + if (fc=='+') + plus=true; + else if (fc=='-') + plus=false; + else + continue; + + String filter=fname.substr(1,fname.length()).strip_edges(); + + if (!name.matchn(filter)) + continue; + valid_for_this=plus; + } + + if (valid_for_this) + valid=true; + + } else if (valid_for_this) { + + Ref<Animation> a = anim->get_animation(name); + if (!a.is_valid()) + continue; + + for(int j=0;j<a->get_track_count();j++) { + + String path = a->track_get_path(j); + + String tname = strings[i]; + if (tname=="") + continue; + int fc = tname[0]; + bool plus; + if (fc=='+') + plus=true; + else if (fc=='-') + plus=false; + else + continue; + + String filter=tname.substr(1,tname.length()).strip_edges(); + + if (!path.matchn(filter)) + continue; + + if (plus) + keep_local.insert(path); + else if (!keep.has(path)) { + keep_local.erase(path); + } + } + + } + + } + + if (valid) { + for(Set<String>::Element *F=keep_local.front();F;F=F->next()) { + keep.insert(F->get()); + } + _filter_anim_tracks(anim->get_animation(name),keep); + } else { + + } + + } + + + +} + +void ResourceImporterScene::_optimize_animations(Node *scene, float p_max_lin_error,float p_max_ang_error,float p_max_angle) { + + if (!scene->has_node(String("AnimationPlayer"))) + return; + Node* n = scene->get_node(String("AnimationPlayer")); + ERR_FAIL_COND(!n); + AnimationPlayer *anim = n->cast_to<AnimationPlayer>(); + ERR_FAIL_COND(!anim); + + + List<StringName> anim_names; + anim->get_animation_list(&anim_names); + for(List<StringName>::Element *E=anim_names.front();E;E=E->next()) { + + Ref<Animation> a = anim->get_animation(E->get()); + a->optimize(p_max_lin_error,p_max_ang_error,Math::deg2rad(p_max_angle)); + } +} + + +static String _make_extname(const String& p_str) { + + String ext_name=p_str.replace(".","_"); + ext_name=ext_name.replace(":","_"); + ext_name=ext_name.replace("\"","_"); + ext_name=ext_name.replace("<","_"); + ext_name=ext_name.replace(">","_"); + ext_name=ext_name.replace("/","_"); + ext_name=ext_name.replace("|","_"); + ext_name=ext_name.replace("\\","_"); + ext_name=ext_name.replace("?","_"); + ext_name=ext_name.replace("*","_"); + + return ext_name; +} + +void ResourceImporterScene::_make_external_resources(Node* p_node,const String& p_base_path, bool p_make_materials, bool p_make_meshes, Map<Ref<Material>,Ref<Material> >& p_materials, Map<Ref<Mesh>,Ref<Mesh> >& p_meshes) { + + List<PropertyInfo> pi; + + p_node->get_property_list(&pi); + + for (List<PropertyInfo>::Element *E=pi.front();E;E=E->next()) { + + if (E->get().type==Variant::OBJECT) { + + Ref<Material> mat = p_node->get(E->get().name); + if (p_make_materials && mat.is_valid() && mat->get_name()!="") { + + + if (!p_materials.has(mat)) { + + String ext_name = p_base_path+"."+_make_extname(mat->get_name())+".mtl"; + if (FileAccess::exists(ext_name)) { + //if exists, use it + Ref<Material> existing = ResourceLoader::load(ext_name); + p_materials[mat]=existing; + } else { + + ResourceSaver::save(ext_name,mat,ResourceSaver::FLAG_CHANGE_PATH); + p_materials[mat]=mat; + } + } + + if (p_materials[mat]!=mat) { + + p_node->set(E->get().name,p_materials[mat]); + } + } else { + + Ref<Mesh> mesh = p_node->get(E->get().name); + + if (mesh.is_valid()) { + + bool mesh_just_added=false; + + if (p_make_meshes) { + + if (!p_meshes.has(mesh)) { + + String ext_name = p_base_path+"."+_make_extname(mesh->get_name())+".msh"; + if (FileAccess::exists(ext_name)) { + //if exists, use it + Ref<Mesh> existing = ResourceLoader::load(ext_name); + p_meshes[mesh]=existing; + } else { + + ResourceSaver::save(ext_name,mesh,ResourceSaver::FLAG_CHANGE_PATH); + p_meshes[mesh]=mesh; + mesh_just_added=true; + } + + + } + } + + + if (p_make_materials){ + + if (mesh_just_added || !p_meshes.has(mesh)) { + + + for(int i=0;i<mesh->get_surface_count();i++) { + mat=mesh->surface_get_material(i); + if (!mat.is_valid() || mat->get_name()=="") + continue; + + if (!p_materials.has(mat)) { + + String ext_name = p_base_path+"."+_make_extname(mat->get_name())+".mtl"; + if (FileAccess::exists(ext_name)) { + //if exists, use it + Ref<Material> existing = ResourceLoader::load(ext_name); + p_materials[mat]=existing; + } else { + + ResourceSaver::save(ext_name,mat,ResourceSaver::FLAG_CHANGE_PATH); + p_materials[mat]=mat; + } + } + + if (p_materials[mat]!=mat) { + + mesh->surface_set_material(i,p_materials[mat]); + } + + } + + if(!p_make_meshes) { + p_meshes[mesh]=Ref<Mesh>(); //save it anyway, so it won't be checked again + } + } + } + } + } + } + } + + for(int i=0;i<p_node->get_child_count();i++) { + + _make_external_resources(p_node->get_child(i),p_base_path,p_make_materials,p_make_meshes,p_materials,p_meshes); + } +} + + +void ResourceImporterScene::get_import_options(List<ImportOption> *r_options,int p_preset) const { + + + r_options->push_back(ImportOption(PropertyInfo(Variant::STRING,"nodes/root_type",PROPERTY_HINT_TYPE_STRING,"Node"),"Spatial")); + r_options->push_back(ImportOption(PropertyInfo(Variant::STRING,"nodes/root_name"),"Scene Root")); + + List<String> script_extentions; + ResourceLoader::get_recognized_extensions_for_type("Script",&script_extentions); + + String script_ext_hint; + + for(List<String>::Element *E=script_extentions.front();E;E=E->next()) { + if (script_ext_hint!="") + script_ext_hint+=","; + script_ext_hint+="*."+E->get(); + } + + r_options->push_back(ImportOption(PropertyInfo(Variant::STRING,"nodes/custom_script",PROPERTY_HINT_FILE,script_ext_hint),"")); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"materials/location",PROPERTY_HINT_ENUM,"Node,Mesh"),0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"materials/storage",PROPERTY_HINT_ENUM,"Bult-In,Files"),0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"geometry/compress"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"geometry/ensure_tangents"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"geometry/storage",PROPERTY_HINT_ENUM,"Built-In,Files"),0)); + 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::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)); + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL,"animation/optimizer/max_angular_error"),0.01)); + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL,"animation/optimizer/max_angle"),22)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"animation/optimizer/remove_unused_tracks"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"animation/clips/amount",PROPERTY_HINT_RANGE,"0,256,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED),0)); + for(int i=0;i<256;i++) { + r_options->push_back(ImportOption(PropertyInfo(Variant::STRING,"animation/clip_"+itos(i+1)+"/name"),"")); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"animation/clip_"+itos(i+1)+"/start_frame"),0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"animation/clip_"+itos(i+1)+"/end_frame"),0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"animation/clip_"+itos(i+1)+"/loops"),false)); + } +} + +Error ResourceImporterScene::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) { + + String src_path=p_source_file; + + Ref<EditorSceneImporter> importer; + String ext=src_path.get_extension().to_lower(); + + + EditorProgress progress("import",TTR("Import Scene"),104); + progress.step(TTR("Importing Scene.."),0); + + for(Set< Ref<EditorSceneImporter> >::Element *E=importers.front();E;E=E->next()) { + + List<String> extensions; + E->get()->get_extensions(&extensions); + + for(List<String>::Element *F=extensions.front();F;F=F->next()) { + + if (F->get().to_lower()==ext) { + + importer = E->get(); + break; + } + } + + if (importer.is_valid()) + break; + } + + ERR_FAIL_COND_V(!importer.is_valid(),ERR_FILE_UNRECOGNIZED); + + float fps=p_options["animation/fps"]; + + + + int import_flags=EditorSceneImporter::IMPORT_ANIMATION_DETECT_LOOP; + if (!bool(p_options["animation/optimizer/remove_unused_tracks"])) + import_flags|=EditorSceneImporter::IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS; + + if (bool(p_options["animation/import"])) + import_flags|=EditorSceneImporter::IMPORT_ANIMATION; + + if (bool(p_options["geometry/ensure_tangents"])) + import_flags|=EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS; + + if (int(p_options["materials/location"])==0) + import_flags|=EditorSceneImporter::IMPORT_MATERIALS_IN_INSTANCES; + + + Error err=OK; + List<String> missing_deps; // for now, not much will be done with this + Node *scene = importer->import_scene(src_path,import_flags,fps,&missing_deps,&err); + if (!scene || err!=OK) { + return err; + } + + String root_type = p_options["nodes/root_type"]; + + if (scene->get_class()!=root_type) { + Object *base = ClassDB::instance(root_type); + Node *base_node = NULL; + if (base) + base_node=base->cast_to<Node>(); + + if (base_node) { + + scene->replace_by(base_node); + memdelete(scene); + scene=base_node; + } + } + + scene->set_name(p_options["nodes/root_name"]); + + + err=OK; + + String animation_filter = String(p_options["animation/filter_script"]).strip_edges(); + + bool use_optimizer = p_options["animation/optimizer/enabled"]; + float anim_optimizer_linerr=p_options["animation/optimizer/max_linear_error"]; + float anim_optimizer_angerr=p_options["animation/optimizer/max_angular_error"]; + float anim_optimizer_maxang=p_options["animation/optimizer/max_angle"]; + + Map<Ref<Mesh>,Ref<Shape> > collision_map; + + scene=_fix_node(scene,scene,collision_map); + + if (use_optimizer) { + _optimize_animations(scene,anim_optimizer_linerr,anim_optimizer_angerr,anim_optimizer_maxang); + } + + Array animation_clips; + { + + + int clip_count = p_options["animation/clips/amount"]; + + for(int i=0;i<clip_count;i++) { + String name = p_options["animation/clip_"+itos(i+1)+"/name"]; + int from_frame = p_options["animation/clip_"+itos(i+1)+"/start_frame"]; + int end_frame = p_options["animation/clip_"+itos(i+1)+"/end_frame"]; + bool loop = p_options["animation/clip_"+itos(i+1)+"/loops"]; + + animation_clips.push_back(name); + animation_clips.push_back(from_frame/fps); + animation_clips.push_back(end_frame/fps); + animation_clips.push_back(loop); + } + + } + if (animation_clips.size()) { + _create_clips(scene,animation_clips,!bool(p_options["animation/optimizer/remove_unused_tracks"])); + } + + if (animation_filter!="") { + _filter_tracks(scene,animation_filter); + } + + + bool external_materials = p_options["materials/storage"]; + bool external_meshes = p_options["geometry/storage"]; + + if (external_materials || external_meshes) { + Map<Ref<Material>, Ref<Material> > mat_map; + Map<Ref<Mesh>, Ref<Mesh> > mesh_map; + _make_external_resources(scene,p_source_file.get_basename(),external_materials,external_meshes,mat_map,mesh_map); + } + + progress.step(TTR("Running Custom Script.."),2); + + String post_import_script_path = p_options["nodes/custom_script"]; + Ref<EditorScenePostImport> post_import_script; + + if (post_import_script_path!="") { + post_import_script_path = post_import_script_path; + Ref<Script> scr = ResourceLoader::load(post_import_script_path); + if (!scr.is_valid()) { + EditorNode::add_io_error(TTR("Couldn't load post-import script:")+" "+post_import_script_path); + } else { + + post_import_script = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) ); + post_import_script->set_script(scr.get_ref_ptr()); + if (!post_import_script->get_script_instance()) { + EditorNode::add_io_error(TTR("Invalid/broken script for post-import (check console):")+" "+post_import_script_path); + post_import_script.unref(); + return ERR_CANT_CREATE; + } + } + } + + + if (post_import_script.is_valid()) { + scene = post_import_script->post_import(scene); + if (!scene) { + EditorNode::add_io_error(TTR("Error running post-import script:")+" "+post_import_script_path); + return err; + } + + + } + + progress.step(TTR("Saving.."),104); + + Ref<PackedScene> packer = memnew( PackedScene ); + packer->pack(scene); + print_line("SAVING TO: "+p_save_path+".scn"); + err = ResourceSaver::save(p_save_path+".scn",packer); //do not take over, let the changed files reload themselves + + memdelete(scene); + + EditorNode::get_singleton()->reload_scene(p_source_file); + + return OK; +} + +ResourceImporterScene *ResourceImporterScene::singleton=NULL; + +ResourceImporterScene::ResourceImporterScene() +{ + singleton=this; +} diff --git a/tools/editor/import/resource_importer_scene.h b/tools/editor/import/resource_importer_scene.h new file mode 100644 index 0000000000..cfa44b160a --- /dev/null +++ b/tools/editor/import/resource_importer_scene.h @@ -0,0 +1,93 @@ +#ifndef RESOURCEIMPORTERSCENE_H +#define RESOURCEIMPORTERSCENE_H + +#include "io/resource_import.h" +#include "scene/resources/animation.h" +#include "scene/resources/shape.h" + +class Material; + +class EditorSceneImporter : public Reference { + + GDCLASS(EditorSceneImporter,Reference ); +public: + + enum ImportFlags { + IMPORT_SCENE=1, + IMPORT_ANIMATION=2, + IMPORT_ANIMATION_DETECT_LOOP=4, + IMPORT_ANIMATION_OPTIMIZE=8, + IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS=16, + IMPORT_ANIMATION_KEEP_VALUE_TRACKS=32, + IMPORT_GENERATE_TANGENT_ARRAYS=256, + IMPORT_FAIL_ON_MISSING_DEPENDENCIES=512, + IMPORT_MATERIALS_IN_INSTANCES=1024 + + }; + + virtual uint32_t get_import_flags() const=0; + virtual void get_extensions(List<String> *r_extensions) const=0; + virtual Node* import_scene(const String& p_path,uint32_t p_flags,int p_bake_fps,List<String> *r_missing_deps,Error* r_err=NULL)=0; + virtual Ref<Animation> import_animation(const String& p_path,uint32_t p_flags)=0; + + + + EditorSceneImporter() {} +}; + +class EditorScenePostImport : public Reference { + + GDCLASS(EditorScenePostImport,Reference ); +protected: + + static void _bind_methods(); +public: + + virtual Node* post_import(Node* p_scene); + EditorScenePostImport(); +}; + + +class ResourceImporterScene : public ResourceImporter { + GDCLASS(ResourceImporterScene,ResourceImporter) + + Set< Ref<EditorSceneImporter> > importers; + + static ResourceImporterScene *singleton; +public: + + static ResourceImporterScene *get_singleton() { return singleton; } + + const Set< Ref<EditorSceneImporter> >& get_importers() const { return importers; } + + void add_importer(Ref<EditorSceneImporter> p_importer) { importers.insert(p_importer); } + + 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; + + void _make_external_resources(Node* p_node,const String& p_base_path, bool p_make_materials, bool p_make_meshes, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<Mesh>, Ref<Mesh> > &p_meshes); + + Node* _fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>,Ref<Shape> > &collision_map); + + void _create_clips(Node *scene, const Array& p_clips,bool p_bake_all); + void _filter_anim_tracks(Ref<Animation> anim,Set<String> &keep); + void _filter_tracks(Node *scene, const String& p_text); + void _optimize_animations(Node *scene, float p_max_lin_error,float p_max_ang_error,float p_max_angle); + + 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); + + ResourceImporterScene(); +}; + + +#endif // RESOURCEIMPORTERSCENE_H diff --git a/tools/editor/import/resource_import_texture.cpp b/tools/editor/import/resource_importer_texture.cpp index 940b932e54..21e434fa11 100644 --- a/tools/editor/import/resource_import_texture.cpp +++ b/tools/editor/import/resource_importer_texture.cpp @@ -1,6 +1,106 @@ -#include "resource_import_texture.h" +#include "resource_importer_texture.h" #include "io/image_loader.h" #include "scene/resources/texture.h" +#include "tools/editor/editor_file_system.h" +#include "io/config_file.h" + + +void ResourceImporterTexture::_texture_reimport_srgb(const Ref<StreamTexture>& p_tex) { + + singleton->mutex->lock(); + StringName path = p_tex->get_path(); + + if (!singleton->make_flags.has(path)) { + singleton->make_flags[path]=0; + } + + singleton->make_flags[path]|=MAKE_SRGB_FLAG; + + print_line("requesting srgb for "+String(path)); + + singleton->mutex->unlock(); + +} + + + +void ResourceImporterTexture::_texture_reimport_3d(const Ref<StreamTexture>& p_tex) { + + + singleton->mutex->lock(); + StringName path = p_tex->get_path(); + + if (!singleton->make_flags.has(path)) { + singleton->make_flags[path]=0; + } + + singleton->make_flags[path]|=MAKE_3D_FLAG; + + print_line("requesting 3d for "+String(path)); + + singleton->mutex->unlock(); + + +} + +void ResourceImporterTexture::update_imports() { + + if (EditorFileSystem::get_singleton()->is_scanning() || EditorFileSystem::get_singleton()->is_importing()) { + return; // do nothing for noe + } + mutex->lock(); + + if (make_flags.empty()) { + mutex->unlock(); + return; + } + + Vector<String> to_reimport; + for (Map<StringName,int>::Element *E=make_flags.front();E;E=E->next()) { + + print_line("checking for reimport "+String(E->key())); + + + Ref<ConfigFile> cf; + cf.instance(); + String src_path = String(E->key())+".import"; + + Error err = cf->load(src_path); + ERR_CONTINUE(err!=OK); + + bool changed=false; + if (E->get()&MAKE_SRGB_FLAG && int(cf->get_value("params","flags/srgb"))==2) { + cf->set_value("params","flags/srgb",1); + changed=true; + } + + if (E->get()&MAKE_3D_FLAG && bool(cf->get_value("params","detect_3d"))) { + cf->set_value("params","detect_3d",false); + cf->set_value("params","compress/mode",2); + cf->set_value("params","flags/repeat",true); + cf->set_value("params","flags/filter",true); + cf->set_value("params","flags/mipmaps",true); + changed=true; + } + + if (changed) { + cf->save(src_path); + to_reimport.push_back(E->key()); + } + + } + + make_flags.clear(); + + mutex->unlock(); + + if (to_reimport.size()) { + EditorFileSystem::get_singleton()->reimport_files(to_reimport); + } + +} + + String ResourceImporterTexture::get_importer_name() const { @@ -57,7 +157,7 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,i r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"flags/filter"),p_preset==PRESET_2D_PIXEL?false:true)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"flags/mipmaps"),p_preset==PRESET_3D?true:false)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"flags/anisotropic"),false)); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"flags/srgb",PROPERTY_HINT_ENUM,"Disable,Enable,Detect"),2)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"flags/srgb",PROPERTY_HINT_ENUM,"Disable,Enable,Detect"),2)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"process/fix_alpha_border"),p_preset!=PRESET_3D?true:false)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"process/premult_alpha"),true)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"stream"),false)); @@ -67,7 +167,7 @@ void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,i } -void ResourceImporterTexture::_save_stex(const Image& p_image,const String& p_to_path,int p_compress_mode,float p_lossy_quality,Image::CompressMode p_vram_compression,bool p_mipmaps,int p_texture_flags,bool p_streamable) { +void ResourceImporterTexture::_save_stex(const Image& p_image, const String& p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable, bool p_detect_3d, bool p_detect_srgb) { FileAccess *f = FileAccess::open(p_to_path,FileAccess::WRITE); @@ -86,6 +186,11 @@ void ResourceImporterTexture::_save_stex(const Image& p_image,const String& p_to format|=StreamTexture::FORMAT_BIT_STREAM; if (p_mipmaps || p_compress_mode==COMPRESS_VIDEO_RAM) //VRAM always uses mipmaps format|=StreamTexture::FORMAT_BIT_HAS_MIPMAPS; //mipmaps bit + if (p_detect_3d) + format|=StreamTexture::FORMAT_BIT_DETECT_3D; + if (p_detect_srgb) + format|=StreamTexture::FORMAT_BIT_DETECT_SRGB; + switch (p_compress_mode) { case COMPRESS_LOSSLESS: { @@ -99,7 +204,7 @@ void ResourceImporterTexture::_save_stex(const Image& p_image,const String& p_to int mmc = image.get_mipmap_count() + 1; - format=StreamTexture::FORMAT_BIT_LOSSLESS; + format|=StreamTexture::FORMAT_BIT_LOSSLESS; f->store_32(format); f->store_32(mmc); @@ -130,7 +235,7 @@ void ResourceImporterTexture::_save_stex(const Image& p_image,const String& p_to int mmc = image.get_mipmap_count() + 1; - format=StreamTexture::FORMAT_BIT_LOSSY; + format|=StreamTexture::FORMAT_BIT_LOSSY; f->store_32(format); f->store_32(mmc); @@ -162,7 +267,6 @@ void ResourceImporterTexture::_save_stex(const Image& p_image,const String& p_to PoolVector<uint8_t> data=image.get_data(); int dl = data.size(); PoolVector<uint8_t>::Read r = data.read(); - f->store_buffer(r.ptr(),dl); } break; @@ -198,7 +302,7 @@ Error ResourceImporterTexture::import(const String& p_source_file, const String& bool filter= p_options["flags/filter"]; bool mipmaps= p_options["flags/mipmaps"]; bool anisotropic= p_options["flags/anisotropic"]; - bool srgb= p_options["flags/srgb"]; + int srgb= p_options["flags/srgb"]; bool fix_alpha_border= p_options["process/fix_alpha_border"]; bool premult_alpha= p_options["process/premult_alpha"]; bool stream = p_options["stream"]; @@ -222,7 +326,7 @@ Error ResourceImporterTexture::import(const String& p_source_file, const String& tex_flags|=Texture::FLAG_MIPMAPS; if (anisotropic) tex_flags|=Texture::FLAG_ANISOTROPIC_FILTER; - if (srgb) + if (srgb==1) tex_flags|=Texture::FLAG_CONVERT_TO_LINEAR; if (size_limit >0 && (image.get_width()>size_limit || image.get_height()>size_limit )) { @@ -249,26 +353,41 @@ Error ResourceImporterTexture::import(const String& p_source_file, const String& image.premultiply_alpha(); } + bool detect_3d = p_options["detect_3d"]; + bool detect_srgb = srgb==2; if (compress_mode==COMPRESS_VIDEO_RAM) { //must import in all formats //Android, GLES 2.x - _save_stex(image,p_save_path+".etc.stex",compress_mode,lossy,Image::COMPRESS_ETC,mipmaps,tex_flags,stream); + _save_stex(image,p_save_path+".etc.stex",compress_mode,lossy,Image::COMPRESS_ETC,mipmaps,tex_flags,stream,detect_3d,detect_srgb); r_platform_variants->push_back("etc"); //_save_stex(image,p_save_path+".etc2.stex",compress_mode,lossy,Image::COMPRESS_ETC2,mipmaps,tex_flags,stream); //r_platform_variants->push_back("etc2"); - _save_stex(image,p_save_path+".s3tc.stex",compress_mode,lossy,Image::COMPRESS_S3TC,mipmaps,tex_flags,stream); + _save_stex(image,p_save_path+".s3tc.stex",compress_mode,lossy,Image::COMPRESS_S3TC,mipmaps,tex_flags,stream,detect_3d,detect_srgb); r_platform_variants->push_back("s3tc"); } else { //import normally - _save_stex(image,p_save_path+".stex",compress_mode,lossy,Image::COMPRESS_16BIT /*this is ignored */,mipmaps,tex_flags,stream); + _save_stex(image,p_save_path+".stex",compress_mode,lossy,Image::COMPRESS_16BIT /*this is ignored */,mipmaps,tex_flags,stream,detect_3d,detect_srgb); } return OK; } +ResourceImporterTexture *ResourceImporterTexture::singleton=NULL; + ResourceImporterTexture::ResourceImporterTexture() { + singleton=this; + StreamTexture::request_3d_callback=_texture_reimport_3d; + StreamTexture::request_srgb_callback=_texture_reimport_srgb; + mutex = Mutex::create(); } + +ResourceImporterTexture::~ResourceImporterTexture() +{ + + memdelete(mutex); +} + diff --git a/tools/editor/import/resource_import_texture.h b/tools/editor/import/resource_importer_texture.h index 84f7b77838..4c795e132c 100644 --- a/tools/editor/import/resource_import_texture.h +++ b/tools/editor/import/resource_importer_texture.h @@ -2,10 +2,33 @@ #define RESOURCEIMPORTTEXTURE_H #include "io/resource_import.h" +class StreamTexture; class ResourceImporterTexture : public ResourceImporter { GDCLASS(ResourceImporterTexture,ResourceImporter) + + + +protected: + + enum { + MAKE_3D_FLAG=1, + MAKE_SRGB_FLAG=2 + }; + + Mutex *mutex; + Map<StringName,int> make_flags; + + static void _texture_reimport_srgb(const Ref<StreamTexture>& p_tex); + static void _texture_reimport_3d(const Ref<StreamTexture>& p_tex); + + + + + static ResourceImporterTexture *singleton; public: + + static ResourceImporterTexture *get_singleton() { return singleton; } virtual String get_importer_name() const; virtual String get_visible_name() const; virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -33,11 +56,15 @@ public: 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; - void _save_stex(const Image& p_image, const String& p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable); + void _save_stex(const Image& p_image, const String& p_to_path, int p_compress_mode, float p_lossy_quality, Image::CompressMode p_vram_compression, bool p_mipmaps, int p_texture_flags, bool p_streamable,bool p_detect_3d,bool p_detect_srgb); 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); + + void update_imports(); + ResourceImporterTexture(); + ~ResourceImporterTexture(); }; #endif // RESOURCEIMPORTTEXTURE_H diff --git a/tools/editor/import/resource_importer_wav.cpp b/tools/editor/import/resource_importer_wav.cpp new file mode 100644 index 0000000000..ee53b740ca --- /dev/null +++ b/tools/editor/import/resource_importer_wav.cpp @@ -0,0 +1,619 @@ +#include "resource_importer_wav.h" + +#include "scene/resources/audio_stream_sample.h" +#include "os/file_access.h" +#include "io/marshalls.h" +#include "io/resource_saver.h" + +String ResourceImporterWAV::get_importer_name() const { + + return "wav"; +} + +String ResourceImporterWAV::get_visible_name() const{ + + return "Microsoft WAV"; +} +void ResourceImporterWAV::get_recognized_extensions(List<String> *p_extensions) const{ + + p_extensions->push_back("wav"); +} +String ResourceImporterWAV::get_save_extension() const { + return "smp"; +} + +String ResourceImporterWAV::get_resource_type() const{ + + return "AudioStreamSample"; +} + +bool ResourceImporterWAV::get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const { + + return true; +} + +int ResourceImporterWAV::get_preset_count() const { + return 0; +} +String ResourceImporterWAV::get_preset_name(int p_idx) const { + + return String(); +} + + +void ResourceImporterWAV::get_import_options(List<ImportOption> *r_options,int p_preset) const { + + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"force/8_bit"),false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"force/mono"),false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"force/max_rate"),false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::REAL,"force/max_rate_hz",PROPERTY_HINT_EXP_RANGE,"11025,192000,1"),44100)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"edit/trim"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"edit/normalize"),true)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"edit/loop"),false)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"compress/mode",PROPERTY_HINT_ENUM,"Disabled,RAM (Ima-ADPCM)"),0)); + +} + + +Error ResourceImporterWAV::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) { + + /* STEP 1, READ WAVE FILE */ + + Error err; + FileAccess *file=FileAccess::open(p_source_file, FileAccess::READ,&err); + + ERR_FAIL_COND_V( err!=OK, ERR_CANT_OPEN ); + + /* CHECK RIFF */ + char riff[5]; + riff[4]=0; + file->get_buffer((uint8_t*)&riff,4); //RIFF + + if (riff[0]!='R' || riff[1]!='I' || riff[2]!='F' || riff[3]!='F') { + + file->close(); + memdelete(file); + ERR_FAIL_V( ERR_FILE_UNRECOGNIZED ); + } + + + /* GET FILESIZE */ + uint32_t filesize=file->get_32(); + + /* CHECK WAVE */ + + char wave[4]; + + file->get_buffer((uint8_t*)&wave,4); //RIFF + + if (wave[0]!='W' || wave[1]!='A' || wave[2]!='V' || wave[3]!='E') { + + + file->close(); + memdelete(file); + ERR_EXPLAIN("Not a WAV file (no WAVE RIFF Header)") + ERR_FAIL_V( ERR_FILE_UNRECOGNIZED ); + } + + int format_bits=0; + int format_channels=0; + + AudioStreamSample::LoopMode loop=AudioStreamSample::LOOP_DISABLED; + bool format_found=false; + bool data_found=false; + int format_freq=0; + int loop_begin=0; + int loop_end=0; + int frames; + + Vector<float> data; + + while (!file->eof_reached()) { + + + /* chunk */ + char chunkID[4]; + file->get_buffer((uint8_t*)&chunkID,4); //RIFF + + /* chunk size */ + uint32_t chunksize=file->get_32(); + uint32_t file_pos=file->get_pos(); //save file pos, so we can skip to next chunk safely + + if (file->eof_reached()) { + + //ERR_PRINT("EOF REACH"); + break; + } + + if (chunkID[0]=='f' && chunkID[1]=='m' && chunkID[2]=='t' && chunkID[3]==' ' && !format_found) { + /* IS FORMAT CHUNK */ + + uint16_t compression_code=file->get_16(); + + + if (compression_code!=1) { + ERR_PRINT("Format not supported for WAVE file (not PCM). Save WAVE files as uncompressed PCM instead."); + break; + } + + format_channels=file->get_16(); + if (format_channels!=1 && format_channels !=2) { + + ERR_PRINT("Format not supported for WAVE file (not stereo or mono)"); + break; + + } + + format_freq=file->get_32(); //sampling rate + + file->get_32(); // average bits/second (unused) + file->get_16(); // block align (unused) + format_bits=file->get_16(); // bits per sample + + if (format_bits%8) { + + ERR_PRINT("Strange number of bits in sample (not 8,16,24,32)"); + break; + } + + /* Dont need anything else, continue */ + format_found=true; + } + + + if (chunkID[0]=='d' && chunkID[1]=='a' && chunkID[2]=='t' && chunkID[3]=='a' && !data_found) { + /* IS FORMAT CHUNK */ + data_found=true; + + if (!format_found) { + ERR_PRINT("'data' chunk before 'format' chunk found."); + break; + + } + + frames=chunksize; + + frames/=format_channels; + frames/=(format_bits>>3); + + /*print_line("chunksize: "+itos(chunksize)); + print_line("channels: "+itos(format_channels)); + print_line("bits: "+itos(format_bits)); +*/ + + int len=frames; + if (format_channels==2) + len*=2; + if (format_bits>8) + len*=2; + + + data.resize(frames*format_channels); + + for (int i=0;i<frames;i++) { + + + for (int c=0;c<format_channels;c++) { + + + if (format_bits==8) { + // 8 bit samples are UNSIGNED + + uint8_t s = file->get_8(); + s-=128; + int8_t *sp=(int8_t*)&s; + + data[i*format_channels+c]=float(*sp)/128.0; + + } else { + //16+ bits samples are SIGNED + // if sample is > 16 bits, just read extra bytes + + uint32_t s=0; + for (int b=0;b<(format_bits>>3);b++) { + + s|=((uint32_t)file->get_8())<<(b*8); + } + s<<=(32-format_bits); + int32_t ss=s; + + + data[i*format_channels+c]=(ss>>16)/32768.0; + } + } + + } + + + + if (file->eof_reached()) { + file->close(); + memdelete(file); + ERR_EXPLAIN("Premature end of file."); + ERR_FAIL_V(ERR_FILE_CORRUPT); + } + } + + if (chunkID[0]=='s' && chunkID[1]=='m' && chunkID[2]=='p' && chunkID[3]=='l') { + //loop point info! + + for(int i=0;i<10;i++) + file->get_32(); // i wish to know why should i do this... no doc! + + loop=file->get_32()?AudioStreamSample::LOOP_PING_PONG:AudioStreamSample::LOOP_FORWARD; + loop_begin=file->get_32(); + loop_end=file->get_32(); + + } + file->seek( file_pos+chunksize ); + } + + file->close(); + memdelete(file); + + // STEP 2, APPLY CONVERSIONS + + + bool is16=format_bits!=8; + int rate=format_freq; + + print_line("Input Sample: "); + print_line("\tframes: "+itos(frames)); + print_line("\tformat_channels: "+itos(format_channels)); + print_line("\t16bits: "+itos(is16)); + print_line("\trate: "+itos(rate)); + print_line("\tloop: "+itos(loop)); + print_line("\tloop begin: "+itos(loop_begin)); + print_line("\tloop end: "+itos(loop_end)); + + + //apply frequency limit + + bool limit_rate = p_options["force/max_rate"]; + int limit_rate_hz = p_options["force/max_rate_hz"]; + if (limit_rate && rate > limit_rate_hz) { + //resampleeee!!! + int new_data_frames = frames * limit_rate_hz / rate; + Vector<float> new_data; + new_data.resize( new_data_frames * format_channels ); + for(int c=0;c<format_channels;c++) { + + for(int i=0;i<new_data_frames;i++) { + + //simple cubic interpolation should be enough. + float pos = float(i) * frames / new_data_frames; + float mu = pos-Math::floor(pos); + int ipos = int(Math::floor(pos)); + + float y0=data[MAX(0,ipos-1)*format_channels+c]; + float y1=data[ipos*format_channels+c]; + float y2=data[MIN(frames-1,ipos+1)*format_channels+c]; + float y3=data[MIN(frames-1,ipos+2)*format_channels+c]; + + float mu2 = mu*mu; + float a0 = y3 - y2 - y0 + y1; + float a1 = y0 - y1 - a0; + float a2 = y2 - y0; + float a3 = y1; + + float res=(a0*mu*mu2+a1*mu2+a2*mu+a3); + + new_data[i*format_channels+c]=res; + } + } + + if (loop) { + + loop_begin=loop_begin*new_data_frames/frames; + loop_end=loop_end*new_data_frames/frames; + } + data=new_data; + rate=limit_rate_hz; + frames=new_data_frames; + } + + + bool normalize = p_options["edit/normalize"]; + + if (normalize) { + + float max=0; + for(int i=0;i<data.size();i++) { + + float amp = Math::abs(data[i]); + if (amp>max) + max=amp; + } + + if (max>0) { + + float mult=1.0/max; + for(int i=0;i<data.size();i++) { + + data[i]*=mult; + } + + } + } + + bool trim = p_options["edit/trim"]; + + if (trim && !loop) { + + int first=0; + 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]); + + if (!found && amp > limit) { + first=i; + found=true; + } + + if (found && amp > limit) { + last=i; + } + } + + 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*format_channels;i++) { + new_data[i-first*format_channels]=data[i]; + } + + data=new_data; + frames=data.size()/format_channels; + } + + } + + bool make_loop = p_options["edit/loop"]; + + if (make_loop && !loop) { + + loop=AudioStreamSample::LOOP_FORWARD; + loop_begin=0; + loop_end=frames; + } + + int compression = p_options["compress/mode"]; + bool force_mono = p_options["force/mono"]; + + + if (force_mono && format_channels==2) { + + Vector<float> new_data; + new_data.resize(data.size()/2); + for(int i=0;i<frames;i++) { + new_data[i]=(data[i*2+0]+data[i*2+1])/2.0; + } + + data=new_data; + format_channels=1; + } + + bool force_8_bit = p_options["force/8_bit"]; + if (force_8_bit) { + + is16=false; + } + + + PoolVector<uint8_t> dst_data; + AudioStreamSample::Format dst_format; + + if ( compression == 1) { + + dst_format=AudioStreamSample::FORMAT_IMA_ADPCM; + if (format_channels==1) { + _compress_ima_adpcm(data,dst_data); + } else { + + //byte interleave + Vector<float> left; + Vector<float> right; + + int tframes = data.size()/2; + left.resize(tframes); + right.resize(tframes); + + for(int i=0;i<tframes;i++) { + left[i]=data[i*2+0]; + right[i]=data[i*2+1]; + } + + PoolVector<uint8_t> bleft; + PoolVector<uint8_t> bright; + + _compress_ima_adpcm(left,bleft); + _compress_ima_adpcm(right,bright); + + int dl = bleft.size(); + dst_data.resize( dl *2 ); + + PoolVector<uint8_t>::Write w=dst_data.write(); + PoolVector<uint8_t>::Read rl=bleft.read(); + PoolVector<uint8_t>::Read rr=bright.read(); + + for(int i=0;i<dl;i++) { + w[i*2+0]=rl[i]; + w[i*2+1]=rr[i]; + } + } + + //print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size())); + + } else { + + dst_format=is16?AudioStreamSample::FORMAT_16_BITS:AudioStreamSample::FORMAT_8_BITS; + dst_data.resize( data.size() * (is16?2:1)); + { + PoolVector<uint8_t>::Write w = dst_data.write(); + + int ds=data.size(); + for(int i=0;i<ds;i++) { + + if (is16) { + int16_t v = CLAMP(data[i]*32768,-32768,32767); + encode_uint16(v,&w[i*2]); + } else { + int8_t v = CLAMP(data[i]*128,-128,127); + w[i]=v; + } + } + } + } + + + Ref<AudioStreamSample> sample; + sample.instance(); + sample->set_data(dst_data); + sample->set_format(dst_format); + sample->set_mix_rate(rate); + sample->set_loop_mode(loop); + sample->set_loop_begin(loop_begin); + sample->set_loop_end(loop_end); + sample->set_stereo(format_channels==2); + + ResourceSaver::save(p_save_path+".smp",sample); + + + return OK; + +} + +void ResourceImporterWAV::_compress_ima_adpcm(const Vector<float>& p_data,PoolVector<uint8_t>& dst_data) { + + + /*p_sample_data->data = (void*)malloc(len); + xm_s8 *dataptr=(xm_s8*)p_sample_data->data;*/ + + static const int16_t _ima_adpcm_step_table[89] = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, + 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, + 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, + 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, + 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, + 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, + 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, + 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, + 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 + }; + + static const int8_t _ima_adpcm_index_table[16] = { + -1, -1, -1, -1, 2, 4, 6, 8, + -1, -1, -1, -1, 2, 4, 6, 8 + }; + + + int datalen = p_data.size(); + int datamax=datalen; + if (datalen&1) + datalen++; + + dst_data.resize(datalen/2+4); + PoolVector<uint8_t>::Write w = dst_data.write(); + + + int i,step_idx=0,prev=0; + uint8_t *out = w.ptr(); + //int16_t xm_prev=0; + const float *in=p_data.ptr(); + + + /* initial value is zero */ + *(out++) =0; + *(out++) =0; + /* Table index initial value */ + *(out++) =0; + /* unused */ + *(out++) =0; + + for (i=0;i<datalen;i++) { + int step,diff,vpdiff,mask; + uint8_t nibble; + int16_t xm_sample; + + if (i>=datamax) + xm_sample=0; + else { + + + xm_sample=CLAMP(in[i]*32767.0,-32768,32767); + /* + if (xm_sample==32767 || xm_sample==-32768) + printf("clippy!\n",xm_sample); + */ + } + + //xm_sample=xm_sample+xm_prev; + //xm_prev=xm_sample; + + diff = (int)xm_sample - prev ; + + nibble=0 ; + step = _ima_adpcm_step_table[ step_idx ]; + vpdiff = step >> 3 ; + if (diff < 0) { + nibble=8; + diff=-diff ; + } + mask = 4 ; + while (mask) { + + if (diff >= step) { + + nibble |= mask; + diff -= step; + vpdiff += step; + } + + step >>= 1 ; + mask >>= 1 ; + }; + + if (nibble&8) + prev-=vpdiff ; + else + prev+=vpdiff ; + + if (prev > 32767) { + //printf("%i,xms %i, prev %i,diff %i, vpdiff %i, clip up %i\n",i,xm_sample,prev,diff,vpdiff,prev); + prev=32767; + } else if (prev < -32768) { + //printf("%i,xms %i, prev %i,diff %i, vpdiff %i, clip down %i\n",i,xm_sample,prev,diff,vpdiff,prev); + prev = -32768 ; + } + + step_idx += _ima_adpcm_index_table[nibble]; + if (step_idx< 0) + step_idx= 0 ; + else if (step_idx> 88) + step_idx= 88 ; + + + if (i&1) { + *out|=nibble<<4; + out++; + } else { + *out=nibble; + } + /*dataptr[i]=prev>>8;*/ + } + + + + +} + +ResourceImporterWAV::ResourceImporterWAV() +{ + +} diff --git a/tools/editor/import/resource_importer_wav.h b/tools/editor/import/resource_importer_wav.h new file mode 100644 index 0000000000..9f1bd57da7 --- /dev/null +++ b/tools/editor/import/resource_importer_wav.h @@ -0,0 +1,30 @@ +#ifndef RESOURCEIMPORTWAV_H +#define RESOURCEIMPORTWAV_H + + +#include "io/resource_import.h" + +class ResourceImporterWAV : public ResourceImporter { + GDCLASS(ResourceImporterWAV,ResourceImporter) +public: + 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; + + void _compress_ima_adpcm(const Vector<float>& p_data,PoolVector<uint8_t>& dst_data); + + 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); + + ResourceImporterWAV(); +}; + +#endif // RESOURCEIMPORTWAV_H diff --git a/tools/editor/io_plugins/SCsub b/tools/editor/io_plugins/SCsub index 4bf55189cc..f1fa50148f 100644 --- a/tools/editor/io_plugins/SCsub +++ b/tools/editor/io_plugins/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources, "*.cpp") +env.add_source_files(env.editor_sources, "*.cpp") diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp index 9438af9072..5ecb0b1abf 100644 --- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -346,7 +346,7 @@ public: add_to_project = memnew( CheckButton); add_to_project->set_pressed(true); - add_to_project->set_text(TTR("Add to Project (engine.cfg)")); + add_to_project->set_text(TTR("Add to Project (godot.cfg)")); tcomp->add_child(add_to_project); file_select = memnew(EditorFileDialog); diff --git a/tools/editor/plugins/SCsub b/tools/editor/plugins/SCsub index 4bf55189cc..f1fa50148f 100644 --- a/tools/editor/plugins/SCsub +++ b/tools/editor/plugins/SCsub @@ -2,4 +2,4 @@ Import('env') Export('env') -env.add_source_files(env.tool_sources, "*.cpp") +env.add_source_files(env.editor_sources, "*.cpp") diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 4738b348f4..5f97fce4e7 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1334,6 +1334,7 @@ void ScriptEditor::_find_scripts(Node* p_base, Node* p_current, Set<Ref<Script> struct _ScriptEditorItemData { String name; + String sort_key; Ref<Texture> icon; int index; String tooltip; @@ -1343,7 +1344,7 @@ struct _ScriptEditorItemData { bool operator<(const _ScriptEditorItemData& id) const { - return category==id.category?name.nocasecmp_to(id.name)<0:category<id.category; + return category==id.category?sort_key<id.sort_key:category<id.category; } }; @@ -1404,6 +1405,8 @@ void ScriptEditor::_update_script_names() { script_list->clear(); bool split_script_help = EditorSettings::get_singleton()->get("text_editor/open_scripts/group_help_pages"); + ScriptSortBy sort_by = (ScriptSortBy) (int) EditorSettings::get_singleton()->get("text_editor/open_scripts/sort_scripts_by"); + ScriptListName display_as = (ScriptListName) (int) EditorSettings::get_singleton()->get("text_editor/open_scripts/list_script_names_as"); Vector<_ScriptEditorItemData> sedata; @@ -1415,15 +1418,41 @@ void ScriptEditor::_update_script_names() { String name = se->get_name(); Ref<Texture> icon = se->get_icon(); - String tooltip = se->get_edited_script()->get_path(); + String path = se->get_edited_script()->get_path(); _ScriptEditorItemData sd; sd.icon=icon; sd.name=name; - sd.tooltip=tooltip; + sd.tooltip=path; sd.index=i; sd.used=used.has(se->get_edited_script()); sd.category=0; + + switch (sort_by) { + case SORT_BY_NAME: { + sd.sort_key=name.to_lower(); + } break; + case SORT_BY_PATH: { + sd.sort_key=path; + } break; + } + + switch (display_as) { + case DISPLAY_NAME: { + sd.name=name; + } break; + case DISPLAY_DIR_AND_NAME: { + if (!path.get_base_dir().get_file().empty()) { + sd.name=path.get_base_dir().get_file() + "/" + name; + } else { + sd.name=name; + } + } break; + case DISPLAY_FULL_PATH: { + sd.name=path; + } break; + } + sedata.push_back(sd); } @@ -1438,6 +1467,7 @@ void ScriptEditor::_update_script_names() { _ScriptEditorItemData sd; sd.icon=icon; sd.name=name; + sd.sort_key=name; sd.tooltip=tooltip; sd.index=i; sd.used=false; @@ -1727,6 +1757,7 @@ void ScriptEditor::_editor_settings_changed() { se->update_settings(); } _update_script_colors(); + _update_script_names(); ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/files/auto_reload_and_parse_scripts_on_save",true)); @@ -2440,9 +2471,13 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) { EDITOR_DEF("text_editor/open_scripts/script_temperature_cold_color",Color(0,0,1,0.3)); EDITOR_DEF("text_editor/open_scripts/current_script_background_color",Color(0.81,0.81,0.14,0.63)); EDITOR_DEF("text_editor/open_scripts/group_help_pages",true); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT,"text_editor/open_scripts/sort_scripts_by",PROPERTY_HINT_ENUM,"Name,Path")); + EDITOR_DEF("text_editor/open_scripts/sort_scripts_by",0); + EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT,"text_editor/open_scripts/list_script_names_as",PROPERTY_HINT_ENUM,"Name,Parent Directory And Name,Full Path")); + EDITOR_DEF("text_editor/open_scripts/list_script_names_as",0); EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"text_editor/external/exec_path",PROPERTY_HINT_GLOBAL_FILE)); EDITOR_DEF("text_editor/external/exec_flags",""); - + } diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 887c2f7d68..75099fc5ec 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -154,6 +154,17 @@ class ScriptEditor : public VBoxContainer { WINDOW_PREV, WINDOW_SELECT_BASE=100 }; + + enum ScriptSortBy { + SORT_BY_NAME, + SORT_BY_PATH, + }; + + enum ScriptListName { + DISPLAY_NAME, + DISPLAY_DIR_AND_NAME, + DISPLAY_FULL_PATH, + }; HBoxContainer *menu_hb; MenuButton *file_menu; diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 9f8367ff1d..3ba1a2cbdc 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -277,12 +277,10 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b Vector<ObjectID> instances=VisualServer::get_singleton()->instances_cull_ray(pos,ray,get_tree()->get_root()->get_world()->get_scenario() ); Set<Ref<SpatialEditorGizmo> > found_gizmos; - //uint32_t closest=0; - //float closest_dist=0; - - r_includes_current=false; - - List<_RayResult> results; + ObjectID closest=0; + Spatial *item=NULL; + float closest_dist=1e20; + int selected_handle=-1; for (int i=0;i<instances.size();i++) { @@ -318,84 +316,30 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b if (dist<0) continue; + if (dist < closest_dist) { + closest=instances[i]; + closest_dist=dist; + selected_handle=handle; + item=spat; + } + // if (editor_selection->is_selected(spat)) + // r_includes_current=true; - if (editor_selection->is_selected(spat)) - r_includes_current=true; - - _RayResult res; - res.item=spat; - res.depth=dist; - res.handle=handle; - results.push_back(res); } - if (results.empty()) + if (!item) return 0; - results.sort(); - Spatial *s=NULL; - + if (!editor_selection->is_selected(item) || (r_gizmo_handle && selected_handle>=0)) { - if (!r_includes_current || results.size()==1 || (r_gizmo_handle && results.front()->get().handle>=0)) { - - //return the nearest one - s = results.front()->get().item; if (r_gizmo_handle) - *r_gizmo_handle=results.front()->get().handle; - - } else { - - //returns the next one from a curent selection - List<_RayResult>::Element *E=results.front(); - List<_RayResult>::Element *S=NULL; - + *r_gizmo_handle=selected_handle; - while(true) { - - //very strange loop algorithm that complies with object selection standards (tm). - - if (S==E) { - //went all around and anothing was found - //since can't rotate the selection - //just return the first one - - s=results.front()->get().item; - break; - - } - - if (!S && editor_selection->is_selected(E->get().item)) { - //found an item currently in the selection, - //so start from this one - S=E; - } - - if (S && !editor_selection->is_selected(E->get().item)) { - // free item after a selected item, this one is desired. - s=E->get().item; - break; - } - - E=E->next(); - if (!E) { - - if (!S) { - //did a loop but nothing was selected, select first - s=results.front()->get().item; - break; - - } - E=results.front(); - } - } } - if (!s) - return 0; - - return s->get_instance_ID(); + return closest; } @@ -3143,7 +3087,7 @@ void SpatialEditor::_init_indicators() { indicator_mat.instance(); indicator_mat->set_flag(FixedSpatialMaterial::FLAG_UNSHADED,true); - indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); + //indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ONTOP,true); indicator_mat->set_flag(FixedSpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR,true); indicator_mat->set_flag(FixedSpatialMaterial::FLAG_SRGB_VERTEX_COLOR,true); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 4472cff9cc..2fa62df5bc 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -450,8 +450,8 @@ void ProjectExportDialog::_export_action(const String& p_file) { while(true) { - print_line("TESTING: "+location.plus_file("engine.cfg")); - if (FileAccess::exists(location.plus_file("engine.cfg"))) { + print_line("TESTING: "+location.plus_file("godot.cfg")); + if (FileAccess::exists(location.plus_file("godot.cfg"))) { error->set_text(TTR("Please export outside the project folder!")); error->popup_centered_minsize(); @@ -2099,7 +2099,7 @@ Error ProjectExport::export_project(const String& p_preset) { added_settings["remap/"+platform]=Variant(remaps).operator Array(); } - String engine_cfg_path=d->get_current_dir()+"/engine.cfg"; + String engine_cfg_path=d->get_current_dir()+"/godot.cfg"; print_line("enginecfg: "+engine_cfg_path); GlobalConfig::get_singleton()->save_custom(engine_cfg_path,added_settings); diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index fb8cccdb79..af73414ab0 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -92,18 +92,18 @@ private: if (mode!=MODE_IMPORT) { - if (d->file_exists("engine.cfg")) { + if (d->file_exists("godot.cfg")) { - error->set_text(TTR("Invalid project path, engine.cfg must not exist.")); + error->set_text(TTR("Invalid project path, godot.cfg must not exist.")); memdelete(d); return ""; } } else { - if (valid_path != "" && !d->file_exists("engine.cfg")) { + if (valid_path != "" && !d->file_exists("godot.cfg")) { - error->set_text(TTR("Invalid project path, engine.cfg must exist.")); + error->set_text(TTR("Invalid project path, godot.cfg must exist.")); memdelete(d); return ""; } @@ -137,7 +137,7 @@ private: String p = p_path; if (mode==MODE_IMPORT) { - if (p.ends_with("engine.cfg")) { + if (p.ends_with("godot.cfg")) { p=p.get_base_dir(); } @@ -163,7 +163,7 @@ private: fdialog->set_mode(FileDialog::MODE_OPEN_FILE); fdialog->clear_filters(); - fdialog->add_filter("engine.cfg ; " _MKSTR(VERSION_NAME) " Project"); + fdialog->add_filter("godot.cfg ; " _MKSTR(VERSION_NAME) " Project"); } else { fdialog->set_mode(FileDialog::MODE_OPEN_DIR); } @@ -190,9 +190,9 @@ private: - FileAccess *f = FileAccess::open(dir.plus_file("/engine.cfg"),FileAccess::WRITE); + FileAccess *f = FileAccess::open(dir.plus_file("/godot.cfg"),FileAccess::WRITE); if (!f) { - error->set_text(TTR("Couldn't create engine.cfg in project path.")); + error->set_text(TTR("Couldn't create godot.cfg in project path.")); } else { f->store_line("; Engine configuration file."); @@ -759,7 +759,7 @@ void ProjectManager::_load_recent_projects() { continue; String project = _name.get_slice("/",1); - String conf=path.plus_file("engine.cfg"); + String conf=path.plus_file("godot.cfg"); bool favorite = (_name.begins_with("favorite_projects/"))?true:false; uint64_t last_modified = 0; @@ -1027,7 +1027,7 @@ void ProjectManager::_scan_dir(DirAccess *da,float pos, float total,List<String> while(n!=String()) { if (da->current_is_dir() && !n.begins_with(".")) { subdirs.push_front(n); - } else if (n=="engine.cfg") { + } else if (n=="godot.cfg") { r_projects->push_back(da->get_current_dir()); } n=da->get_next(); @@ -1151,7 +1151,7 @@ void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { dir->list_dir_begin(); String file = dir->get_next(); while(confirm && file!=String()) { - if (!dir->current_is_dir() && file.ends_with("engine.cfg")) { + if (!dir->current_is_dir() && file.ends_with("godot.cfg")) { confirm = false; } file = dir->get_next(); diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp index 764d1e4546..e725786f94 100644 --- a/tools/editor/project_settings.cpp +++ b/tools/editor/project_settings.cpp @@ -1217,7 +1217,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { singleton=this; - set_title(TTR("Project Settings (engine.cfg)")); + set_title(TTR("Project Settings (godot.cfg)")); undo_redo=&p_data->get_undo_redo(); data=p_data; diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp index c670245282..3ed101cdd6 100644 --- a/tools/editor/spatial_editor_gizmos.cpp +++ b/tools/editor/spatial_editor_gizmos.cpp @@ -2484,7 +2484,7 @@ void GIProbeGizmo::redraw(){ } - add_lines(lines,SpatialEditorGizmos::singleton->reflection_probe_material_internal); + add_lines(lines,SpatialEditorGizmos::singleton->gi_probe_material_internal); Vector<Vector3> handles; @@ -3406,7 +3406,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { reflection_probe_material = create_line_material(Color(0.5,1.0,0.7)); reflection_probe_material_internal = create_line_material(Color(0.3,0.8,0.5,0.15)); gi_probe_material = create_line_material(Color(0.7,1.0,0.5)); - gi_probe_material_internal = create_line_material(Color(0.5,0.8,0.3,0.4)); + gi_probe_material_internal = create_line_material(Color(0.5,0.8,0.3,0.1)); joint_material = create_line_material(Color(0.6,0.8,1.0)); stream_player_icon = Ref<FixedSpatialMaterial>( memnew( FixedSpatialMaterial )); diff --git a/tools/translations/Makefile b/tools/editor/translations/Makefile index bea20e877d..bea20e877d 100644 --- a/tools/translations/Makefile +++ b/tools/editor/translations/Makefile diff --git a/tools/translations/README.md b/tools/editor/translations/README.md index 351bc9e2d1..351bc9e2d1 100644 --- a/tools/translations/README.md +++ b/tools/editor/translations/README.md diff --git a/tools/translations/ar.po b/tools/editor/translations/ar.po index 0bfef1cfe1..539b94ab62 100644 --- a/tools/translations/ar.po +++ b/tools/editor/translations/ar.po @@ -3252,7 +3252,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5844,11 +5844,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5860,7 +5860,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6094,7 +6094,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/bg.po b/tools/editor/translations/bg.po index 9197a6e702..fe711e1b30 100644 --- a/tools/translations/bg.po +++ b/tools/editor/translations/bg.po @@ -3295,7 +3295,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5890,11 +5890,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5906,7 +5906,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6140,7 +6140,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/bn.po b/tools/editor/translations/bn.po index a3a3a072fc..0b1993caa0 100644 --- a/tools/translations/bn.po +++ b/tools/editor/translations/bn.po @@ -3381,8 +3381,8 @@ msgid "Compress" msgstr "সঙ্কোচন করুন" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "প্রকল্পে সংযুক্ত করুন (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "প্রকল্পে সংযুক্ত করুন (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -5989,12 +5989,12 @@ msgid "Invalid project path, the path must exist!" msgstr "অকার্যকর প্রকল্পের পথ, পথটি অবশ্যই বিদ্যমান হতে হবে!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "অকার্যকর প্রকল্পের পথ, engine.cfg অবশ্যই অনুপস্থিত হতে হবে।" +msgid "Invalid project path, godot.cfg must not exist." +msgstr "অকার্যকর প্রকল্পের পথ, godot.cfg অবশ্যই অনুপস্থিত হতে হবে।" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "অকার্যকর প্রকল্পের পথ, engine.cfg অবশ্যই উপস্থিত হতে হবে।" +msgid "Invalid project path, godot.cfg must exist." +msgstr "অকার্যকর প্রকল্পের পথ, godot.cfg অবশ্যই উপস্থিত হতে হবে।" #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6005,8 +6005,8 @@ msgid "Invalid project path (changed anything?)." msgstr "অকার্যকর প্রকল্পের পথ (কোনোকিছু পরিবর্তন করেছেন?)।" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "প্রকল্পের পথে engine.cfg তৈরি করা সম্ভব হয়নি।" +msgid "Couldn't create godot.cfg in project path." +msgstr "প্রকল্পের পথে godot.cfg তৈরি করা সম্ভব হয়নি।" #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6241,8 +6241,8 @@ msgid "Remove Resource Remap Option" msgstr "রিসোর্সের পুনঃ-নকশার সিদ্ধান্ত অপসারণ করুন" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "প্রকল্পের সেটিংস (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "প্রকল্পের সেটিংস (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/ca.po b/tools/editor/translations/ca.po index 266551ee60..c45cad964b 100644 --- a/tools/translations/ca.po +++ b/tools/editor/translations/ca.po @@ -3406,7 +3406,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -6004,11 +6004,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -6020,7 +6020,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6254,8 +6254,8 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Configuració del Projecte (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Configuració del Projecte (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/cs.po b/tools/editor/translations/cs.po index 4020725d74..3dc52fa536 100644 --- a/tools/translations/cs.po +++ b/tools/editor/translations/cs.po @@ -3321,7 +3321,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5918,11 +5918,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5934,7 +5934,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6168,7 +6168,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/da.po b/tools/editor/translations/da.po index e0d4d9bd98..6148d0b82d 100644 --- a/tools/translations/da.po +++ b/tools/editor/translations/da.po @@ -3323,7 +3323,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5918,11 +5918,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5934,7 +5934,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6168,7 +6168,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/de.po b/tools/editor/translations/de.po index 68ce048b5b..0545ea2f21 100644 --- a/tools/translations/de.po +++ b/tools/editor/translations/de.po @@ -3419,8 +3419,8 @@ msgid "Compress" msgstr "Komprimieren" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Zu Projekt hinzufügen (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Zu Projekt hinzufügen (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6036,12 +6036,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Ungültiger Projektpfad, der Pfad muss existieren!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Ungültiger Projektpfad, engine.cfg darf nicht existieren." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Ungültiger Projektpfad, godot.cfg darf nicht existieren." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Ungültiger Projektpfad, engine.cfg muss existieren." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Ungültiger Projektpfad, godot.cfg muss existieren." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6052,8 +6052,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Ungültiger Projektpfad (etwas geändert?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "Konnte engine.cfg in Projektpfad nicht erzeugen." +msgid "Couldn't create godot.cfg in project path." +msgstr "Konnte godot.cfg in Projektpfad nicht erzeugen." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6288,8 +6288,8 @@ msgid "Remove Resource Remap Option" msgstr "Ressourcen-Remap-Option entfernen" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Projekteinstellungen (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Projekteinstellungen (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/de_CH.po b/tools/editor/translations/de_CH.po index e6e0efdb23..0420d3fc97 100644 --- a/tools/translations/de_CH.po +++ b/tools/editor/translations/de_CH.po @@ -3295,8 +3295,8 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Zum Projekt hinzufügen (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Zum Projekt hinzufügen (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -5900,12 +5900,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Ungültiger Projektpfad, Pfad existiert nicht!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Ungültiger Projektpfad, engine.cfg vorhanden!" +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Ungültiger Projektpfad, godot.cfg vorhanden!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Ungültiger Projektpfad, engine.cfg nicht vorhanden!" +msgid "Invalid project path, godot.cfg must exist." +msgstr "Ungültiger Projektpfad, godot.cfg nicht vorhanden!" #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -5916,8 +5916,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Ungültiger Projektpfad, (wurde was geändert?)!" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "Die engine.cfg kann im Projektverzeichnis nicht erstellt werden." +msgid "Couldn't create godot.cfg in project path." +msgstr "Die godot.cfg kann im Projektverzeichnis nicht erstellt werden." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6150,7 +6150,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/es.po b/tools/editor/translations/es.po index cec4730148..a1108822fa 100644 --- a/tools/translations/es.po +++ b/tools/editor/translations/es.po @@ -3449,8 +3449,8 @@ msgid "Compress" msgstr "Comprimir" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Añadir al proyecto (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Añadir al proyecto (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6084,12 +6084,12 @@ msgid "Invalid project path, the path must exist!" msgstr "¡La ruta del proyecto no es correcta, tiene que existir!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "La ruta del proyecto no es correcta, engine.cfg no debe existir." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "La ruta del proyecto no es correcta, godot.cfg no debe existir." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "¡La ruta del proyecto no es correcta, engine.cfg debe existir." +msgid "Invalid project path, godot.cfg must exist." +msgstr "¡La ruta del proyecto no es correcta, godot.cfg debe existir." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6100,8 +6100,8 @@ msgid "Invalid project path (changed anything?)." msgstr "La ruta del proyecto no es correcta (¿has cambiado algo?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "No se pudo crear engine.cfg en la ruta de proyecto." +msgid "Couldn't create godot.cfg in project path." +msgstr "No se pudo crear godot.cfg en la ruta de proyecto." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6338,8 +6338,8 @@ msgid "Remove Resource Remap Option" msgstr "Quitar opción de remapeo de recursos" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Ajustes de proyecto (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Ajustes de proyecto (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/es_AR.po b/tools/editor/translations/es_AR.po index 08376f39c5..d921254859 100644 --- a/tools/translations/es_AR.po +++ b/tools/editor/translations/es_AR.po @@ -3403,8 +3403,8 @@ msgid "Compress" msgstr "Comprimir" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Agregar al Proyecto (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Agregar al Proyecto (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6019,12 +6019,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Ruta de proyecto inválida, la ruta debe existir!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Ruta de proyecto inválida, engine.cfg no debe existir." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Ruta de proyecto inválida, godot.cfg no debe existir." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Ruta de proyecto inválida, engine.cfg debe existir." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Ruta de proyecto inválida, godot.cfg debe existir." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6035,8 +6035,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Ruta de proyecto inválida (cambiaste algo?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "No se pudo crear engine.cfg en la ruta de proyecto." +msgid "Couldn't create godot.cfg in project path." +msgstr "No se pudo crear godot.cfg en la ruta de proyecto." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6273,8 +6273,8 @@ msgid "Remove Resource Remap Option" msgstr "Remover Opción de Remapeo de Recursos" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Ajustes de Proyecto (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Ajustes de Proyecto (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/extract.py b/tools/editor/translations/extract.py index 1192c19011..1192c19011 100755 --- a/tools/translations/extract.py +++ b/tools/editor/translations/extract.py diff --git a/tools/translations/fa.po b/tools/editor/translations/fa.po index 8e29cda45f..41a686ba52 100644 --- a/tools/translations/fa.po +++ b/tools/editor/translations/fa.po @@ -3350,7 +3350,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5948,11 +5948,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5964,7 +5964,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6200,7 +6200,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/fr.po b/tools/editor/translations/fr.po index 10f82e2840..2c4f7144fe 100644 --- a/tools/translations/fr.po +++ b/tools/editor/translations/fr.po @@ -3437,8 +3437,8 @@ msgid "Compress" msgstr "Compresser" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Ajouter au projet (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Ajouter au projet (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6072,12 +6072,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Chemin de projet invalide, le chemin doit exister !" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Chemin de projet invalide, engine.cfg ne doit pas exister." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Chemin de projet invalide, godot.cfg ne doit pas exister." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Chemin de projet invalide, engine.cfg doit exister." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Chemin de projet invalide, godot.cfg doit exister." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6088,9 +6088,9 @@ msgid "Invalid project path (changed anything?)." msgstr "Chemin de projet non valide (avez-vous changé quelque chose ?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" -"Impossible de créer le fichier engine.cfg dans le répertoire du projet." +"Impossible de créer le fichier godot.cfg dans le répertoire du projet." #: tools/editor/project_manager.cpp #, fuzzy @@ -6332,8 +6332,8 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Paramètres du projet (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Paramètres du projet (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/hu.po b/tools/editor/translations/hu.po index ef78f27138..335ab25c6a 100644 --- a/tools/translations/hu.po +++ b/tools/editor/translations/hu.po @@ -3245,7 +3245,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5836,11 +5836,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5852,7 +5852,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6086,7 +6086,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/id.po b/tools/editor/translations/id.po index 917bd21e82..30bd357a21 100644 --- a/tools/translations/id.po +++ b/tools/editor/translations/id.po @@ -3410,7 +3410,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -6006,11 +6006,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -6022,7 +6022,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6256,7 +6256,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/it.po b/tools/editor/translations/it.po index f49c953a7d..8fefe67677 100644 --- a/tools/translations/it.po +++ b/tools/editor/translations/it.po @@ -3416,8 +3416,8 @@ msgid "Compress" msgstr "Comprimi" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Aggiungi a Progetto (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Aggiungi a Progetto (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6031,12 +6031,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Percorso di progetto invalido, il percorso deve esistere!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Percorso di progetto invalido, engine.cfg non deve esistere." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Percorso di progetto invalido, godot.cfg non deve esistere." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Percorso di progetto invalido, engine.cfg deve esistere." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Percorso di progetto invalido, godot.cfg deve esistere." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6047,8 +6047,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Percorso di progetto invalido (cambiato qualcosa?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "Impossibile creare engine.cfg nel percorso di progetto." +msgid "Couldn't create godot.cfg in project path." +msgstr "Impossibile creare godot.cfg nel percorso di progetto." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6283,8 +6283,8 @@ msgid "Remove Resource Remap Option" msgstr "Rimuovi Opzione di Remap Rimorse" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Impostazioni Progetto (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Impostazioni Progetto (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/ja.po b/tools/editor/translations/ja.po index 279f59c9c8..ea314db101 100644 --- a/tools/translations/ja.po +++ b/tools/editor/translations/ja.po @@ -3347,7 +3347,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5945,11 +5945,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5961,7 +5961,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6195,7 +6195,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/ko.po b/tools/editor/translations/ko.po index ea2b130d37..a0ecb70bf5 100644 --- a/tools/translations/ko.po +++ b/tools/editor/translations/ko.po @@ -3350,8 +3350,8 @@ msgid "Compress" msgstr "압축" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "프로젝트에 추가 (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "프로젝트에 추가 (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -5954,12 +5954,12 @@ msgid "Invalid project path, the path must exist!" msgstr "프로젝트 경로가 유효하지 않습니다. 경로가 반드시 존재해야 합니다!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "프로젝트 경로가 유효하지 않습니다. engine.cfg가 있으면 안됩니다." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "프로젝트 경로가 유효하지 않습니다. godot.cfg가 있으면 안됩니다." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "프로젝트 경로가 유효하지 않습니다. engine.cfg가 존재해야합니다." +msgid "Invalid project path, godot.cfg must exist." +msgstr "프로젝트 경로가 유효하지 않습니다. godot.cfg가 존재해야합니다." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -5970,8 +5970,8 @@ msgid "Invalid project path (changed anything?)." msgstr "유효하지 않은 프로젝트 경로 (뭔가 변경하신 거라도?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "프로젝트 경로에 engine.cfg를 생성할 수 없습니다." +msgid "Couldn't create godot.cfg in project path." +msgstr "프로젝트 경로에 godot.cfg를 생성할 수 없습니다." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6205,8 +6205,8 @@ msgid "Remove Resource Remap Option" msgstr "리소스 리맵핑 옵션 제거" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "프로젝트 설정 (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "프로젝트 설정 (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/nb.po b/tools/editor/translations/nb.po index ff659eae8b..cbd2a09951 100644 --- a/tools/translations/nb.po +++ b/tools/editor/translations/nb.po @@ -3245,7 +3245,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5836,11 +5836,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5852,7 +5852,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6086,7 +6086,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/pl.po b/tools/editor/translations/pl.po index 465fbe133d..50afecad1b 100644 --- a/tools/translations/pl.po +++ b/tools/editor/translations/pl.po @@ -1601,7 +1601,7 @@ msgstr "" #: tools/editor/dependency_editor.cpp msgid "Remove selected files from the project? (no undo)" -msgstr "Usunąć wybrane pliki z projektu? (Nie można tego cofnąć)" +msgstr "Usunąć wybrane pliki z projektu? (Nie można tego cofnąć)" #: tools/editor/dependency_editor.cpp msgid "Error loading:" @@ -3388,8 +3388,8 @@ msgid "Compress" msgstr "Skompresuj" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Dodaj do projektu (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Dodaj do projektu (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -5995,12 +5995,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Niepoprawna ścieżka projektu, ścieżka musi istnieć!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Niepoprawna ścieżka projektu, engine.cfg nie może istnieć." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Niepoprawna ścieżka projektu, godot.cfg nie może istnieć." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Niepoprawna ścieżka projektu, engine.cfg musi istnieć." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Niepoprawna ścieżka projektu, godot.cfg musi istnieć." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6011,8 +6011,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Niepoprawna ścieżka projektu (zmienić cokolwiek?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "Nie można było utworzyć engine.cfg w ścieżce projektu." +msgid "Couldn't create godot.cfg in project path." +msgstr "Nie można było utworzyć godot.cfg w ścieżce projektu." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6245,8 +6245,8 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Ustawienia projektu (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Ustawienia projektu (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" @@ -6884,7 +6884,7 @@ msgstr "Skróty" #: tools/editor/spatial_editor_gizmos.cpp msgid "Change Light Radius" -msgstr "Zmień promień światła" +msgstr "Zmień promień światła" #: tools/editor/spatial_editor_gizmos.cpp msgid "Change Camera FOV" @@ -6912,7 +6912,7 @@ msgstr "Zmień wysokośc Capsule Shape" #: tools/editor/spatial_editor_gizmos.cpp msgid "Change Ray Shape Length" -msgstr "Zmień długość Ray Shape" +msgstr "Zmień długość Ray Shape" #: tools/editor/spatial_editor_gizmos.cpp msgid "Change Notifier Extents" diff --git a/tools/translations/pr.po b/tools/editor/translations/pr.po index f8a9505066..8ea2967a22 100644 --- a/tools/translations/pr.po +++ b/tools/editor/translations/pr.po @@ -3263,7 +3263,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5854,11 +5854,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5870,7 +5870,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6104,7 +6104,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/pt_BR.po b/tools/editor/translations/pt_BR.po index 106142b4ea..9ab81786b1 100644 --- a/tools/translations/pt_BR.po +++ b/tools/editor/translations/pt_BR.po @@ -3388,8 +3388,8 @@ msgid "Compress" msgstr "Comprimir" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Adicionar ao Projeto (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Adicionar ao Projeto (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6012,12 +6012,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Caminho de projeto inválido, o caminho deve existir!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Caminho de projeto inválido, engine.cfg não deve existir." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Caminho de projeto inválido, godot.cfg não deve existir." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Caminho de projeto inválido, engine.cfg deve existir." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Caminho de projeto inválido, godot.cfg deve existir." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6028,8 +6028,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Caminho de projeto inválido (mudou alguma coisa?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "Não se pôde criar engine.cfg no caminho do projeto." +msgid "Couldn't create godot.cfg in project path." +msgstr "Não se pôde criar godot.cfg no caminho do projeto." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6265,8 +6265,8 @@ msgid "Remove Resource Remap Option" msgstr "Remover Opção de Remapeamento de Recurso" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Configurações do Projeto (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Configurações do Projeto (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/pt_PT.po b/tools/editor/translations/pt_PT.po index 7b3c814f8c..da9d971347 100644 --- a/tools/translations/pt_PT.po +++ b/tools/editor/translations/pt_PT.po @@ -3258,7 +3258,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5850,11 +5850,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5866,7 +5866,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6100,7 +6100,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/ru.po b/tools/editor/translations/ru.po index 73262dbd5e..0595a675b3 100644 --- a/tools/translations/ru.po +++ b/tools/editor/translations/ru.po @@ -3391,8 +3391,8 @@ msgid "Compress" msgstr "Сжимать" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Добавить в проект (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Добавить в проект (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -6004,12 +6004,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Неверный путь к проекту, путь должен существовать!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Недопустимый путь к проекту, engine.cfg не должен существовать." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Недопустимый путь к проекту, godot.cfg не должен существовать." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Недопустимый путь к проекту, engine.cfg должен существовать." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Недопустимый путь к проекту, godot.cfg должен существовать." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6020,8 +6020,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Неверный путь к проекту (Что-то изменили?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "Не могу создать engine.cfg в папке проекта." +msgid "Couldn't create godot.cfg in project path." +msgstr "Не могу создать godot.cfg в папке проекта." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6256,8 +6256,8 @@ msgid "Remove Resource Remap Option" msgstr "Удалён параметр ресурса перенаправления" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Настройки проекта (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Настройки проекта (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/sk.po b/tools/editor/translations/sk.po index f1bd9f1300..6aa2e16664 100644 --- a/tools/translations/sk.po +++ b/tools/editor/translations/sk.po @@ -3261,7 +3261,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5857,11 +5857,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5873,7 +5873,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6107,7 +6107,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/sl.po b/tools/editor/translations/sl.po index 12903cba83..4934be97d7 100644 --- a/tools/translations/sl.po +++ b/tools/editor/translations/sl.po @@ -3270,7 +3270,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5862,11 +5862,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5878,7 +5878,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6112,7 +6112,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/tools.pot b/tools/editor/translations/tools.pot index 447067beb3..8e54d88989 100644 --- a/tools/translations/tools.pot +++ b/tools/editor/translations/tools.pot @@ -3239,7 +3239,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5830,11 +5830,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5846,7 +5846,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6080,7 +6080,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/tr.po b/tools/editor/translations/tr.po index b930e302f2..5c0b6ebca8 100644 --- a/tools/translations/tr.po +++ b/tools/editor/translations/tr.po @@ -3382,8 +3382,8 @@ msgid "Compress" msgstr "Sıkıştır" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "Tasarıya Ekle (engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "Tasarıya Ekle (godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -5994,12 +5994,12 @@ msgid "Invalid project path, the path must exist!" msgstr "Geçersiz tasarı yolu, yolun var olması gerekir!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." -msgstr "Geçersiz tasarı yolu, engine.cfg var olmaması gerekir." +msgid "Invalid project path, godot.cfg must not exist." +msgstr "Geçersiz tasarı yolu, godot.cfg var olmaması gerekir." #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." -msgstr "Geçersiz tasarı yolu, engine.cfg var olması gerekir." +msgid "Invalid project path, godot.cfg must exist." +msgstr "Geçersiz tasarı yolu, godot.cfg var olması gerekir." #: tools/editor/project_manager.cpp msgid "Imported Project" @@ -6010,8 +6010,8 @@ msgid "Invalid project path (changed anything?)." msgstr "Geçersiz tasarı yolu (bir şey değişti mi?)." #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "engine.cfg tasarı yolunda oluşturulamadı." +msgid "Couldn't create godot.cfg in project path." +msgstr "godot.cfg tasarı yolunda oluşturulamadı." #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6247,8 +6247,8 @@ msgid "Remove Resource Remap Option" msgstr "Kaynak Yeniden Eşle Seçeneğini Kaldır" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "Tasarı Ayarları (engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "Tasarı Ayarları (godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/ur_PK.po b/tools/editor/translations/ur_PK.po index 0eed08b52a..b898301d0c 100644 --- a/tools/translations/ur_PK.po +++ b/tools/editor/translations/ur_PK.po @@ -3255,7 +3255,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5850,11 +5850,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5866,7 +5866,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6100,7 +6100,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/zh_CN.po b/tools/editor/translations/zh_CN.po index 58f79fac56..47c77f6170 100644 --- a/tools/translations/zh_CN.po +++ b/tools/editor/translations/zh_CN.po @@ -3312,8 +3312,8 @@ msgid "Compress" msgstr "压缩" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" -msgstr "添加到项目(engine.cfg)" +msgid "Add to Project (godot.cfg)" +msgstr "添加到项目(godot.cfg)" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp msgid "Import Languages:" @@ -5912,11 +5912,11 @@ msgid "Invalid project path, the path must exist!" msgstr "项目目录不存在!" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "项目目录下必须包含engin.cfg文件。" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "项目目录下必须包含engin.cfg文件。" #: tools/editor/project_manager.cpp @@ -5928,8 +5928,8 @@ msgid "Invalid project path (changed anything?)." msgstr "项目路径非法(被外部修改?)。" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." -msgstr "无法在项目目录下创建engine.cfg文件。" +msgid "Couldn't create godot.cfg in project path." +msgstr "无法在项目目录下创建godot.cfg文件。" #: tools/editor/project_manager.cpp msgid "The following files failed extraction from package:" @@ -6162,8 +6162,8 @@ msgid "Remove Resource Remap Option" msgstr "移除资源重定向选项" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" -msgstr "项目设置(engine.cfg)" +msgid "Project Settings (godot.cfg)" +msgstr "项目设置(godot.cfg)" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp msgid "General" diff --git a/tools/translations/zh_HK.po b/tools/editor/translations/zh_HK.po index 60f2b51464..b0bb11d527 100644 --- a/tools/translations/zh_HK.po +++ b/tools/editor/translations/zh_HK.po @@ -3272,7 +3272,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5872,11 +5872,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5888,7 +5888,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6122,7 +6122,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp diff --git a/tools/translations/zh_TW.po b/tools/editor/translations/zh_TW.po index efad7ee167..3e9b61ec0f 100644 --- a/tools/translations/zh_TW.po +++ b/tools/editor/translations/zh_TW.po @@ -3259,7 +3259,7 @@ msgid "Compress" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp -msgid "Add to Project (engine.cfg)" +msgid "Add to Project (godot.cfg)" msgstr "" #: tools/editor/io_plugins/editor_translation_import_plugin.cpp @@ -5850,11 +5850,11 @@ msgid "Invalid project path, the path must exist!" msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must not exist." +msgid "Invalid project path, godot.cfg must not exist." msgstr "" #: tools/editor/project_manager.cpp -msgid "Invalid project path, engine.cfg must exist." +msgid "Invalid project path, godot.cfg must exist." msgstr "" #: tools/editor/project_manager.cpp @@ -5866,7 +5866,7 @@ msgid "Invalid project path (changed anything?)." msgstr "" #: tools/editor/project_manager.cpp -msgid "Couldn't create engine.cfg in project path." +msgid "Couldn't create godot.cfg in project path." msgstr "" #: tools/editor/project_manager.cpp @@ -6100,7 +6100,7 @@ msgid "Remove Resource Remap Option" msgstr "" #: tools/editor/project_settings.cpp -msgid "Project Settings (engine.cfg)" +msgid "Project Settings (godot.cfg)" msgstr "" #: tools/editor/project_settings.cpp tools/editor/settings_config_dialog.cpp |