summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct4
-rw-r--r--core/bind/core_bind.cpp25
-rw-r--r--core/bind/core_bind.h6
-rw-r--r--core/class_db.cpp5
-rw-r--r--core/dvector.h2
-rw-r--r--core/error_list.h2
-rw-r--r--core/global_constants.cpp2
-rw-r--r--core/globals.cpp42
-rw-r--r--core/image.cpp57
-rw-r--r--core/image.h2
-rw-r--r--core/input_map.cpp12
-rw-r--r--core/input_map.h2
-rw-r--r--core/io/config_file.cpp5
-rw-r--r--core/io/config_file.h2
-rw-r--r--core/io/resource_format_binary.cpp100
-rw-r--r--core/io/resource_format_binary.h1
-rw-r--r--core/io/resource_import.cpp257
-rw-r--r--core/io/resource_import.h77
-rw-r--r--core/io/resource_loader.cpp145
-rw-r--r--core/io/resource_loader.h9
-rw-r--r--core/object.h1
-rw-r--r--core/os/input.cpp3
-rw-r--r--core/os/input.h3
-rw-r--r--core/os/os.h5
-rw-r--r--core/pair.h9
-rw-r--r--core/path_remap.cpp182
-rw-r--r--core/path_remap.h35
-rw-r--r--core/register_core_types.cpp11
-rw-r--r--core/resource.cpp131
-rw-r--r--core/resource.h54
-rw-r--r--core/safe_refcount.cpp8
-rw-r--r--core/translation.cpp15
-rw-r--r--core/translation.h1
-rw-r--r--core/ustring.cpp11
-rw-r--r--core/ustring.h1
-rw-r--r--core/variant_parser.cpp28
-rw-r--r--core/vector.h2
-rw-r--r--doc/base/classes.xml26
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp3
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp1
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp87
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h6
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp90
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h21
-rw-r--r--drivers/gles3/shader_compiler_gles3.cpp1
-rw-r--r--drivers/gles3/shaders/scene.glsl131
-rw-r--r--drivers/unix/os_unix.cpp8
-rw-r--r--drivers/unix/os_unix.h2
-rw-r--r--main/input_default.cpp15
-rw-r--r--main/main.cpp55
-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-xmisc/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)bin564 -> 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)bin683 -> 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)bin817 -> 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)bin1676 -> 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)bin2582 -> 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)bin2582 -> 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)bin3131 -> 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)bin634 -> 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)bin3070 -> 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)bin589 -> 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)bin515 -> 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)bin309 -> 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)bin250 -> 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)bin253 -> 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)bin253 -> 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)bin259 -> 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)bin260 -> 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)bin265 -> 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)bin242 -> 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)bin240 -> 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)bin243 -> 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)bin243 -> 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)bin243 -> 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)bin244 -> 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)bin244 -> 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)bin246 -> 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)bin245 -> 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)bin262 -> 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)bin247 -> 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-xmisc/dist/ios_xcode/godot_xcode/godot_opt.iphone (renamed from tools/dist/ios_xcode/godot_xcode/godot_opt.iphone)0
-rwxr-xr-xmisc/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)bin120942 -> 120942 bytes
-rwxr-xr-xmisc/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)bin120942 -> 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)bin14919 -> 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)bin7001 -> 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)bin14490 -> 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)bin2067 -> 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)bin3369 -> 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)bin2339 -> 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)bin7390 -> 7390 bytes
-rw-r--r--misc/scripts/addheader.py (renamed from tools/scripts/addheader.py)0
-rwxr-xr-xmisc/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.cpp19
-rw-r--r--modules/gdscript/register_types.cpp7
-rw-r--r--modules/squish/image_compress_squish.cpp5
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp120
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h17
-rw-r--r--modules/stb_vorbis/register_types.cpp11
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.cpp84
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.h28
-rw-r--r--platform/android/build.gradle.template3
-rw-r--r--platform/android/export/export.cpp3
-rw-r--r--platform/bb10/export/export.cpp3
-rw-r--r--platform/javascript/audio_driver_javascript.h2
-rw-r--r--platform/javascript/detect.py13
-rw-r--r--platform/javascript/export/export.cpp8
-rw-r--r--platform/javascript/godot_shell.html16
-rw-r--r--platform/javascript/javascript_eval.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp37
-rw-r--r--platform/javascript/os_javascript.h5
-rw-r--r--platform/osx/export/export.cpp3
-rw-r--r--platform/uwp/export/export.cpp3
-rw-r--r--platform/windows/export/export.cpp3
-rw-r--r--platform/windows/os_windows.cpp41
-rw-r--r--platform/windows/os_windows.h1
-rw-r--r--platform/x11/context_gl_x11.cpp7
-rw-r--r--platform/x11/detect.py25
-rw-r--r--platform/x11/export/export.cpp3
-rw-r--r--platform/x11/os_x11.cpp95
-rw-r--r--platform/x11/os_x11.h2
-rw-r--r--scene/3d/gi_probe.cpp52
-rw-r--r--scene/3d/gi_probe.h11
-rw-r--r--scene/3d/light.cpp3
-rw-r--r--scene/3d/light.h1
-rw-r--r--scene/animation/animation_player.cpp19
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/gui/scroll_container.cpp4
-rw-r--r--scene/gui/text_edit.cpp17
-rw-r--r--scene/gui/text_edit.h1
-rw-r--r--scene/io/resource_format_image.cpp3
-rw-r--r--scene/io/resource_format_image.h3
-rw-r--r--scene/register_scene_types.cpp14
-rw-r--r--scene/resources/audio_stream_sample.cpp557
-rw-r--r--scene/resources/audio_stream_sample.h128
-rw-r--r--scene/resources/scene_format_text.cpp13
-rw-r--r--scene/resources/texture.cpp373
-rw-r--r--scene/resources/texture.h81
-rw-r--r--servers/audio_server.cpp281
-rw-r--r--servers/audio_server.h58
-rw-r--r--servers/physics/joints/generic_6dof_joint_sw.cpp2
-rw-r--r--servers/register_server_types.cpp1
-rw-r--r--servers/visual/rasterizer.h6
-rw-r--r--servers/visual/visual_server_raster.cpp6
-rw-r--r--servers/visual/visual_server_raster.h8
-rw-r--r--servers/visual/visual_server_scene.cpp41
-rw-r--r--servers/visual/visual_server_scene.h3
-rw-r--r--servers/visual_server.h11
-rw-r--r--thirdparty/README.md14
-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)bin190044 -> 190044 bytes
-rw-r--r--thirdparty/fonts/DroidSansArabic.ttf (renamed from tools/editor_fonts/DroidSansArabic.ttf)bin35908 -> 35908 bytes
-rw-r--r--thirdparty/fonts/DroidSansFallback.ttf (renamed from tools/editor_fonts/DroidSansFallback.ttf)bin3640264 -> 3640264 bytes
-rw-r--r--thirdparty/fonts/DroidSansHebrew.ttf (renamed from tools/editor_fonts/DroidSansHebrew.ttf)bin23076 -> 23076 bytes
-rw-r--r--thirdparty/fonts/DroidSansJapanese.ttf (renamed from tools/editor_fonts/DroidSansJapanese.ttf)bin1173140 -> 1173140 bytes
-rw-r--r--thirdparty/fonts/DroidSansThai.ttf (renamed from tools/editor_fonts/DroidSansThai.ttf)bin36028 -> 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)bin140088 -> 140088 bytes
-rw-r--r--tools/SCsub121
-rw-r--r--tools/editor/SCsub148
-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_audio_buses.cpp278
-rw-r--r--tools/editor/editor_audio_buses.h54
-rw-r--r--tools/editor/editor_data.cpp20
-rw-r--r--tools/editor/editor_data.h3
-rw-r--r--tools/editor/editor_file_system.cpp659
-rw-r--r--tools/editor/editor_file_system.h59
-rw-r--r--tools/editor/editor_help.h2
-rw-r--r--tools/editor/editor_import_export.cpp12
-rw-r--r--tools/editor/editor_import_export.h3
-rw-r--r--tools/editor/editor_node.cpp609
-rw-r--r--tools/editor/editor_node.h30
-rw-r--r--tools/editor/editor_plugin.cpp27
-rw-r--r--tools/editor/editor_plugin.h6
-rw-r--r--tools/editor/editor_reimport_dialog.cpp2
-rw-r--r--tools/editor/editor_reimport_dialog.h2
-rw-r--r--tools/editor/editor_run_native.cpp7
-rw-r--r--tools/editor/editor_settings.cpp4
-rw-r--r--tools/editor/fileserver/SCsub2
-rw-r--r--tools/editor/filesystem_dock.cpp135
-rw-r--r--tools/editor/filesystem_dock.h9
-rw-r--r--tools/editor/icons/2x/icon_transparent.pngbin0 -> 177 bytes
-rw-r--r--tools/editor/icons/SCsub2
-rw-r--r--tools/editor/icons/icon_transparent.pngbin0 -> 158 bytes
-rw-r--r--tools/editor/import/SCsub5
-rw-r--r--tools/editor/import/editor_import_collada.cpp (renamed from tools/editor/io_plugins/editor_import_collada.cpp)60
-rw-r--r--tools/editor/import/editor_import_collada.h (renamed from tools/editor/io_plugins/editor_import_collada.h)2
-rw-r--r--tools/editor/import/resource_importer_csv_translation.cpp126
-rw-r--r--tools/editor/import/resource_importer_csv_translation.h27
-rw-r--r--tools/editor/import/resource_importer_obj.cpp231
-rw-r--r--tools/editor/import/resource_importer_obj.h28
-rw-r--r--tools/editor/import/resource_importer_scene.cpp1328
-rw-r--r--tools/editor/import/resource_importer_scene.h93
-rw-r--r--tools/editor/import/resource_importer_texture.cpp393
-rw-r--r--tools/editor/import/resource_importer_texture.h70
-rw-r--r--tools/editor/import/resource_importer_wav.cpp619
-rw-r--r--tools/editor/import/resource_importer_wav.h30
-rw-r--r--tools/editor/import_dock.cpp331
-rw-r--r--tools/editor/import_dock.h42
-rw-r--r--tools/editor/io_plugins/SCsub2
-rw-r--r--tools/editor/io_plugins/editor_bitmask_import_plugin.cpp3
-rw-r--r--tools/editor/io_plugins/editor_bitmask_import_plugin.h3
-rw-r--r--tools/editor/io_plugins/editor_export_scene.cpp3
-rw-r--r--tools/editor/io_plugins/editor_export_scene.h4
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.cpp3
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.h3
-rw-r--r--tools/editor/io_plugins/editor_mesh_import_plugin.cpp3
-rw-r--r--tools/editor/io_plugins/editor_mesh_import_plugin.h3
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp3
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.h4
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp3
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.h7
-rw-r--r--tools/editor/io_plugins/editor_translation_import_plugin.cpp5
-rw-r--r--tools/editor/io_plugins/editor_translation_import_plugin.h3
-rw-r--r--tools/editor/plugins/SCsub2
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp27
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.h2
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.h4
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp43
-rw-r--r--tools/editor/plugins/script_editor_plugin.h11
-rw-r--r--tools/editor/plugins/script_text_editor.cpp1
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp90
-rw-r--r--tools/editor/project_export.cpp9
-rw-r--r--tools/editor/project_export.h2
-rw-r--r--tools/editor/project_manager.cpp22
-rw-r--r--tools/editor/project_settings.cpp6
-rw-r--r--tools/editor/property_editor.cpp72
-rw-r--r--tools/editor/property_editor.h5
-rw-r--r--tools/editor/scene_tree_dock.cpp12
-rw-r--r--tools/editor/spatial_editor_gizmos.cpp4
-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-xtools/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
295 files changed, 7855 insertions, 2520 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/bind/core_bind.cpp b/core/bind/core_bind.cpp
index 954ebbc30c..636a3f07c1 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -106,17 +106,12 @@ bool _ResourceLoader::has(const String &p_path) {
return ResourceCache::has(local_path);
};
-Ref<ResourceImportMetadata> _ResourceLoader::load_import_metadata(const String& p_path) {
-
- return ResourceLoader::load_import_metadata(p_path);
-}
void _ResourceLoader::_bind_methods() {
ClassDB::bind_method(_MD("load_interactive:ResourceInteractiveLoader","path","type_hint"),&_ResourceLoader::load_interactive,DEFVAL(""));
ClassDB::bind_method(_MD("load:Resource","path","type_hint", "p_no_cache"),&_ResourceLoader::load,DEFVAL(""), DEFVAL(false));
- ClassDB::bind_method(_MD("load_import_metadata:ResourceImportMetadata","path"),&_ResourceLoader::load_import_metadata);
ClassDB::bind_method(_MD("get_recognized_extensions_for_type","type"),&_ResourceLoader::get_recognized_extensions_for_type);
ClassDB::bind_method(_MD("set_abort_on_missing_resources","abort"),&_ResourceLoader::set_abort_on_missing_resources);
ClassDB::bind_method(_MD("get_dependencies","path"),&_ResourceLoader::get_dependencies);
@@ -1825,16 +1820,28 @@ Error _Directory::open(const String& p_path) {
return OK;
}
-Error _Directory::list_dir_begin() {
+Error _Directory::list_dir_begin(bool p_skip_navigational, bool p_skip_hidden) {
ERR_FAIL_COND_V(!d,ERR_UNCONFIGURED);
+
+ _list_skip_navigational = p_skip_navigational;
+ _list_skip_hidden = p_skip_hidden;
+
return d->list_dir_begin();
}
String _Directory::get_next(){
ERR_FAIL_COND_V(!d,"");
- return d->get_next();
+
+ String next = d->get_next();
+ while (next != ""
+ && ((_list_skip_navigational && (next == "." || next == ".."))
+ || (_list_skip_hidden && d->current_is_hidden()))) {
+
+ next = d->get_next();
+ }
+ return next;
}
bool _Directory::current_is_dir() const{
@@ -1964,7 +1971,7 @@ void _Directory::_bind_methods() {
ClassDB::bind_method(_MD("open:Error","path"),&_Directory::open);
- ClassDB::bind_method(_MD("list_dir_begin"),&_Directory::list_dir_begin);
+ ClassDB::bind_method(_MD("list_dir_begin", "skip_navigational", "skip_hidden"), &_Directory::list_dir_begin, DEFVAL(false), DEFVAL(false));
ClassDB::bind_method(_MD("get_next"),&_Directory::get_next);
ClassDB::bind_method(_MD("current_is_dir"),&_Directory::current_is_dir);
ClassDB::bind_method(_MD("list_dir_end"),&_Directory::list_dir_end);
@@ -2505,7 +2512,7 @@ void _ClassDB::_bind_methods() {
ClassDB::bind_method(_MD("class_exists","class"),&_ClassDB::class_exists);
ClassDB::bind_method(_MD("is_parent_class","class","inherits"),&_ClassDB::is_parent_class);
ClassDB::bind_method(_MD("can_instance","class"),&_ClassDB::can_instance);
- ClassDB::bind_method(_MD("instance","class"),&_ClassDB::instance);
+ ClassDB::bind_method(_MD("instance:Variant","class"),&_ClassDB::instance);
ClassDB::bind_method(_MD("class_has_signal","class","signal"),&_ClassDB::has_signal);
ClassDB::bind_method(_MD("class_get_signal","class","signal"),&_ClassDB::get_signal);
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index fe710704f2..00cbb254d6 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -54,7 +54,6 @@ public:
void set_abort_on_missing_resources(bool p_abort);
PoolStringArray get_dependencies(const String& p_path);
bool has(const String& p_path);
- Ref<ResourceImportMetadata> load_import_metadata(const String& p_path);
_ResourceLoader();
};
@@ -458,7 +457,7 @@ public:
Error open(const String& p_path);
- Error list_dir_begin(); ///< This starts dir listing
+ Error list_dir_begin(bool p_skip_internal = false, bool p_skip_hidden = false); ///< This starts dir listing
String get_next();
bool current_is_dir() const;
@@ -487,6 +486,9 @@ public:
_Directory();
virtual ~_Directory();
+private:
+ bool _list_skip_navigational;
+ bool _list_skip_hidden;
};
class _Marshalls : public Reference {
diff --git a/core/class_db.cpp b/core/class_db.cpp
index bb3368c128..2a3a12b127 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -33,6 +33,7 @@
#ifdef NO_THREADS
#define OBJTYPE_RLOCK
+#define OBJTYPE_WLOCK
#else
@@ -776,11 +777,15 @@ void ClassDB::add_property(StringName p_class,const PropertyInfo& p_pinfo, const
+#ifndef NO_THREADS
lock->read_lock();
+#endif
ClassInfo *type=classes.getptr(p_class);
+#ifndef NO_THREADS
lock->read_unlock();
+#endif
ERR_FAIL_COND(!type);
diff --git a/core/dvector.h b/core/dvector.h
index cac9e8ef85..53a29738f7 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -89,7 +89,7 @@ class PoolVector {
if (!alloc)
return;
- ERR_FAIL_COND(alloc->lock>0);
+// ERR_FAIL_COND(alloc->lock>0); should not be illegal to lock this for copy on write, as it's a copy on write after all
if (alloc->refcount.get()==1)
return; //nothing to do
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 ed505b0f77..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()");
@@ -2155,7 +2152,7 @@ void Image::fix_alpha_edges() {
return; //not needed
PoolVector<uint8_t> dcopy = data;
- PoolVector<uint8_t>::Read rp = data.read();
+ PoolVector<uint8_t>::Read rp = dcopy.read();
const uint8_t *srcptr=rp.ptr();
PoolVector<uint8_t>::Write wp = data.write();
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/input_map.cpp b/core/input_map.cpp
index 8473bce806..dcce13ba1b 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -107,7 +107,7 @@ List<StringName> InputMap::get_actions() const {
return actions;
}
-List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const InputEvent& p_event, bool p_mod_ignore=false) const {
+List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const InputEvent& p_event, bool p_action_test) const {
for (List<InputEvent>::Element *E=p_list.front();E;E=E->next()) {
@@ -123,7 +123,13 @@ List<InputEvent>::Element *InputMap::_find_event(List<InputEvent> &p_list,const
case InputEvent::KEY: {
- same=(e.key.scancode==p_event.key.scancode && (p_mod_ignore || e.key.mod == p_event.key.mod));
+ if(p_action_test) {
+ uint32_t code = e.key.get_scancode_with_modifiers();
+ uint32_t event_code = p_event.key.get_scancode_with_modifiers();
+ same=(e.key.scancode==p_event.key.scancode && (!p_event.key.pressed || ((code & event_code) == code)));
+ } else {
+ same=(e.key.scancode==p_event.key.scancode && e.key.mod == p_event.key.mod);
+ }
} break;
case InputEvent::JOYPAD_BUTTON: {
@@ -230,7 +236,7 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac
return p_event.action.action==E->get().id;
}
- return _find_event(E->get().inputs,p_event,!p_event.is_pressed())!=NULL;
+ return _find_event(E->get().inputs,p_event,true)!=NULL;
}
const Map<StringName, InputMap::Action>& InputMap::get_action_map() const {
diff --git a/core/input_map.h b/core/input_map.h
index 306845fc89..6ccd24f29c 100644
--- a/core/input_map.h
+++ b/core/input_map.h
@@ -46,7 +46,7 @@ private:
mutable Map<StringName, Action> input_map;
mutable Map<int,StringName> input_id_map;
- List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event, bool p_mod_ignore) const;
+ List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event, bool p_action_test=false) const;
Array _get_action_list(const StringName& p_action);
Array _get_actions();
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index a9de740806..b944906e78 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -119,7 +119,10 @@ void ConfigFile::get_section_keys(const String& p_section,List<String> *r_keys)
}
+void ConfigFile::erase_section(const String& p_section) {
+ values.erase(p_section);
+}
Error ConfigFile::save(const String& p_path){
@@ -215,6 +218,8 @@ void ConfigFile::_bind_methods(){
ClassDB::bind_method(_MD("get_sections"),&ConfigFile::_get_sections);
ClassDB::bind_method(_MD("get_section_keys","section"),&ConfigFile::_get_section_keys);
+ ClassDB::bind_method(_MD("erase_section","section"),&ConfigFile::erase_section);
+
ClassDB::bind_method(_MD("load:Error","path"),&ConfigFile::load);
ClassDB::bind_method(_MD("save:Error","path"),&ConfigFile::save);
diff --git a/core/io/config_file.h b/core/io/config_file.h
index 397342f90f..c9c4a9fbc0 100644
--- a/core/io/config_file.h
+++ b/core/io/config_file.h
@@ -54,6 +54,8 @@ public:
void get_sections(List<String> *r_sections) const;
void get_section_keys(const String& p_section,List<String> *r_keys) const;
+ void erase_section(const String& p_section);
+
Error save(const String& p_path);
Error load(const String& p_path);
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 4af3503434..c75e476764 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -80,7 +80,8 @@ enum {
OBJECT_EXTERNAL_RESOURCE=1,
OBJECT_INTERNAL_RESOURCE=2,
OBJECT_EXTERNAL_RESOURCE_INDEX=3,
- FORMAT_VERSION=1,
+ //version 2: added 64 bits support for float and int
+ FORMAT_VERSION=2,
FORMAT_VERSION_CAN_RENAME_DEPS=1
@@ -758,30 +759,7 @@ Error ResourceInteractiveLoaderBinary::poll(){
resource_cache.push_back(res);
if (main) {
- if (importmd_ofs) {
- f->seek(importmd_ofs);
- Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
- imd->set_editor(get_unicode_string());
- int sc = f->get_32();
- for(int i=0;i<sc;i++) {
-
- String src = get_unicode_string();
- String md5 = get_unicode_string();
- imd->add_source(src,md5);
- }
- int pc = f->get_32();
-
- for(int i=0;i<pc;i++) {
-
- String name = get_unicode_string();
- Variant val;
- parse_variant(val);
- imd->set_option(name,val);
- }
- res->set_import_metadata(imd);
-
- }
f->close();
resource=res;
error=ERR_FILE_EOF;
@@ -848,9 +826,6 @@ void ResourceInteractiveLoaderBinary::get_dependencies(FileAccess *p_f,List<Stri
for(int i=0;i<external_resources.size();i++) {
String dep=external_resources[i].path;
- if (dep.ends_with("*")) {
- dep=ResourceLoader::guess_full_filename(dep,external_resources[i].type);
- }
if (p_add_types && external_resources[i].type!=String()) {
dep+="::"+external_resources[i].type;
@@ -1103,53 +1078,6 @@ bool ResourceFormatLoaderBinary::handles_type(const String& p_type) const{
return true; //handles all
}
-Error ResourceFormatLoaderBinary::load_import_metadata(const String &p_path, Ref<ResourceImportMetadata>& r_var) const {
-
-
- FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
- if (!f) {
- return ERR_FILE_CANT_OPEN;
- }
-
- Ref<ResourceInteractiveLoaderBinary> ria = memnew( ResourceInteractiveLoaderBinary );
- ria->local_path=GlobalConfig::get_singleton()->localize_path(p_path);
- ria->res_path=ria->local_path;
- //ria->set_local_path( Globals::get_singleton()->localize_path(p_path) );
- ria->recognize(f);
- if(ria->error!=OK)
- return ERR_FILE_UNRECOGNIZED;
- f=ria->f;
- uint64_t imp_ofs = f->get_64();
-
- if (imp_ofs==0)
- return ERR_UNAVAILABLE;
-
- f->seek(imp_ofs);
- Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
- imd->set_editor(ria->get_unicode_string());
- int sc = f->get_32();
- for(int i=0;i<sc;i++) {
-
- String src = ria->get_unicode_string();
- String md5 = ria->get_unicode_string();
- imd->add_source(src,md5);
- }
- int pc = f->get_32();
-
- for(int i=0;i<pc;i++) {
-
- String name = ria->get_unicode_string();
- Variant val;
- ria->parse_variant(val);
- imd->set_option(name,val);
- }
-
- r_var=imd;
-
- return OK;
-
-}
-
void ResourceFormatLoaderBinary::get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types) {
@@ -2178,30 +2106,6 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
}
f->seek_end();
- print_line("SAVING: "+p_path);
- if (p_resource->get_import_metadata().is_valid()) {
- uint64_t md_pos = f->get_pos();
- Ref<ResourceImportMetadata> imd=p_resource->get_import_metadata();
- save_unicode_string(imd->get_editor());
- f->store_32(imd->get_source_count());
- for(int i=0;i<imd->get_source_count();i++) {
- save_unicode_string(imd->get_source_path(i));
- save_unicode_string(imd->get_source_md5(i));
- print_line("SAVE PATH: "+imd->get_source_path(i));
- print_line("SAVE MD5: "+imd->get_source_md5(i));
- }
- List<String> options;
- imd->get_options(&options);
- f->store_32(options.size());
- for(List<String>::Element *E=options.front();E;E=E->next()) {
- save_unicode_string(E->get());
- write_variant(imd->get_option(E->get()));
- }
-
- f->seek(md_at);
- f->store_64(md_pos);
- f->seek_end();
- }
f->store_buffer((const uint8_t*)"RSRC",4); //magic at end
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index 611029e792..1dac51cc5c 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -109,7 +109,6 @@ public:
virtual bool handles_type(const String& p_type) const;
virtual String get_resource_type(const String &p_path) const;
virtual void get_dependencies(const String& p_path, List<String> *p_dependencies, bool p_add_types=false);
- virtual Error load_import_metadata(const String &p_path, Ref<ResourceImportMetadata>& r_var) const;
virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map);
diff --git a/core/io/resource_import.cpp b/core/io/resource_import.cpp
new file mode 100644
index 0000000000..556dff3125
--- /dev/null
+++ b/core/io/resource_import.cpp
@@ -0,0 +1,257 @@
+#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 {
+
+ Error err;
+ FileAccess *f= FileAccess::open(p_path+".import",FileAccess::READ,&err);
+
+ if (!f)
+ return err;
+
+ VariantParser::StreamFile stream;
+ stream.f=f;
+
+ String assign;
+ Variant value;
+ VariantParser::Tag next_tag;
+
+ int lines=0;
+ String error_text;
+ while(true) {
+
+ assign=Variant();
+ next_tag.fields.clear();
+ next_tag.name=String();
+
+ err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
+ if (err==ERR_FILE_EOF) {
+ memdelete(f);
+ return OK;
+ }
+ else if (err!=OK) {
+ ERR_PRINTS("ResourceFormatImporter::load - "+p_path+".import:"+itos(lines)+" error: "+error_text);
+ memdelete(f);
+ return err;
+ }
+
+ if (assign!=String()) {
+ 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;
+ }
+
+ } else if (next_tag.name!="remap") {
+ break;
+ }
+ }
+
+ memdelete(f);
+
+ if (r_path_and_type.path==String() || r_path_and_type.type==String()) {
+ return ERR_FILE_CORRUPT;
+ }
+ return OK;
+
+}
+
+
+RES ResourceFormatImporter::load(const String &p_path,const String& p_original_path,Error *r_error) {
+
+ PathAndType pat;
+ Error err = _get_path_and_type(p_path,pat);
+
+ if (err!=OK) {
+
+ if (r_error)
+ *r_error=err;
+
+ return RES();
+ }
+
+
+ RES res = ResourceLoader::load(pat.path,pat.type,false,r_error);
+
+#ifdef TOOLS_ENABLED
+ res->set_import_last_modified_time( res->get_last_modified_time() ); //pass this, if used
+ res->set_import_path(pat.path);
+#endif
+
+ return res;
+
+}
+
+void ResourceFormatImporter::get_recognized_extensions(List<String> *p_extensions) const{
+
+ Set<String> found;
+
+ for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
+ List<String> local_exts;
+ E->get()->get_recognized_extensions(&local_exts);
+ for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
+ if (!found.has(F->get())) {
+ p_extensions->push_back(F->get());
+ found.insert(F->get());
+ }
+ }
+ }
+}
+
+void ResourceFormatImporter::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const{
+
+ if (p_type=="") {
+ return get_recognized_extensions(p_extensions);
+ }
+
+ Set<String> found;
+
+ for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
+ String res_type = E->get()->get_resource_type();
+ if (res_type==String())
+ continue;
+
+ if (!ClassDB::is_parent_class(res_type,p_type))
+ continue;
+
+ List<String> local_exts;
+ E->get()->get_recognized_extensions(&local_exts);
+ for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
+ if (!found.has(F->get())) {
+ p_extensions->push_back(F->get());
+ found.insert(F->get());
+ }
+ }
+ }
+}
+
+bool ResourceFormatImporter::recognize_path(const String& p_path,const String& p_for_type) const{
+
+ return FileAccess::exists(p_path+".import");
+
+}
+
+bool ResourceFormatImporter::can_be_imported(const String& p_path) const {
+
+ return ResourceFormatLoader::recognize_path(p_path);
+}
+
+
+bool ResourceFormatImporter::handles_type(const String& p_type) const {
+
+ for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
+
+ String res_type = E->get()->get_resource_type();
+ if (res_type==String())
+ continue;
+ if (ClassDB::is_parent_class(res_type,p_type))
+ return true;
+
+ }
+
+ 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;
+ Error err = _get_path_and_type(p_path,pat);
+
+ if (err!=OK) {
+
+ return "";
+ }
+
+ return pat.type;
+}
+
+void ResourceFormatImporter::get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types){
+
+ PathAndType pat;
+ Error err = _get_path_and_type(p_path,pat);
+
+ if (err!=OK) {
+
+ return;
+ }
+
+ return ResourceLoader::get_dependencies(pat.path,p_dependencies,p_add_types);
+}
+
+Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_name(const String& p_name) {
+
+ for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
+ if (E->get()->get_importer_name()==p_name) {
+ return E->get();
+ }
+ }
+
+ return Ref<ResourceImporter>();
+}
+
+
+void ResourceFormatImporter::get_importers_for_extension(const String& p_extension,List<Ref<ResourceImporter> > *r_importers) {
+
+ for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
+ List<String> local_exts;
+ E->get()->get_recognized_extensions(&local_exts);
+ for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
+ if (p_extension.to_lower()==F->get()) {
+ r_importers->push_back(E->get());
+ }
+ }
+ }
+}
+
+Ref<ResourceImporter> ResourceFormatImporter::get_importer_by_extension(const String& p_extension) {
+
+
+ Ref<ResourceImporter> importer;
+ float priority=0;
+
+ for (Set< Ref<ResourceImporter> >::Element *E=importers.front();E;E=E->next()) {
+
+ List<String> local_exts;
+ E->get()->get_recognized_extensions(&local_exts);
+ for (List<String>::Element *F=local_exts.front();F;F=F->next()) {
+ if (p_extension.to_lower()==F->get() && E->get()->get_priority() > priority) {
+ importer=E->get();
+ priority=E->get()->get_priority();
+ }
+ }
+ }
+
+ return importer;
+}
+
+String ResourceFormatImporter::get_import_base_path(const String& p_for_file) const {
+
+ return "res://.import/"+p_for_file.get_file()+"-"+p_for_file.md5_text();
+}
+
+ResourceFormatImporter *ResourceFormatImporter::singleton=NULL;
+
+ResourceFormatImporter::ResourceFormatImporter() {
+ singleton=this;
+}
diff --git a/core/io/resource_import.h b/core/io/resource_import.h
new file mode 100644
index 0000000000..387b3902fe
--- /dev/null
+++ b/core/io/resource_import.h
@@ -0,0 +1,77 @@
+#ifndef RESOURCE_IMPORT_H
+#define RESOURCE_IMPORT_H
+
+
+#include "io/resource_loader.h"
+class ResourceImporter;
+
+class ResourceFormatImporter : public ResourceFormatLoader {
+
+ struct PathAndType {
+ String path;
+ String type;
+ };
+
+
+ Error _get_path_and_type(const String& p_path,PathAndType & r_path_and_type) const;
+
+ static ResourceFormatImporter *singleton;
+
+ Set< Ref<ResourceImporter> > importers;
+public:
+
+ static ResourceFormatImporter *get_singleton() { return singleton; }
+ 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 void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const;
+ virtual bool recognize_path(const String& p_path,const String& p_for_type=String()) const;
+ virtual bool handles_type(const String& p_type) const;
+ virtual String get_resource_type(const String &p_path) const;
+ virtual void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false);
+
+ 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);
+ Ref<ResourceImporter> get_importer_by_extension(const String& p_extension);
+ void get_importers_for_extension(const String& p_extension,List<Ref<ResourceImporter> > *r_importers);
+
+ String get_import_base_path(const String& p_for_file) const;
+ ResourceFormatImporter();
+};
+
+
+class ResourceImporter : public Reference {
+
+ GDCLASS(ResourceImporter,Reference)
+public:
+ virtual String get_importer_name() const=0;
+ virtual String get_visible_name() const=0;
+ virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
+ virtual String get_save_extension() const=0;
+ virtual String get_resource_type() const=0;
+ virtual float get_priority() const { return 1.0; }
+
+ struct ImportOption {
+ PropertyInfo option;
+ Variant default_value;
+
+ ImportOption(const PropertyInfo& p_info,const Variant& p_default) { option=p_info; default_value=p_default; }
+ ImportOption() {}
+ };
+
+
+ virtual int get_preset_count() const { return 0; }
+ virtual String get_preset_name(int p_idx) const { return String(); }
+
+ virtual void get_import_options(List<ImportOption> *r_options,int p_preset=0) const=0;
+ virtual bool get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const=0;
+
+
+ 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)=0;
+
+};
+
+#endif // RESOURCE_IMPORT_H
diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp
index 354efaa83f..fbf6a2cea2 100644
--- a/core/io/resource_loader.cpp
+++ b/core/io/resource_loader.cpp
@@ -47,21 +47,29 @@ Error ResourceInteractiveLoader::wait() {
return err;
}
+bool ResourceFormatLoader::recognize_path(const String& p_path,const String& p_for_type) const {
-bool ResourceFormatLoader::recognize(const String& p_extension) const {
+ String extension = p_path.get_extension();
List<String> extensions;
- get_recognized_extensions(&extensions);
+ if (p_for_type==String()) {
+ get_recognized_extensions(&extensions);
+ } else {
+ get_recognized_extensions_for_type(p_for_type,&extensions);
+ }
+
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
- if (E->get().nocasecmp_to(p_extension.get_extension())==0)
+ if (E->get().nocasecmp_to(extension)==0)
return true;
}
return false;
+
}
+
void ResourceFormatLoader::get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const {
if (p_type=="" || handles_type(p_type))
@@ -166,7 +174,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
- local_path=find_complete_path(local_path,p_type_hint);
+
ERR_FAIL_COND_V(local_path=="",RES());
if (!p_no_cache && ResourceCache::has(local_path)) {
@@ -177,22 +185,16 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
return RES( ResourceCache::get(local_path ) );
}
- String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
-
if (OS::get_singleton()->is_stdout_verbose())
- print_line("load resource: "+remapped_path);
-
- String extension=remapped_path.get_extension();
+ print_line("load resource: "+local_path);
bool found=false;
for (int i=0;i<loader_count;i++) {
- if (!loader[i]->recognize(extension))
- continue;
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
+ if (!loader[i]->recognize_path(local_path,p_type_hint))
continue;
found=true;
- RES res = loader[i]->load(remapped_path,local_path,r_error);
+ RES res = loader[i]->load(local_path,local_path,r_error);
if (res.is_null())
continue;
if (!p_no_cache)
@@ -201,7 +203,7 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
res->set_edited(false);
if (timestamp_on_load) {
- uint64_t mt = FileAccess::get_modified_time(remapped_path);
+ uint64_t mt = FileAccess::get_modified_time(local_path);
//printf("mt %s: %lli\n",remapped_path.utf8().get_data(),mt);
res->set_last_modified_time(mt);
}
@@ -220,82 +222,6 @@ RES ResourceLoader::load(const String &p_path, const String& p_type_hint, bool p
}
-Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p_path) {
-
-
-
- String local_path;
- if (p_path.is_rel_path())
- local_path="res://"+p_path;
- else
- local_path = GlobalConfig::get_singleton()->localize_path(p_path);
-
- String extension=p_path.get_extension();
- Ref<ResourceImportMetadata> ret;
-
- for (int i=0;i<loader_count;i++) {
-
- if (!loader[i]->recognize(extension))
- continue;
-
- Error err = loader[i]->load_import_metadata(local_path,ret);
- if (err==OK)
- break;
- }
-
-
- return ret;
-
-}
-
-
-
-String ResourceLoader::find_complete_path(const String& p_path,const String& p_type) {
- //this is an old vestige when the engine saved files without extension.
- //remains here for compatibility with old projects and only because it
- //can be sometimes nice to open files using .* from a script and have it guess
- //the right extension.
-
- String local_path = p_path;
- if (local_path.ends_with("*")) {
-
- //find the extension for resource that ends with *
- local_path = local_path.substr(0,local_path.length()-1);
- List<String> extensions;
- get_recognized_extensions_for_type(p_type,&extensions);
- List<String> candidates;
-
- for(List<String>::Element *E=extensions.front();E;E=E->next()) {
-
- String path = local_path+E->get();
-
- if (PathRemap::get_singleton()->has_remap(path) || FileAccess::exists(path)) {
- candidates.push_back(path);
- }
-
- }
-
-
- if (candidates.size()==0) {
- return "";
- } else if (candidates.size()==1 || p_type=="") {
- return candidates.front()->get();
- } else {
-
- for(List<String>::Element *E=candidates.front();E;E=E->next()) {
-
- String rt = get_resource_type(E->get());
- if (ClassDB::is_parent_class(rt,p_type)) {
- return E->get();
- }
- }
-
- return "";
- }
- }
-
- return local_path;
-}
Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_path,const String& p_type_hint,bool p_no_cache,Error *r_error) {
@@ -309,7 +235,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
- local_path=find_complete_path(local_path,p_type_hint);
+
ERR_FAIL_COND_V(local_path=="",Ref<ResourceInteractiveLoader>());
@@ -329,19 +255,14 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_
if (OS::get_singleton()->is_stdout_verbose())
print_line("load resource: ");
- String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
-
- String extension=remapped_path.get_extension();
bool found=false;
for (int i=0;i<loader_count;i++) {
- if (!loader[i]->recognize(extension))
- continue;
- if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
+ if (!loader[i]->recognize_path(local_path,p_type_hint))
continue;
found=true;
- Ref<ResourceInteractiveLoader> ril = loader[i]->load_interactive(remapped_path,r_error);
+ Ref<ResourceInteractiveLoader> ril = loader[i]->load_interactive(local_path,r_error);
if (ril.is_null())
continue;
if (!p_no_cache)
@@ -383,20 +304,16 @@ void ResourceLoader::get_dependencies(const String& p_path, List<String> *p_depe
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
- String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
-
- String extension=remapped_path.get_extension();
-
for (int i=0;i<loader_count;i++) {
- if (!loader[i]->recognize(extension))
+ if (!loader[i]->recognize_path(local_path))
continue;
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/
- loader[i]->get_dependencies(remapped_path,p_dependencies,p_add_types);
+ loader[i]->get_dependencies(local_path,p_dependencies,p_add_types);
}
}
@@ -410,20 +327,17 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String,
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
- String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
-
- String extension=remapped_path.get_extension();
for (int i=0;i<loader_count;i++) {
- if (!loader[i]->recognize(extension))
+ if (!loader[i]->recognize_path(local_path))
continue;
/*
if (p_type_hint!="" && !loader[i]->handles_type(p_type_hint))
continue;
*/
- return loader[i]->rename_dependencies(p_path,p_map);
+ return loader[i]->rename_dependencies(local_path,p_map);
}
@@ -432,17 +346,6 @@ Error ResourceLoader::rename_dependencies(const String &p_path,const Map<String,
}
-String ResourceLoader::guess_full_filename(const String &p_path,const String& p_type) {
-
- String local_path;
- if (p_path.is_rel_path())
- local_path="res://"+p_path;
- else
- local_path = GlobalConfig::get_singleton()->localize_path(p_path);
-
- return find_complete_path(local_path,p_type);
-
-}
String ResourceLoader::get_resource_type(const String &p_path) {
@@ -452,8 +355,6 @@ String ResourceLoader::get_resource_type(const String &p_path) {
else
local_path = GlobalConfig::get_singleton()->localize_path(p_path);
- String remapped_path = PathRemap::get_singleton()->get_remap(local_path);
- String extension=remapped_path.get_extension();
for (int i=0;i<loader_count;i++) {
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index 7979bd02a7..f464415e12 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -61,11 +61,10 @@ 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=0;
virtual void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions) const;
- bool recognize(const String& p_extension) const;
+ virtual bool recognize_path(const String& p_path,const String& p_for_type=String()) const;
virtual bool handles_type(const String& p_type) const=0;
virtual String get_resource_type(const String &p_path) const=0;
virtual void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false);
- virtual Error load_import_metadata(const String &p_path, Ref<ResourceImportMetadata>& r_var) const { return ERR_UNAVAILABLE; }
virtual Error rename_dependencies(const String &p_path,const Map<String,String>& p_map) { return OK; }
virtual ~ResourceFormatLoader() {}
@@ -92,14 +91,12 @@ class ResourceLoader {
static DependencyErrorNotify dep_err_notify;
static bool abort_on_missing_resource;
- static String find_complete_path(const String& p_path,const String& p_type);
public:
static Ref<ResourceInteractiveLoader> load_interactive(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL);
static RES load(const String &p_path,const String& p_type_hint="",bool p_no_cache=false,Error *r_error=NULL);
- static Ref<ResourceImportMetadata> load_import_metadata(const String &p_path);
static void get_recognized_extensions_for_type(const String& p_type,List<String> *p_extensions);
static void add_resource_format_loader(ResourceFormatLoader *p_format_loader,bool p_at_front=false);
@@ -107,8 +104,6 @@ public:
static void get_dependencies(const String& p_path,List<String> *p_dependencies,bool p_add_types=false);
static Error rename_dependencies(const String &p_path,const Map<String,String>& p_map);
- static String guess_full_filename(const String &p_path,const String& p_type);
-
static void set_timestamp_on_load(bool p_timestamp) { timestamp_on_load=p_timestamp; }
static void notify_load_error(const String& p_err) { if (err_notify) err_notify(err_notify_ud,p_err); }
@@ -122,4 +117,6 @@ public:
static bool get_abort_on_missing_resources() { return abort_on_missing_resource; }
};
+
+
#endif
diff --git a/core/object.h b/core/object.h
index b9a800afc4..3032452ccf 100644
--- a/core/object.h
+++ b/core/object.h
@@ -103,6 +103,7 @@ enum PropertyUsageFlags {
PROPERTY_USAGE_SCRIPT_VARIABLE=8192,
PROPERTY_USAGE_STORE_IF_NULL=16384,
PROPERTY_USAGE_ANIMATE_AS_TRIGGER=32768,
+ PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED=65536,
PROPERTY_USAGE_DEFAULT=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK,
PROPERTY_USAGE_DEFAULT_INTL=PROPERTY_USAGE_STORAGE|PROPERTY_USAGE_EDITOR|PROPERTY_USAGE_NETWORK|PROPERTY_USAGE_INTERNATIONALIZED,
diff --git a/core/os/input.cpp b/core/os/input.cpp
index e53aa82b13..4e7b037453 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -38,7 +38,7 @@ Input *Input::get_singleton() {
}
void Input::set_mouse_mode(MouseMode p_mode) {
- ERR_FAIL_INDEX(p_mode,3);
+ ERR_FAIL_INDEX(p_mode,4);
OS::get_singleton()->set_mouse_mode((OS::MouseMode)p_mode);
}
@@ -87,6 +87,7 @@ void Input::_bind_methods() {
BIND_CONSTANT( MOUSE_MODE_VISIBLE );
BIND_CONSTANT( MOUSE_MODE_HIDDEN );
BIND_CONSTANT( MOUSE_MODE_CAPTURED );
+ BIND_CONSTANT( MOUSE_MODE_CONFINED );
ADD_SIGNAL( MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected")) );
}
diff --git a/core/os/input.h b/core/os/input.h
index 82c7a80d3f..2cea154a50 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -47,7 +47,8 @@ public:
enum MouseMode {
MOUSE_MODE_VISIBLE,
MOUSE_MODE_HIDDEN,
- MOUSE_MODE_CAPTURED
+ MOUSE_MODE_CAPTURED,
+ MOUSE_MODE_CONFINED
};
void set_mouse_mode(MouseMode p_mode);
diff --git a/core/os/os.h b/core/os/os.h
index ea03481a92..e179b82dae 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -131,7 +131,8 @@ public:
enum MouseMode {
MOUSE_MODE_VISIBLE,
MOUSE_MODE_HIDDEN,
- MOUSE_MODE_CAPTURED
+ MOUSE_MODE_CAPTURED,
+ MOUSE_MODE_CONFINED
};
virtual void set_mouse_mode(MouseMode p_mode);
@@ -402,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/pair.h b/core/pair.h
index d75cbed642..174ffb3883 100644
--- a/core/pair.h
+++ b/core/pair.h
@@ -39,4 +39,13 @@ struct Pair {
Pair( F p_first, S p_second) { first=p_first; second=p_second; }
};
+template<class F,class S>
+struct PairSort {
+
+ bool operator()(const Pair<F,S>& A, const Pair<F,S>& B) const {
+ return A.first < B.first;
+ }
+};
+
+
#endif // PAIR_H
diff --git a/core/path_remap.cpp b/core/path_remap.cpp
index ed77fd8840..bbaba71bba 100644
--- a/core/path_remap.cpp
+++ b/core/path_remap.cpp
@@ -28,185 +28,3 @@
/*************************************************************************/
#include "path_remap.h"
-#include "globals.h"
-#include "os/os.h"
-#include "translation.h"
-
-PathRemap* PathRemap::singleton=NULL;
-
-PathRemap* PathRemap::get_singleton() {
-
- return singleton;
-}
-
-void PathRemap::add_remap(const String& p_from, const String& p_to,const String& p_locale) {
-
- if (!remap.has(p_from)) {
- remap[p_from]=RemapData();
- }
-
- if (p_locale==String())
- remap[p_from].always=p_to;
- else
- remap[p_from].locale[p_locale]=p_to;
-}
-
-
-String PathRemap::get_remap(const String& p_from) const {
-
- const RemapData *ptr=remap.getptr(p_from);
- if (!ptr) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap failed: "+p_from);
- return p_from;
- } else {
-
- const RemapData *ptr2=NULL;
-
- String locale = TranslationServer::get_singleton()->get_locale();
-
- if (ptr->locale.has(locale)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
-
- ptr2=remap.getptr(ptr->locale[locale]);
-
- if (ptr2 && ptr2->always!=String()) //may have atlas or export remap too
- return ptr2->always;
- else
- return ptr->locale[locale];
- }
-
- int p = locale.find("_");
- if (p!=-1) {
- locale=locale.substr(0,p);
- if (ptr->locale.has(locale)) {
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap found: "+p_from+" -> "+ptr->locale[locale]);
-
- ptr2=remap.getptr(ptr->locale[locale]);
-
- if (ptr2 && ptr2->always!=String()) //may have atlas or export remap too
- return ptr2->always;
- else
- return ptr->locale[locale];
-
- }
- }
-
- if (ptr->always!=String()) {
- if (OS::get_singleton()->is_stdout_verbose()) {
- print_line("remap found: "+p_from+" -> "+ptr->always);
- }
- return ptr->always;
- }
-
- if (OS::get_singleton()->is_stdout_verbose())
- print_line("remap failed: "+p_from);
-
- return p_from;
- }
-}
-bool PathRemap::has_remap(const String& p_from) const{
-
- return remap.has(p_from);
-}
-
-void PathRemap::erase_remap(const String& p_from){
-
- ERR_FAIL_COND(!remap.has(p_from));
- remap.erase(p_from);
-}
-
-void PathRemap::clear_remaps() {
-
- remap.clear();
-}
-
-void PathRemap::load_remaps() {
-
- // default remaps first
- PoolVector<String> remaps;
- if (GlobalConfig::get_singleton()->has("remap/all")) {
- remaps = GlobalConfig::get_singleton()->get("remap/all");
- }
-
- {
- int rlen = remaps.size();
-
- ERR_FAIL_COND( rlen%2 );
- PoolVector<String>::Read r = remaps.read();
- for(int i=0;i<rlen/2;i++) {
-
- String from = r[i*2+0];
- String to = r[i*2+1];
- add_remap(from,to);
- }
- }
-
-
- // platform remaps second, so override
- if (GlobalConfig::get_singleton()->has("remap/"+OS::get_singleton()->get_name())) {
- remaps = GlobalConfig::get_singleton()->get("remap/"+OS::get_singleton()->get_name());
- } else {
- remaps.resize(0);
- }
- //remaps = Globals::get_singleton()->get("remap/PSP");
- {
- int rlen = remaps.size();
-
- ERR_FAIL_COND( rlen%2 );
- PoolVector<String>::Read r = remaps.read();
- for(int i=0;i<rlen/2;i++) {
-
- String from = r[i*2+0];
- String to = r[i*2+1];
- //print_line("add remap: "+from+" -> "+to);
- add_remap(from,to);
- }
- }
-
-
- //locale based remaps
-
- if (GlobalConfig::get_singleton()->has("locale/translation_remaps")) {
-
- Dictionary remaps = GlobalConfig::get_singleton()->get("locale/translation_remaps");
- List<Variant> rk;
- remaps.get_key_list(&rk);
- for(List<Variant>::Element *E=rk.front();E;E=E->next()) {
-
- String source = E->get();
- PoolStringArray sa = remaps[E->get()];
- int sas = sa.size();
- PoolStringArray::Read r = sa.read();
-
- for(int i=0;i<sas;i++) {
-
- String s = r[i];
- int qp = s.find_last(":");
- if (qp!=-1) {
- String path = s.substr(0,qp);
- String locale = s.substr(qp+1,s.length());
- add_remap(source,path,locale);
- }
- }
- }
-
- }
-
-}
-
-void PathRemap::_bind_methods() {
-
- ClassDB::bind_method(_MD("add_remap","from","to","locale"),&PathRemap::add_remap,DEFVAL(String()));
- ClassDB::bind_method(_MD("has_remap","path"),&PathRemap::has_remap);
- ClassDB::bind_method(_MD("get_remap","path"),&PathRemap::get_remap);
- ClassDB::bind_method(_MD("erase_remap","path"),&PathRemap::erase_remap);
- ClassDB::bind_method(_MD("clear_remaps"),&PathRemap::clear_remaps);
-}
-
-PathRemap::PathRemap() {
-
- singleton=this;
-}
diff --git a/core/path_remap.h b/core/path_remap.h
index a106030f95..966bb10ea5 100644
--- a/core/path_remap.h
+++ b/core/path_remap.h
@@ -29,39 +29,4 @@
#ifndef PATH_REMAP_H
#define PATH_REMAP_H
-#include "hash_map.h"
-#include "ustring.h"
-#include "object.h"
-
-
-class PathRemap : public Object {
-
- GDCLASS(PathRemap,Object);
-
- static PathRemap* singleton;
- struct RemapData {
- String always;
- Map<String,String> locale;
- };
-
- HashMap<String,RemapData> remap;
-protected:
-
- static void _bind_methods();
-public:
-
- void add_remap(const String& p_from, const String& p_to,const String& p_locale=String());
- bool has_remap(const String& p_from) const;
- //_FORCE_INLINE_ String get_remap(const String& p_from) const { const String *ptr=remap.getptr(p_from); if (!ptr) return p_from; else return *ptr; }
- String get_remap(const String& p_from) const;
- void erase_remap(const String& p_from);
- void clear_remaps();
-
- void load_remaps();
-
- static PathRemap* get_singleton();
-
- PathRemap();
-};
-
#endif // PATH_REMAP_H
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 242d36042d..ab94b56cdc 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -45,6 +45,7 @@
#include "compressed_translation.h"
#include "io/translation_loader_po.h"
#include "io/resource_format_binary.h"
+#include "io/resource_import.h"
#include "io/stream_peer_ssl.h"
#include "os/input.h"
#include "core/io/xml_parser.h"
@@ -57,7 +58,7 @@
static ResourceFormatSaverBinary *resource_saver_binary=NULL;
static ResourceFormatLoaderBinary *resource_loader_binary=NULL;
-
+static ResourceFormatImporter *resource_format_importer=NULL;
static _ResourceLoader *_resource_loader=NULL;
static _ResourceSaver *_resource_saver=NULL;
@@ -105,12 +106,14 @@ void register_core_types() {
resource_loader_binary = memnew( ResourceFormatLoaderBinary );
ResourceLoader::add_resource_format_loader(resource_loader_binary);
+ resource_format_importer = memnew( ResourceFormatImporter );
+ ResourceLoader::add_resource_format_loader(resource_format_importer);
+
ClassDB::register_class<Object>();
ClassDB::register_class<Reference>();
ClassDB::register_class<WeakRef>();
- ClassDB::register_class<ResourceImportMetadata>();
ClassDB::register_class<Resource>();
ClassDB::register_class<FuncRef>();
ClassDB::register_virtual_class<StreamPeer>();
@@ -179,13 +182,11 @@ void register_core_singletons() {
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Geometry",_Geometry::get_singleton()) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceLoader",_ResourceLoader::get_singleton()) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ResourceSaver",_ResourceSaver::get_singleton()) );
- GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("PathRemap",PathRemap::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("OS",_OS::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Engine",_Engine::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("ClassDB",_classdb ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Marshalls",_Marshalls::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("TranslationServer",TranslationServer::get_singleton() ) );
- GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("TS",TranslationServer::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("Input",Input::get_singleton() ) );
GlobalConfig::get_singleton()->add_singleton( GlobalConfig::Singleton("InputMap",InputMap::get_singleton() ) );
@@ -209,6 +210,8 @@ void unregister_core_types() {
memdelete(resource_saver_binary);
if (resource_loader_binary)
memdelete(resource_loader_binary);
+ if (resource_format_importer)
+ memdelete(resource_format_importer);
memdelete( resource_format_po );
diff --git a/core/resource.cpp b/core/resource.cpp
index 6e8d9a8b17..9b5bac5f32 100644
--- a/core/resource.cpp
+++ b/core/resource.cpp
@@ -35,119 +35,6 @@
#include <stdio.h>
-void ResourceImportMetadata::set_editor(const String& p_editor) {
-
- editor=p_editor;
-}
-
-String ResourceImportMetadata::get_editor() const{
-
- return editor;
-}
-
-void ResourceImportMetadata::add_source(const String& p_path,const String& p_md5) {
-
- Source s;
- s.md5=p_md5;
- s.path=p_path;
- sources.push_back(s);
-}
-
-String ResourceImportMetadata::get_source_path(int p_idx) const{
- ERR_FAIL_INDEX_V(p_idx,sources.size(),String());
- return sources[p_idx].path;
-}
-String ResourceImportMetadata::get_source_md5(int p_idx) const{
- ERR_FAIL_INDEX_V(p_idx,sources.size(),String());
- return sources[p_idx].md5;
-}
-
-void ResourceImportMetadata::set_source_md5(int p_idx,const String& p_md5) {
-
- ERR_FAIL_INDEX(p_idx,sources.size());
- sources[p_idx].md5=p_md5;
-
-}
-
-void ResourceImportMetadata::remove_source(int p_idx){
-
- ERR_FAIL_INDEX(p_idx,sources.size());
- sources.remove(p_idx);
-
-}
-
-int ResourceImportMetadata::get_source_count() const {
-
- return sources.size();
-}
-void ResourceImportMetadata::set_option(const String& p_key, const Variant& p_value) {
-
- if (p_value.get_type()==Variant::NIL) {
- options.erase(p_key);
- return;
- }
-
- ERR_FAIL_COND(p_value.get_type() == Variant::OBJECT);
- ERR_FAIL_COND(p_value.get_type() == Variant::_RID);
-
- options[p_key]=p_value;
-
-}
-
-bool ResourceImportMetadata::has_option(const String& p_key) const {
-
- return options.has(p_key);
-}
-
-Variant ResourceImportMetadata::get_option(const String& p_key) const {
-
- ERR_FAIL_COND_V(!options.has(p_key),Variant());
-
- return options[p_key];
-}
-
-void ResourceImportMetadata::get_options(List<String> *r_options) const {
-
- for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) {
-
- r_options->push_back(E->key());
- }
-
-}
-
-PoolStringArray ResourceImportMetadata::_get_options() const {
-
- PoolStringArray option_names;
- option_names.resize(options.size());
- int i=0;
- for(Map<String,Variant>::Element *E=options.front();E;E=E->next()) {
-
- option_names.set(i++,E->key());
- }
-
- return option_names;
-}
-
-void ResourceImportMetadata::_bind_methods() {
-
- ClassDB::bind_method(_MD("set_editor","name"),&ResourceImportMetadata::set_editor);
- ClassDB::bind_method(_MD("get_editor"),&ResourceImportMetadata::get_editor);
- ClassDB::bind_method(_MD("add_source","path","md5"),&ResourceImportMetadata::add_source, "");
- ClassDB::bind_method(_MD("get_source_path","idx"),&ResourceImportMetadata::get_source_path);
- ClassDB::bind_method(_MD("get_source_md5","idx"),&ResourceImportMetadata::get_source_md5);
- ClassDB::bind_method(_MD("set_source_md5","idx", "md5"),&ResourceImportMetadata::set_source_md5);
- ClassDB::bind_method(_MD("remove_source","idx"),&ResourceImportMetadata::remove_source);
- ClassDB::bind_method(_MD("get_source_count"),&ResourceImportMetadata::get_source_count);
- ClassDB::bind_method(_MD("set_option","key","value"),&ResourceImportMetadata::set_option);
- ClassDB::bind_method(_MD("get_option","key"),&ResourceImportMetadata::get_option);
- ClassDB::bind_method(_MD("get_options"),&ResourceImportMetadata::_get_options);
-}
-
-ResourceImportMetadata::ResourceImportMetadata() {
-
-
-}
-
void Resource::emit_changed() {
@@ -381,21 +268,6 @@ void Resource::notify_change_to_owners() {
}
}
-void Resource::set_import_metadata(const Ref<ResourceImportMetadata>& p_metadata) {
-#ifdef TOOLS_ENABLED
- import_metadata=p_metadata;
-#endif
-}
-
-Ref<ResourceImportMetadata> Resource::get_import_metadata() const {
-
-#ifdef TOOLS_ENABLED
- return import_metadata;
-#else
- return Ref<ResourceImportMetadata>();
-#endif
-
-}
#ifdef TOOLS_ENABLED
@@ -461,8 +333,6 @@ void Resource::_bind_methods() {
ClassDB::bind_method(_MD("set_name","name"),&Resource::set_name);
ClassDB::bind_method(_MD("get_name"),&Resource::get_name);
ClassDB::bind_method(_MD("get_rid"),&Resource::get_rid);
- ClassDB::bind_method(_MD("set_import_metadata","metadata"),&Resource::set_import_metadata);
- ClassDB::bind_method(_MD("get_import_metadata"),&Resource::get_import_metadata);
ClassDB::bind_method(_MD("set_local_to_scene","enable"),&Resource::set_local_to_scene);
ClassDB::bind_method(_MD("is_local_to_scene"),&Resource::is_local_to_scene);
ClassDB::bind_method(_MD("get_local_scene:Node"),&Resource::get_local_scene);
@@ -483,6 +353,7 @@ Resource::Resource() {
#ifdef TOOLS_ENABLED
last_modified_time=0;
+ import_last_modified_time=0;
#endif
subindex=0;
diff --git a/core/resource.h b/core/resource.h
index 2b071c8e1c..b29077a3b8 100644
--- a/core/resource.h
+++ b/core/resource.h
@@ -46,47 +46,6 @@ virtual String get_base_extension() const { return m_ext; }\
private:
-class ResourceImportMetadata : public Reference {
-
- GDCLASS( ResourceImportMetadata, Reference );
-
- struct Source {
- String path;
- String md5;
- };
-
- Vector<Source> sources;
- String editor;
-
- Map<String,Variant> options;
-
- PoolStringArray _get_options() const;
-
-protected:
-
- static void _bind_methods();
-public:
-
- void set_editor(const String& p_editor);
- String get_editor() const;
-
- void add_source(const String& p_path,const String& p_md5="");
- String get_source_path(int p_idx) const;
- String get_source_md5(int p_idx) const;
- void set_source_md5(int p_idx,const String& p_md5);
- void remove_source(int p_idx);
- int get_source_count() const;
-
- void set_option(const String& p_key, const Variant& p_value);
- Variant get_option(const String& p_key) const;
- bool has_option(const String& p_key) const;
-
- void get_options(List<String> *r_options) const;
-
-
- ResourceImportMetadata();
-};
-
class Resource : public Reference {
@@ -106,8 +65,9 @@ friend class ResourceCache;
virtual bool _use_builtin_script() const { return true; }
#ifdef TOOLS_ENABLED
- Ref<ResourceImportMetadata> import_metadata;
uint64_t last_modified_time;
+ uint64_t import_last_modified_time;
+ String import_path;
#endif
bool local_to_scene;
@@ -147,10 +107,6 @@ public:
Ref<Resource> duplicate(bool p_subresources=false);
Ref<Resource> duplicate_for_local_scene(Node *p_scene,Map<Ref<Resource>,Ref<Resource> >& remap_cache);
-
- void set_import_metadata(const Ref<ResourceImportMetadata>& p_metadata);
- Ref<ResourceImportMetadata> get_import_metadata() const;
-
void set_local_to_scene(bool p_enable);
bool is_local_to_scene() const;
virtual void setup_local_to_scene();
@@ -164,6 +120,12 @@ public:
virtual void set_last_modified_time(uint64_t p_time) { last_modified_time=p_time; }
uint64_t get_last_modified_time() const { return last_modified_time; }
+ virtual void set_import_last_modified_time(uint64_t p_time) { import_last_modified_time=p_time; }
+ uint64_t get_import_last_modified_time() const { return import_last_modified_time; }
+
+ void set_import_path(const String& p_path) { import_path=p_path; }
+ String get_import_path() const { return import_path; }
+
#endif
virtual RID get_rid() const; // some resources may offer conversion to RID
diff --git a/core/safe_refcount.cpp b/core/safe_refcount.cpp
index ede37bbe8a..50617f2062 100644
--- a/core/safe_refcount.cpp
+++ b/core/safe_refcount.cpp
@@ -44,6 +44,14 @@ uint32_t atomic_conditional_increment( register uint32_t * pw ) {
return *pw;
}
+uint32_t atomic_increment( register uint32_t * pw ) {
+
+ (*pw)++;
+
+ return *pw;
+
+}
+
uint32_t atomic_decrement( register uint32_t * pw ) {
(*pw)--;
diff --git a/core/translation.cpp b/core/translation.cpp
index d5ec61b8d6..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)",
@@ -751,6 +752,20 @@ static const char* locale_names[]={
0
};
+bool TranslationServer::is_locale_valid(const String& p_locale) {
+
+ const char **ptr=locale_list;
+
+ while (*ptr) {
+
+ if (*ptr==p_locale)
+ return true;
+ ptr++;
+ }
+
+ return false;
+
+}
Vector<String> TranslationServer::get_all_locales() {
diff --git a/core/translation.h b/core/translation.h
index 85ab4a229d..feed352549 100644
--- a/core/translation.h
+++ b/core/translation.h
@@ -102,6 +102,7 @@ public:
static Vector<String> get_all_locales();
static Vector<String> get_all_locale_names();
+ static bool is_locale_valid(const String& p_locale);
void set_tool_translation(const Ref<Translation>& p_translation);
StringName tool_translate(const StringName& p_message) const;
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 478c427fb9..a0d26ea0af 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3410,8 +3410,17 @@ String String::c_escape() const {
escaped=escaped.replace("\t","\\t");
escaped=escaped.replace("\v","\\v");
escaped=escaped.replace("\'","\\'");
- escaped=escaped.replace("\"","\\\"");
escaped=escaped.replace("\?","\\?");
+ escaped=escaped.replace("\"","\\\"");
+
+ return escaped;
+}
+
+String String::c_escape_multiline() const {
+
+ String escaped=*this;
+ escaped=escaped.replace("\\","\\\\");
+ escaped=escaped.replace("\"","\\\"");
return escaped;
}
diff --git a/core/ustring.h b/core/ustring.h
index 426762a9e1..5665a23112 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -218,6 +218,7 @@ public:
String http_escape() const;
String http_unescape() const;
String c_escape() const;
+ String c_escape_multiline() const;
String c_unescape() const;
String json_escape() const;
String word_wrap(int p_chars_per_line) const;
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index a833a275df..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==')')
@@ -1873,7 +1873,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
String str=p_variant;
- str="\""+str.c_escape()+"\"";
+ str="\""+str.c_escape_multiline()+"\"";
p_store_string_func(p_store_string_ud, str );
} break;
case Variant::VECTOR2: {
@@ -2091,7 +2091,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
dict.get_key_list(&keys);
keys.sort();
- p_store_string_func(p_store_string_ud,"{ ");
+ p_store_string_func(p_store_string_ud,"{\n");
for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
/*
@@ -2099,14 +2099,14 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
continue;
*/
write(E->get(),p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud);
- p_store_string_func(p_store_string_ud,":");
+ p_store_string_func(p_store_string_ud,": ");
write(dict[E->get()],p_store_string_func,p_store_string_ud,p_encode_res_func,p_encode_res_ud);
if (E->next())
- p_store_string_func(p_store_string_ud,", ");
+ p_store_string_func(p_store_string_ud,",\n");
}
- p_store_string_func(p_store_string_ud," }");
+ p_store_string_func(p_store_string_ud,"\n}");
} break;
diff --git a/core/vector.h b/core/vector.h
index 3119657cbb..1cb3fee256 100644
--- a/core/vector.h
+++ b/core/vector.h
@@ -81,7 +81,7 @@ class Vector {
size_t p;
if (_mul_overflow(p_elements, sizeof(T), &o)) return false;
*out = nearest_power_of_2(o);
- if (_add_overflow(o, 32, &p)) return false; //no longer allocated here
+ if (_add_overflow(o, static_cast<size_t>(32), &p)) return false; //no longer allocated here
return true;
#else
// Speed is more important than correctness here, do the operations unchecked
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index 0b8c5cc11c..8204af9fd4 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -667,7 +667,7 @@
</methods>
<constants>
<constant name="PI" value="3.141593">
- Constant that represents how many times the diameter of a circumference fits around it's perimeter.
+ Constant that represents how many times the diameter of a circumference fits around its perimeter.
</constant>
</constants>
</class>
@@ -8025,7 +8025,7 @@
Circular Shape for 2D Physics.
</brief_description>
<description>
- Circular Shape for 2D Physics. This shape is useful for modeling balls or small characters and it's collision detection with everything else is very fast.
+ Circular Shape for 2D Physics. This shape is useful for modeling balls or small characters and its collision detection with everything else is very fast.
</description>
<methods>
<method name="get_radius" qualifiers="const">
@@ -11258,7 +11258,7 @@
This function is called for each file exported and depending from the return value one of many things might happen.
1) If returned value is null, the file is exported as is.
2) If the returned value is a RawAray (array of bytes), the content of that array becomes the new file being exported.
- 3) If the file must also change it's name when exported, then a [Dictionary] must be returned with two fields: 'name' with the new filename and 'data' with a [RawArray] containing the raw contents of the file. Even if the name is changed, the run-time will redirect the old file to the new file automatically when accessed.
+ 3) If the file must also change its name when exported, then a [Dictionary] must be returned with two fields: 'name' with the new filename and 'data' with a [RawArray] containing the raw contents of the file. Even if the name is changed, the run-time will redirect the old file to the new file automatically when accessed.
</description>
</method>
</methods>
@@ -11706,7 +11706,7 @@
</class>
<class name="EditorPlugin" inherits="Node" category="Core">
<brief_description>
- Used by the editor to extend it's functionality.
+ Used by the editor to extend its functionality.
</brief_description>
<description>
Plugins are used by the editor to extend functionality. The most common types of plugins are those which edit a given node or resource type, import plugins and export plugins.
@@ -12005,7 +12005,7 @@
</method>
<method name="save_external_data" qualifiers="virtual">
<description>
- This method is called after the editor save the project or when the it's closed. It asks the plugin to save edited external scenes/resources.
+ This method is called after the editor saves the project or when it's closed. It asks the plugin to save edited external scenes/resources.
</description>
</method>
<method name="set_state" qualifiers="virtual">
@@ -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">
@@ -15970,7 +15970,7 @@
Request does not have a response(yet).
</constant>
<constant name="RESULT_BODY_SIZE_LIMIT_EXCEEDED" value="7">
- Request exceded it's maximum size limit, see [method set_body_size_limit].
+ Request exceded its maximum size limit, see [method set_body_size_limit].
</constant>
<constant name="RESULT_REQUEST_FAILED" value="8">
Request failed. (unused)
@@ -15982,7 +15982,7 @@
HTTPRequest couldn't write to the download file.
</constant>
<constant name="RESULT_REDIRECT_LIMIT_REACHED" value="11">
- Request reached it's maximum redirect limit, see [method set_max_redirects].
+ Request reached its maximum redirect limit, see [method set_max_redirects].
</constant>
</constants>
</class>
@@ -16088,7 +16088,7 @@
<argument index="0" name="id" type="int">
</argument>
<description>
- Return the status of hostname queued for resolving, given it's queue ID. Returned status can be any of the RESOLVER_STATUS_* enumeration.
+ Return the status of hostname queued for resolving, given its queue ID. Returned status can be any of the RESOLVER_STATUS_* enumeration.
</description>
</method>
<method name="resolve_hostname">
@@ -22660,7 +22660,7 @@
Nodes can also process input events. When set, the [method _input] function will be called for each input that the program receives. In many cases, this can be overkill (unless used for simple projects), and the [method _unhandled_input] function might be preferred; it is called when the input event was not handled by anyone else (typically, GUI [Control] nodes), ensuring that the node only receives the events that were meant for it.
To keep track of the scene hierarchy (especially when instancing scenes into other scenes), an "owner" can be set for the node with [method set_owner]. This keeps track of who instanced what. This is mostly useful when writing editors and tools, though.
Finally, when a node is freed with [method free] or [method queue_free], it will also free all its children.
- [b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to easily communicate over the network. By calling [method rpc] with a method name, it will be called locally, and in all connected peers (peers = clients and the server that accepts connections), with behaviour varying depending on the network mode ([method set_network_mode]) on the receiving peer. To identify which [Node] receives the RPC call Godot will use it's [NodePath] (make sure node names are the same on all peers).
+ [b]Networking with nodes:[/b] After connecting to a server (or making one, see [NetworkedMultiplayerENet]) it is possible to use the built-in RPC (remote procedure call) system to easily communicate over the network. By calling [method rpc] with a method name, it will be called locally, and in all connected peers (peers = clients and the server that accepts connections), with behaviour varying depending on the network mode ([method set_network_mode]) on the receiving peer. To identify which [Node] receives the RPC call Godot will use its [NodePath] (make sure node names are the same on all peers).
</description>
<methods>
<method name="_enter_tree" qualifiers="virtual">
@@ -33832,7 +33832,7 @@
</signal>
<signal name="sleeping_state_changed">
<description>
- Emitted when the body changes it's sleeping state. Either by sleeping or waking up.
+ Emitted when the body changes its sleeping state. Either by sleeping or waking up.
</description>
</signal>
</signals>
@@ -34227,7 +34227,7 @@
</signal>
<signal name="sleeping_state_changed">
<description>
- Emitted when the body changes it's sleeping state. Either by sleeping or waking up.
+ Emitted when the body changes its sleeping state. Either by sleeping or waking up.
</description>
</signal>
</signals>
@@ -35889,7 +35889,7 @@
<return type="Error">
</return>
<description>
- Tries to wait for the [Semaphore], if it's value is zero, blocks until non-zero.
+ Tries to wait for the [Semaphore], if its value is zero, blocks until non-zero.
</description>
</method>
</methods>
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 458da85e74..2923dfff9f 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -1,8 +1,7 @@
#include "rasterizer_canvas_gles3.h"
#include "os/os.h"
-#ifdef IPHONE_ENABLED
-// for some reason glClearDepth seems to have been removed in iOS ES3.h
+#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
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 b972c6a877..b504ef819f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3,8 +3,7 @@
#include "os/os.h"
#include "rasterizer_canvas_gles3.h"
-#ifdef IPHONE_ENABLED
-// for some reason glClearDepth seems to have been removed in iOS ES3.h
+#ifndef GLES_OVER_GL
#define glClearDepth glClearDepthf
#endif
@@ -149,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);
+
+
}
}
@@ -558,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);
@@ -1082,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:
@@ -1205,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;
@@ -1217,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
@@ -1715,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;
@@ -2298,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) {
@@ -2457,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
@@ -2550,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
@@ -3737,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
@@ -3771,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++;
}
@@ -4404,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);
@@ -4435,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);
@@ -5010,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 96befee869..06daebbf82 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -135,7 +135,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima
} break;
case Image::FORMAT_RGB565: {
-#ifdef IPHONE_ENABLED
+#ifndef GLES_OVER_GL
r_gl_internal_format=GL_RGB565;
#else
//#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-)
@@ -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/input_default.cpp b/main/input_default.cpp
index 82dec86067..0561f2bb34 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -381,15 +381,12 @@ void InputDefault::parse_input_event(const InputEvent& p_event) {
if (!p_event.is_echo()) {
for (const Map<StringName,InputMap::Action>::Element *E=InputMap::get_singleton()->get_action_map().front();E;E=E->next()) {
- if (InputMap::get_singleton()->event_is_action(p_event,E->key())) {
-
- if(is_action_pressed(E->key()) != p_event.is_pressed()) {
- Action action;
- action.fixed_frame=Engine::get_singleton()->get_fixed_frames();
- action.idle_frame=Engine::get_singleton()->get_idle_frames();
- action.pressed=p_event.is_pressed();
- action_state[E->key()]=action;
- }
+ if (InputMap::get_singleton()->event_is_action(p_event,E->key()) && is_action_pressed(E->key()) != p_event.is_pressed()) {
+ Action action;
+ action.fixed_frame=Engine::get_singleton()->get_fixed_frames();
+ action.idle_frame=Engine::get_singleton()->get_idle_frames();
+ action.pressed=p_event.is_pressed();
+ action_state[E->key()]=action;
}
}
}
diff --git a/main/main.cpp b/main/main.cpp
index 559f5e359b..21a839a25f 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -38,7 +38,7 @@
#include "script_debugger_local.h"
#include "script_debugger_remote.h"
#include "message_queue.h"
-#include "path_remap.h"
+
#include "input_map.h"
#include "io/resource_loader.h"
#include "scene/main/scene_main_loop.h"
@@ -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"
@@ -85,7 +81,7 @@ AudioServer *audio_server=NULL;
static MessageQueue *message_queue=NULL;
static Performance *performance = NULL;
-static PathRemap *path_remap;
+
static PackedData *packed_data=NULL;
#ifdef MINIZIP_ENABLED
static ZipArchive *zip_packed_data=NULL;
@@ -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
@@ -183,8 +179,6 @@ void Main::print_help(const char* p_binary) {
#ifdef TOOLS_ENABLED
OS::get_singleton()->print("\t-doctool FILE: Dump the whole engine api to FILE in XML format. If FILE exists, it will be merged.\n");
OS::get_singleton()->print("\t-nodocbase: Disallow dump the base types (used with -doctool).\n");
- OS::get_singleton()->print("\t-optimize FILE Save an optimized copy of scene to FILE.\n");
- OS::get_singleton()->print("\t-optimize_preset [preset] Use a given preset for optimization.\n");
OS::get_singleton()->print("\t-export [target] Export the project using given export target.\n");
#endif
}
@@ -215,7 +209,6 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
register_core_settings(); //here globals is present
- path_remap = memnew( PathRemap );
translation_server = memnew( TranslationServer );
performance = memnew( Performance );
globals->add_singleton(GlobalConfig::Singleton("Performance",performance));
@@ -710,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"))
@@ -766,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));
}
@@ -874,8 +867,6 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
memdelete(packed_data);
if (file_access_network_client)
memdelete(file_access_network_client);
- if(path_remap)
- memdelete(path_remap);
// Note 1: *zip_packed_data live into *packed_data
// Note 2: PackedData::~PackedData destroy this.
@@ -935,8 +926,6 @@ Error Main::setup2() {
}
MAIN_PRINT("Main: Load Remaps");
- path_remap->load_remaps();
-
Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color",Color(0.3,0.3,0.3));
VisualServer::get_singleton()->set_default_clear_color(clear);
@@ -1046,6 +1035,7 @@ Error Main::setup2() {
translation_server->load_translations();
+ audio_server->load_default_bus_layout();
if (use_debug_profiler && script_debugger) {
script_debugger->profiling_start();
@@ -1078,12 +1068,9 @@ bool Main::start() {
String script;
String test;
String screen;
- String optimize;
- String optimize_preset;
String _export_platform;
String _import;
String _import_script;
- String dumpstrings;
bool noquit=false;
bool export_debug=false;
bool project_manager_request = false;
@@ -1112,10 +1099,6 @@ bool Main::start() {
Engine::get_singleton()->_custom_level=args[i+1];
} else if (args[i]=="-test") {
test=args[i+1];
- } else if (args[i]=="-optimize") {
- optimize=args[i+1];
- } else if (args[i]=="-optimize_preset") {
- optimize_preset=args[i+1];
} else if (args[i]=="-export") {
editor=true; //needs editor
_export_platform=args[i+1];
@@ -1129,9 +1112,6 @@ bool Main::start() {
} else if (args[i]=="-import_script") {
editor=true; //needs editor
_import_script=args[i+1];
- } else if (args[i]=="-dumpstrings") {
- editor=true; //needs editor
- dumpstrings=args[i+1];
} else {
// The parameter does not match anything known, don't skip the next argument
parsed_pair=false;
@@ -1166,10 +1146,6 @@ bool Main::start() {
return false;
}
- if (optimize!="")
- editor=true; //need editor
-
-
#endif
@@ -1403,22 +1379,7 @@ bool Main::start() {
Error serr = editor_node->load_scene(local_game_path);
- if (serr==OK) {
-
- if (optimize!="") {
-
- editor_node->save_optimized_copy(optimize,optimize_preset);
- if (!noquit)
- sml->quit();
- }
-
- if (dumpstrings!="") {
- editor_node->save_translatable_strings(dumpstrings);
- if (!noquit)
- sml->quit();
- }
- }
}
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
@@ -1790,8 +1751,6 @@ void Main::cleanup() {
memdelete(input_map);
if (translation_server)
memdelete( translation_server );
- if (path_remap)
- memdelete(path_remap);
if (globals)
memdelete(globals);
if (engine)
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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
index 375f61437d..375f61437d 100644
--- a/tools/dist/osx_template.app/Contents/Resources/icon.icns
+++ b/misc/dist/osx_template.app/Contents/Resources/icon.icns
Binary files differ
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
index 375f61437d..375f61437d 100644
--- a/tools/dist/osx_tools.app/Contents/Resources/Godot.icns
+++ b/misc/dist/osx_tools.app/Contents/Resources/Godot.icns
Binary files differ
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
index 540bfb1c01..540bfb1c01 100644
--- a/tools/dist/uwp_template/Assets/SplashScreen.scale-100.png
+++ b/misc/dist/uwp_template/Assets/SplashScreen.scale-100.png
Binary files differ
diff --git a/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png
index 6cff663eb5..6cff663eb5 100644
--- a/tools/dist/uwp_template/Assets/Square150x150Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square150x150Logo.scale-100.png
Binary files differ
diff --git a/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png
index 12ec232c87..12ec232c87 100644
--- a/tools/dist/uwp_template/Assets/Square310x310Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square310x310Logo.scale-100.png
Binary files differ
diff --git a/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png
index ad059994ed..ad059994ed 100644
--- a/tools/dist/uwp_template/Assets/Square44x44Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square44x44Logo.scale-100.png
Binary files differ
diff --git a/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png b/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png
index b1bf331365..b1bf331365 100644
--- a/tools/dist/uwp_template/Assets/Square71x71Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Square71x71Logo.scale-100.png
Binary files differ
diff --git a/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png b/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png
index 8d7a625c82..8d7a625c82 100644
--- a/tools/dist/uwp_template/Assets/StoreLogo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/StoreLogo.scale-100.png
Binary files differ
diff --git a/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png b/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png
index b06f1ad50f..b06f1ad50f 100644
--- a/tools/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png
+++ b/misc/dist/uwp_template/Assets/Wide310x150Logo.scale-100.png
Binary files differ
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/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp
index 051d1d85cd..db47ee43ce 100644
--- a/modules/gdscript/register_types.cpp
+++ b/modules/gdscript/register_types.cpp
@@ -38,7 +38,7 @@
GDScriptLanguage *script_language_gd=NULL;
ResourceFormatLoaderGDScript *resource_loader_gd=NULL;
ResourceFormatSaverGDScript *resource_saver_gd=NULL;
-
+#if 0
#ifdef TOOLS_ENABLED
#include "tools/editor/editor_import_export.h"
@@ -135,7 +135,7 @@ static void register_editor_plugin() {
#endif
-
+#endif
void register_gdscript_types() {
ClassDB::register_class<GDScript>();
@@ -148,11 +148,12 @@ void register_gdscript_types() {
ResourceLoader::add_resource_format_loader(resource_loader_gd);
resource_saver_gd=memnew( ResourceFormatSaverGDScript );
ResourceSaver::add_resource_format_saver(resource_saver_gd);
-
+#if 0
#ifdef TOOLS_ENABLED
EditorNode::add_init_callback(register_editor_plugin);
#endif
+#endif
}
void unregister_gdscript_types() {
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/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 873eef0566..c46a15bd12 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -52,11 +52,10 @@ android {
java.srcDirs = ['src'
$$GRADLE_JAVA_DIRS$$
]
- resources.srcDirs = [
+ res.srcDirs = [
'res'
$$GRADLE_RES_DIRS$$
]
- res.srcDirs = ['res']
// libs.srcDirs = ['libs']
aidl.srcDirs = [
'aidl'
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 33283eccea..8e1fda74ed 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -38,7 +38,7 @@
#include "os/os.h"
#include "platform/android/logo.h"
#include <string.h>
-
+#if 0
static const char* android_perms[]={
"ACCESS_CHECKIN_PROPERTIES",
@@ -1915,3 +1915,4 @@ void register_android_exporter() {
EditorImportExport::get_singleton()->add_export_platform(exporter);
}
+#endif
diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp
index cc994c8f24..3e6dadb094 100644
--- a/platform/bb10/export/export.cpp
+++ b/platform/bb10/export/export.cpp
@@ -40,7 +40,7 @@
#include "io/xml_parser.h"
#define MAX_DEVICES 5
-
+#if 0
class EditorExportPlatformBB10 : public EditorExportPlatform {
GDCLASS( EditorExportPlatformBB10,EditorExportPlatform );
@@ -827,3 +827,4 @@ void register_bb10_exporter() {
}
+#endif
diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h
index da146fcdd0..4c2064663a 100644
--- a/platform/javascript/audio_driver_javascript.h
+++ b/platform/javascript/audio_driver_javascript.h
@@ -36,8 +36,6 @@
class AudioDriverJavaScript : public AudioDriver {
public:
- void set_singleton();
-
virtual const char* get_name() const;
virtual Error init();
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 55b05a9123..a701823b2e 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -14,9 +14,7 @@ def get_name():
def can_build():
import os
- if (not os.environ.has_key("EMSCRIPTEN_ROOT")):
- return False
- return True
+ return os.environ.has_key("EMSCRIPTEN_ROOT")
def get_opts():
@@ -79,9 +77,8 @@ def configure(env):
# These flags help keep the file size down
env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL', '-DMPC_FIXED_POINT', '-DTYPED_METHOD_BIND', '-DNO_THREADS'])
- env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
+ env.Append(CPPFLAGS=['-DGLES3_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
-# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
if env['wasm'] == 'yes':
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
@@ -101,14 +98,10 @@ def configure(env):
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
env.Append(LINKFLAGS=['-O2'])
+ env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1'])
# env.Append(LINKFLAGS=['-g4'])
# print "CCCOM is:", env.subst('$CCCOM')
# print "P: ", env['p'], " Platofrm: ", env['platform']
import methods
-
- env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')})
- env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')})
- env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')})
- #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index e0ff9932cc..e487383ef4 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -38,6 +38,9 @@
#include "os/os.h"
#include "platform/javascript/logo.h"
#include "string.h"
+
+
+#if 0
class EditorExportPlatformJavaScript : public EditorExportPlatform {
GDCLASS( EditorExportPlatformJavaScript,EditorExportPlatform );
@@ -181,8 +184,8 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const St
String current_line = lines[i];
current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024));
current_line = current_line.replace("$GODOT_BASE",p_name);
- current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/width"));
- current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/height"));
+ current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/window/width"));
+ current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/window/height"));
current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) GlobalConfig::get_singleton()->get("application/name"));
current_line = current_line.replace("$GODOT_HEAD_INCLUDE",html_head_include);
current_line = current_line.replace("$GODOT_STYLE_FONT_FAMILY",html_font_family);
@@ -424,3 +427,4 @@ void register_javascript_exporter() {
}
+#endif
diff --git a/platform/javascript/godot_shell.html b/platform/javascript/godot_shell.html
index a8b9594935..65f3b4a340 100644
--- a/platform/javascript/godot_shell.html
+++ b/platform/javascript/godot_shell.html
@@ -277,10 +277,10 @@ $GODOT_STYLE_INCLUDE
statusElement.appendChild(closeNote);
Presentation.setStatusVisible(true);
},
- isWebGLAvailable: function isWebGLAvailable() {
+ isWebGL2Available: function isWebGL2Available() {
var context;
try {
- context = canvasElement.getContext("webgl") || canvasElement.getContext("experimental-webgl");
+ context = canvasElement.getContext("webgl2") || canvasElement.getContext("experimental-webgl2");
} catch (e) {}
return !!context;
},
@@ -319,12 +319,12 @@ $GODOT_STYLE_INCLUDE
outputElement.firstChild.remove();
}
var msg = document.createElement("div");
- if (text.trim().startsWith("**ERROR**")
- || text.startsWith("**EXCEPTION**")) {
+ if (String.prototype.trim.call(text).startsWith("**ERROR**")
+ || String.prototype.trim.call(text).startsWith("**EXCEPTION**")) {
msg.style.color = "#d44";
- } else if (text.trim().startsWith("**WARNING**")) {
+ } else if (String.prototype.trim.call(text).startsWith("**WARNING**")) {
msg.style.color = "#ccc000";
- } else if (text.trim().startsWith("**SCRIPT ERROR**")) {
+ } else if (String.prototype.trim.call(text).startsWith("**SCRIPT ERROR**")) {
msg.style.color = "#c6d";
}
msg.textContent = text;
@@ -395,8 +395,8 @@ $GODOT_STYLE_INCLUDE
}
};
- if (!Presentation.isWebGLAvailable()) {
- Presentation.setStatus("WebGL appears to be unsupported in the current browser.\nPlease try updating or use a different browser.");
+ if (!Presentation.isWebGL2Available()) {
+ Presentation.setStatus("WebGL2 appears to be unsupported in the current browser.\nPlease try updating or use a different browser.");
Presentation.preventLoading = true;
} else {
Presentation.setStatus("Downloading...");
diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp
index a79e5473c2..72b7ab06cd 100644
--- a/platform/javascript/javascript_eval.cpp
+++ b/platform/javascript/javascript_eval.cpp
@@ -156,7 +156,7 @@ Variant JavaScript::eval(const String& p_code, bool p_use_global_exec_context) {
void JavaScript::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("eval", "code", "use_global_execution_context"), &JavaScript::eval, false);
+ ClassDB::bind_method(_MD("eval", "code", "use_global_execution_context"), &JavaScript::eval, false);
}
JavaScript::JavaScript() {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 317a6676a4..b8c3dea3b4 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "os_javascript.h"
-#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
#include "core/io/file_access_buffered_fa.h"
#include "drivers/unix/file_access_unix.h"
#include "drivers/unix/dir_access_unix.h"
@@ -47,7 +47,7 @@ int OS_JavaScript::get_video_driver_count() const {
const char * OS_JavaScript::get_video_driver_name(int p_driver) const {
- return "GLES2";
+ return "GLES3";
}
OS::VideoMode OS_JavaScript::get_default_video_mode() const {
@@ -237,30 +237,20 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
print_line("Init Audio");
AudioDriverManager::add_driver(&audio_driver_javascript);
+ audio_driver_javascript.set_singleton();
+ if (audio_driver_javascript.init() != OK) {
- if (true) {
- RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,false,false,false) );
- rasterizer_gles22->set_use_framebuffers(false); //not supported by emscripten
- if (gl_extensions)
- rasterizer_gles22->set_extensions(gl_extensions);
- rasterizer = rasterizer_gles22;
- } else {
- //rasterizer = memnew( RasterizerGLES1(true, false) );
+ ERR_PRINT("Initializing audio failed.");
}
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
+
print_line("Init VS");
- visual_server = memnew( VisualServerRaster(rasterizer) );
- visual_server->init();
+ visual_server = memnew( VisualServerRaster() );
visual_server->cursor_set_visible(false, 0);
- /*AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
-
- if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
-
- ERR_PRINT("Initializing audio failed.");
- }*/
-
print_line("Init Physicsserver");
physics_server = memnew( PhysicsServerSW );
@@ -767,14 +757,6 @@ void OS_JavaScript::main_loop_request_quit() {
main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
}
-void OS_JavaScript::reload_gfx() {
-
- if (gfx_init_func)
- gfx_init_func(gfx_init_ud,use_gl2,video_mode.width,video_mode.height,video_mode.fullscreen);
- if (rasterizer)
- rasterizer->reload_vram();
-}
-
Error OS_JavaScript::shell_open(String p_uri) {
/* clang-format off */
EM_ASM_({
@@ -877,7 +859,6 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, Get
main_loop=NULL;
last_id=1;
gl_extensions=NULL;
- rasterizer=NULL;
window_maximized=false;
get_data_dir_func=p_get_data_dir_func;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index d11494a8aa..582f128ce8 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -33,8 +33,6 @@
#include "drivers/unix/os_unix.h"
#include "os/main_loop.h"
#include "servers/physics/physics_server_sw.h"
-#include "servers/spatial_sound/spatial_sound_server_sw.h"
-#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
#include "servers/audio_server.h"
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/visual/rasterizer.h"
@@ -70,7 +68,6 @@ private:
int64_t time_to_save_sync;
int64_t last_sync_time;
- Rasterizer *rasterizer;
VisualServer *visual_server;
PhysicsServer *physics_server;
Physics2DServer *physics_2d_server;
@@ -165,8 +162,6 @@ public:
void set_opengl_extensions(const char* p_gl_extensions);
- void reload_gfx();
-
virtual Error shell_open(String p_uri);
virtual String get_data_dir() const;
String get_executable_path() const;
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 1cb41cede2..3a97827c16 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -39,7 +39,7 @@
#include "os/os.h"
#include "platform/osx/logo.h"
#include "string.h"
-
+#if 0
class EditorExportPlatformOSX : public EditorExportPlatform {
@@ -546,3 +546,4 @@ void register_osx_exporter() {
}
+#endif
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index f31c91ef6d..167a5831cf 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -65,7 +65,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*************************************************************************/
-
+#if 0
#include "version.h"
#include "export.h"
#include "object.h"
@@ -2390,3 +2390,4 @@ void register_uwp_exporter() {
Ref<EditorExportPlatformUWP> exporter = Ref<EditorExportPlatformUWP>(memnew(EditorExportPlatformUWP));
EditorImportExport::get_singleton()->add_export_platform(exporter);
}
+#endif
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index 1ad61844d0..88d534887b 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -29,7 +29,7 @@
#include "export.h"
#include "platform/windows/logo.h"
#include "tools/editor/editor_import_export.h"
-
+#if 0
void register_windows_exporter() {
Image img(_windows_logo);
@@ -50,3 +50,4 @@ void register_windows_exporter() {
}
+#endif
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index d1d769adf7..b230dda9cb 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -254,6 +254,25 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) // Check For Windows Messages
{
+ case WM_SETFOCUS:
+ {
+ window_has_focus = true;
+ // Re-capture cursor if we're in one of the capture modes
+ if (mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode==MOUSE_MODE_CONFINED) {
+ SetCapture(hWnd);
+ }
+ break;
+ }
+ case WM_KILLFOCUS:
+ {
+ window_has_focus = false;
+
+ // Release capture if we're in one of the capture modes
+ if (mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode==MOUSE_MODE_CONFINED) {
+ ReleaseCapture();
+ }
+ break;
+ }
case WM_ACTIVATE: // Watch For Window Activate Message
{
minimized = HIWORD(wParam) != 0;
@@ -266,19 +285,17 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
alt_mem=false;
control_mem=false;
shift_mem=false;
- if (mouse_mode==MOUSE_MODE_CAPTURED) {
+ if (mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode==MOUSE_MODE_CONFINED) {
RECT clipRect;
GetClientRect(hWnd, &clipRect);
ClientToScreen(hWnd, (POINT*) &clipRect.left);
ClientToScreen(hWnd, (POINT*) &clipRect.right);
ClipCursor(&clipRect);
SetCapture(hWnd);
-
}
} else {
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
alt_mem=false;
-
};
return 0; // Return To The Message Loop
@@ -345,6 +362,9 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
+ // Don't calculate relative mouse movement if we don't have focus in CAPTURED mode.
+ if (!window_has_focus && mouse_mode==MOUSE_MODE_CAPTURED)
+ break;
/*
LPARAM extra = GetMessageExtraInfo();
if (IsPenEvent(extra)) {
@@ -376,7 +396,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
mm.button_mask|=(wParam&MK_XBUTTON2)?(1<<6):0;*/
mm.x=GET_X_LPARAM(lParam);
mm.y=GET_Y_LPARAM(lParam);
-
+
if (mouse_mode==MOUSE_MODE_CAPTURED) {
Point2i c(video_mode.width/2,video_mode.height/2);
@@ -410,7 +430,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
mm.relative_y=mm.y-old_y;
old_x=mm.x;
old_y=mm.y;
- if (main_loop)
+ if (window_has_focus && main_loop)
input->parse_input_event(event);
@@ -714,9 +734,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
joypad->probe_joypads();
} break;
case WM_SETCURSOR: {
-
if(LOWORD(lParam) == HTCLIENT) {
- if(mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED) {
+ if(window_has_focus && (mouse_mode == MOUSE_MODE_HIDDEN || mouse_mode == MOUSE_MODE_CAPTURED)) {
//Hide the cursor
if(hCursor == NULL)
hCursor = SetCursor(NULL);
@@ -948,7 +967,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
main_loop=NULL;
outside=true;
-
+ window_has_focus=true;
WNDCLASSEXW wc;
video_mode=p_desired;
@@ -1326,17 +1345,17 @@ void OS_Windows::set_mouse_mode(MouseMode p_mode) {
if (mouse_mode==p_mode)
return;
mouse_mode=p_mode;
- if (p_mode==MOUSE_MODE_CAPTURED) {
+ if (mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode==MOUSE_MODE_CONFINED) {
RECT clipRect;
GetClientRect(hWnd, &clipRect);
ClientToScreen(hWnd, (POINT*) &clipRect.left);
ClientToScreen(hWnd, (POINT*) &clipRect.right);
ClipCursor(&clipRect);
- SetCapture(hWnd);
center=Point2i(video_mode.width/2,video_mode.height/2);
POINT pos = { (int) center.x, (int) center.y };
ClientToScreen(hWnd, &pos);
- SetCursorPos(pos.x, pos.y);
+ if (mouse_mode==MOUSE_MODE_CAPTURED)
+ SetCursorPos(pos.x, pos.y);
} else {
ReleaseCapture();
ClipCursor(NULL);
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index a5c8ecbe1b..2c8fa64f8e 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -118,6 +118,7 @@ class OS_Windows : public OS {
bool control_mem;
bool meta_mem;
bool force_quit;
+ bool window_has_focus;
uint32_t last_button_state;
CursorShape cursor_shape;
diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp
index 39b704d2c4..caa5e4fc89 100644
--- a/platform/x11/context_gl_x11.cpp
+++ b/platform/x11/context_gl_x11.cpp
@@ -130,13 +130,6 @@ Error ContextGL_X11::initialize() {
x11_window = XCreateWindow(x11_display, RootWindow(x11_display, vi->screen), 0, 0, OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height, 0, vi->depth, InputOutput, vi->visual, CWBorderPixel|CWColormap|CWEventMask, &swa);
ERR_FAIL_COND_V(!x11_window,ERR_UNCONFIGURED);
XMapWindow(x11_display, x11_window);
- while(true) {
- // wait for mapnotify (window created)
- XEvent e;
- XNextEvent(x11_display, &e);
- if (e.type == MapNotify)
- break;
- }
//};
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b5f6359d21..89cf639114 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -61,6 +61,7 @@ def get_opts():
('use_static_cpp', 'link stdc++ statically', 'no'),
('use_sanitizer', 'Use llvm compiler sanitize address', 'no'),
('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'),
+ ('use_lto', 'Use link time optimization', 'no'),
('pulseaudio', 'Detect & Use pulseaudio', 'yes'),
('udev', 'Use udev for gamepad connection callbacks', 'no'),
('debug_release', 'Add debug symbols to release version', 'no'),
@@ -97,12 +98,12 @@ def configure(env):
env.extra_suffix = ".llvm"
if (env["use_sanitizer"] == "yes"):
- env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
+ env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix += "s"
if (env["use_leak_sanitizer"] == "yes"):
- env.Append(CXXFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
+ env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix += "s"
@@ -111,22 +112,28 @@ def configure(env):
# env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
# env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
- if (env["target"] == "release"):
+ if (env["use_lto"] == "yes"):
+ env.Append(CCFLAGS=['-flto'])
+ env.Append(LINKFLAGS=['-flto'])
+
+
+ env.Append(CCFLAGS=['-pipe'])
+ env.Append(LINKFLAGS=['-pipe'])
+ if (env["target"] == "release"):
+ env.Prepend(CCFLAGS=['-Ofast'])
if (env["debug_release"] == "yes"):
- env.Append(CCFLAGS=['-g2'])
- else:
- env.Append(CCFLAGS=['-O3', '-ffast-math'])
+ env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
+ env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
if (env["debug_release"] == "yes"):
- env.Append(CCFLAGS=['-g2'])
+ env.Prepend(CCFLAGS=['-g2'])
elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
+ env.Prepend(CCFLAGS=['-g2', '-Wall', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
env.ParseConfig('pkg-config x11 --cflags --libs')
env.ParseConfig('pkg-config xinerama --cflags --libs')
diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp
index c1af323453..5a4751b387 100644
--- a/platform/x11/export/export.cpp
+++ b/platform/x11/export/export.cpp
@@ -30,7 +30,7 @@
#include "platform/x11/logo.h"
#include "tools/editor/editor_import_export.h"
#include "scene/resources/texture.h"
-
+#if 0
void register_x11_exporter() {
Image img(_x11_logo);
@@ -50,3 +50,4 @@ void register_x11_exporter() {
}
}
+#endif
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 8baeb8bc90..e792d0465e 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -450,6 +450,8 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
physics_2d_server->init();
input = memnew( InputDefault );
+
+ window_has_focus = true; // Set focus to true at init
#ifdef JOYDEV_ENABLED
joypad = memnew( JoypadLinux(input));
#endif
@@ -518,17 +520,21 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
if (p_mode==mouse_mode)
return;
- if (mouse_mode==MOUSE_MODE_CAPTURED)
+ if (mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode==MOUSE_MODE_CONFINED)
XUngrabPointer(x11_display, CurrentTime);
- if (mouse_mode!=MOUSE_MODE_VISIBLE && p_mode==MOUSE_MODE_VISIBLE)
- XUndefineCursor(x11_display,x11_window);
- if (p_mode!=MOUSE_MODE_VISIBLE && mouse_mode==MOUSE_MODE_VISIBLE) {
- XDefineCursor(x11_display,x11_window,null_cursor);
+
+ // The only modes that show a cursor are VISIBLE and CONFINED
+ bool showCursor = (p_mode == MOUSE_MODE_VISIBLE || p_mode == MOUSE_MODE_CONFINED);
+
+ if (showCursor) {
+ XUndefineCursor(x11_display,x11_window); // show cursor
+ } else {
+ XDefineCursor(x11_display,x11_window,null_cursor); // hide cursor
}
mouse_mode=p_mode;
- if (mouse_mode==MOUSE_MODE_CAPTURED) {
+ if (mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode == MOUSE_MODE_CONFINED) {
while(true) {
//flush pending motion events
@@ -769,13 +775,31 @@ void OS_X11::set_window_position(const Point2& p_position) {
}
Size2 OS_X11::get_window_size() const {
- XWindowAttributes xwa;
- XGetWindowAttributes(x11_display, x11_window, &xwa);
- return Size2i(xwa.width, xwa.height);
+ // Use current_videomode width and height instead of XGetWindowAttributes
+ // since right after a XResizeWindow the attributes may not be updated yet
+ return Size2i(current_videomode.width, current_videomode.height);
}
void OS_X11::set_window_size(const Size2 p_size) {
+ // If window resizable is disabled we need to update the attributes first
+ if (is_window_resizable() == false) {
+ XSizeHints *xsh;
+ xsh = XAllocSizeHints();
+ xsh->flags = PMinSize | PMaxSize;
+ xsh->min_width = p_size.x;
+ xsh->max_width = p_size.x;
+ xsh->min_height = p_size.y;
+ xsh->max_height = p_size.y;
+ XSetWMNormalHints(x11_display, x11_window, xsh);
+ XFree(xsh);
+ }
+
+ // Resize the window
XResizeWindow(x11_display, x11_window, p_size.x, p_size.y);
+
+ // Update our videomode width and height
+ current_videomode.width = p_size.x;
+ current_videomode.height = p_size.y;
}
void OS_X11::set_window_fullscreen(bool p_enabled) {
@@ -789,15 +813,15 @@ bool OS_X11::is_window_fullscreen() const {
void OS_X11::set_window_resizable(bool p_enabled) {
XSizeHints *xsh;
+ Size2 size = get_window_size();
+
xsh = XAllocSizeHints();
xsh->flags = p_enabled ? 0L : PMinSize | PMaxSize;
if(!p_enabled) {
- XWindowAttributes xwa;
- XGetWindowAttributes(x11_display,x11_window,&xwa);
- xsh->min_width = xwa.width;
- xsh->max_width = xwa.width;
- xsh->min_height = xwa.height;
- xsh->max_height = xwa.height;
+ xsh->min_width = size.x;
+ xsh->max_width = size.x;
+ xsh->min_height = size.y;
+ xsh->max_height = size.y;
}
XSetWMNormalHints(x11_display, x11_window, xsh);
XFree(xsh);
@@ -1254,6 +1278,10 @@ void OS_X11::process_xevents() {
do_mouse_warp=false;
+
+ // Is the current mouse mode one where it needs to be grabbed.
+ bool mouse_mode_grab = mouse_mode==MOUSE_MODE_CAPTURED || mouse_mode==MOUSE_MODE_CONFINED;
+
while (XPending(x11_display) > 0) {
XEvent event;
XNextEvent(x11_display, &event);
@@ -1272,35 +1300,45 @@ void OS_X11::process_xevents() {
minimized = (visibility->state == VisibilityFullyObscured);
} break;
case LeaveNotify: {
-
- if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED)
+ if (main_loop && !mouse_mode_grab)
main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
if (input)
input->set_mouse_in_window(false);
} break;
case EnterNotify: {
-
- if (main_loop && mouse_mode!=MOUSE_MODE_CAPTURED)
+ if (main_loop && !mouse_mode_grab)
main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
if (input)
input->set_mouse_in_window(true);
} break;
case FocusIn:
minimized = false;
+ window_has_focus = true;
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
- if (mouse_mode==MOUSE_MODE_CAPTURED) {
+ if (mouse_mode_grab) {
+ // Show and update the cursor if confined and the window regained focus.
+ if (mouse_mode==MOUSE_MODE_CONFINED)
+ XUndefineCursor(x11_display, x11_window);
+ else if (mouse_mode==MOUSE_MODE_CAPTURED) // or re-hide it in captured mode
+ XDefineCursor(x11_display, x11_window, null_cursor);
+
XGrabPointer(
- x11_display, x11_window, True,
+ x11_display, x11_window, True,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync, x11_window, None, CurrentTime);
}
break;
case FocusOut:
+ window_has_focus = false;
main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
- if (mouse_mode==MOUSE_MODE_CAPTURED) {
+ if (mouse_mode_grab) {
//dear X11, I try, I really try, but you never work, you do whathever you want.
+ if (mouse_mode==MOUSE_MODE_CAPTURED) {
+ // Show the cursor if we're in captured mode so it doesn't look weird.
+ XUndefineCursor(x11_display, x11_window);
+ }
XUngrabPointer(x11_display, CurrentTime);
}
break;
@@ -1320,7 +1358,7 @@ void OS_X11::process_xevents() {
/* exit in case of a mouse button press */
last_timestamp=event.xbutton.time;
- if (mouse_mode==MOUSE_MODE_CAPTURED) {
+ if (mouse_mode == MOUSE_MODE_CAPTURED) {
event.xbutton.x=last_mouse_pos.x;
event.xbutton.y=last_mouse_pos.y;
}
@@ -1343,7 +1381,6 @@ void OS_X11::process_xevents() {
mouse_event.mouse_button.pressed=(event.type==ButtonPress);
-
if (event.type==ButtonPress && event.xbutton.button==1) {
uint64_t diff = get_ticks_usec()/1000 - last_click_ms;
@@ -1377,7 +1414,6 @@ void OS_X11::process_xevents() {
// PLEASE DO ME A FAVOR AND DIE DROWNED IN A FECAL
// MOUNTAIN BECAUSE THAT'S WHERE YOU BELONG.
-
while(true) {
if (mouse_mode==MOUSE_MODE_CAPTURED && event.xmotion.x==current_videomode.width/2 && event.xmotion.y==current_videomode.height/2) {
//this is likely the warp event since it was warped here
@@ -1419,7 +1455,7 @@ void OS_X11::process_xevents() {
Point2i new_center = pos;
pos = last_mouse_pos + ( pos - center );
center=new_center;
- do_mouse_warp=true;
+ do_mouse_warp=window_has_focus; // warp the cursor if we're focused in
#else
//Dear X11, thanks for making my life miserable
@@ -1462,8 +1498,11 @@ void OS_X11::process_xevents() {
last_mouse_pos=pos;
// printf("rel: %d,%d\n", rel.x, rel.y );
-
- input->parse_input_event( motion_event);
+ // Don't propagate the motion event unless we have focus
+ // this is so that the relative motion doesn't get messed up
+ // after we regain focus.
+ if (window_has_focus || !mouse_mode_grab)
+ input->parse_input_event( motion_event);
} break;
case KeyPress:
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index 3245df32c6..3ec358f103 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -134,7 +134,7 @@ class OS_X11 : public OS_Unix {
bool force_quit;
bool minimized;
-
+ bool window_has_focus;
bool do_mouse_warp;
const char *cursor_theme;
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/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 958b065881..e02b2b2b41 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -118,17 +118,20 @@ bool AnimationPlayer::_get(const StringName& p_name,Variant &r_ret) const {
} else if (name=="blend_times") {
- Array array;
-
- array.resize(blend_times.size()*3);
- int idx=0;
+ Vector<BlendKey> keys;
for(Map<BlendKey, float >::Element *E=blend_times.front();E;E=E->next()) {
- array.set(idx*3+0,E->key().from);
- array.set(idx*3+1,E->key().to);
- array.set(idx*3+2,E->get());
- idx++;
+ keys.ordered_insert(E->key());
}
+
+ Array array;
+ for(int i=0;i<keys.size();i++) {
+
+ array.push_back(keys[i].from);
+ array.push_back(keys[i].to);
+ array.push_back(blend_times[keys[i]]);
+ }
+
r_ret=array;
} else if (name=="autoplay") {
r_ret=autoplay;
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index 41bae6c928..7fab651213 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -142,7 +142,7 @@ private:
StringName from;
StringName to;
- bool operator<(const BlendKey& bk) const { return from==bk.from?to<bk.to:from<bk.from; }
+ bool operator<(const BlendKey& bk) const { return from==bk.from?String(to)<String(bk.to):String(from)<String(bk.from); }
};
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp
index b3ed9b209a..46312933a7 100644
--- a/scene/gui/scroll_container.cpp
+++ b/scene/gui/scroll_container.cpp
@@ -236,14 +236,14 @@ void ScrollContainer::_notification(int p_what) {
child_max_size.y = MAX(child_max_size.y, minsize.y);
Rect2 r = Rect2(-scroll,minsize);
- if (!(scroll_h || h_scroll->is_visible_in_tree())) {
+ if (!scroll_h || (!h_scroll->is_visible_in_tree() && c->get_h_size_flags()&SIZE_EXPAND)) {
r.pos.x=0;
if (c->get_h_size_flags()&SIZE_EXPAND)
r.size.width=MAX(size.width,minsize.width);
else
r.size.width=minsize.width;
}
- if (!(scroll_v || v_scroll->is_visible_in_tree())) {
+ if (!scroll_v || (!v_scroll->is_visible_in_tree() && c->get_v_size_flags()&SIZE_EXPAND)) {
r.pos.y=0;
r.size.height=size.height;
if (c->get_v_size_flags()&SIZE_EXPAND)
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index d1a8c458ba..6036b3f9df 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -482,14 +482,6 @@ void TextEdit::_notification(int p_what) {
Color color = cache.font_color;
int in_region=-1;
- if (line_length_guideline) {
- int x=xmargin_beg+cache.font->get_char_size('0').width*line_length_guideline_col-cursor.x_ofs;
- if (x>xmargin_beg && x<xmargin_end) {
- Color guideline_color(color.r,color.g,color.b,color.a*0.25f);
- VisualServer::get_singleton()->canvas_item_add_line(ci,Point2(x,0),Point2(x,cache.size.height),guideline_color);
- }
- }
-
if (syntax_coloring) {
if (cache.background_color.a>0.01) {
@@ -1080,6 +1072,14 @@ void TextEdit::_notification(int p_what) {
}
}
+ if (line_length_guideline) {
+ int x=xmargin_beg+cache.font->get_char_size('0').width*line_length_guideline_col-cursor.x_ofs;
+ if (x>xmargin_beg && x<xmargin_end) {
+ VisualServer::get_singleton()->canvas_item_add_line(ci,Point2(x,0),Point2(x,cache.size.height),cache.line_length_guideline_color);
+ }
+ }
+
+
bool completion_below = false;
if (completion_active) {
// code completion box
@@ -3484,6 +3484,7 @@ void TextEdit::_update_caches() {
cache.selection_color=get_color("selection_color");
cache.mark_color=get_color("mark_color");
cache.current_line_color=get_color("current_line_color");
+ cache.line_length_guideline_color=get_color("line_length_guideline_color");
cache.breakpoint_color=get_color("breakpoint_color");
cache.brace_mismatch_color=get_color("brace_mismatch_color");
cache.word_highlighted_color=get_color("word_highlighted_color");
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 6113fd72c2..437e22ca40 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -91,6 +91,7 @@ class TextEdit : public Control {
Color mark_color;
Color breakpoint_color;
Color current_line_color;
+ Color line_length_guideline_color;
Color brace_mismatch_color;
Color word_highlighted_color;
Color search_result_color;
diff --git a/scene/io/resource_format_image.cpp b/scene/io/resource_format_image.cpp
index 2d098d01f5..4d15ab86fd 100644
--- a/scene/io/resource_format_image.cpp
+++ b/scene/io/resource_format_image.cpp
@@ -27,6 +27,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "resource_format_image.h"
+
+#if 0
#include "scene/resources/texture.h"
#include "io/image_loader.h"
#include "globals.h"
@@ -260,3 +262,4 @@ ResourceFormatLoaderImage::ResourceFormatLoaderImage() {
GLOBAL_DEF("rendering/image_loader/repeat",false);
}
+#endif
diff --git a/scene/io/resource_format_image.h b/scene/io/resource_format_image.h
index 6e4ead2a0b..0638e97787 100644
--- a/scene/io/resource_format_image.h
+++ b/scene/io/resource_format_image.h
@@ -29,6 +29,8 @@
#ifndef RESOURCE_FORMAT_IMAGE_H
#define RESOURCE_FORMAT_IMAGE_H
+#if 0
+
#include "io/resource_loader.h"
#include "io/resource_saver.h"
/**
@@ -49,3 +51,4 @@ public:
};
#endif
+#endif
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 7e8a033c40..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"
@@ -230,7 +231,6 @@
#include "scene/resources/scene_format_text.h"
-static ResourceFormatLoaderImage *resource_loader_image=NULL;
//static ResourceFormatLoaderWAV *resource_loader_wav=NULL;
@@ -245,6 +245,8 @@ static ResourceFormatLoaderText *resource_loader_text=NULL;
static ResourceFormatLoaderDynamicFont *resource_loader_dynamic_font=NULL;
+static ResourceFormatLoaderStreamTexture *resource_loader_stream_texture=NULL;
+
//static SceneStringNames *string_names;
void register_scene_types() {
@@ -255,14 +257,14 @@ void register_scene_types() {
Node::init_node_hrcr();
- resource_loader_image = memnew( ResourceFormatLoaderImage );
- ResourceLoader::add_resource_format_loader( resource_loader_image );
-
//resource_loader_wav = memnew( ResourceFormatLoaderWAV );
//ResourceLoader::add_resource_format_loader( resource_loader_wav );
resource_loader_dynamic_font = memnew( ResourceFormatLoaderDynamicFont );
ResourceLoader::add_resource_format_loader( resource_loader_dynamic_font );
+ resource_loader_stream_texture = memnew( ResourceFormatLoaderStreamTexture);
+ ResourceLoader::add_resource_format_loader( resource_loader_stream_texture );
+
#ifdef TOOLS_ENABLED
//scene first!
@@ -570,6 +572,7 @@ void register_scene_types() {
ClassDB::register_virtual_class<Texture>();
ClassDB::register_virtual_class<SkyBox>();
ClassDB::register_class<ImageSkyBox>();
+ ClassDB::register_class<StreamTexture>();
ClassDB::register_class<ImageTexture>();
ClassDB::register_class<AtlasTexture>();
ClassDB::register_class<LargeTexture>();
@@ -594,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
@@ -643,9 +647,9 @@ void unregister_scene_types() {
clear_default_theme();
- memdelete( resource_loader_image );
// memdelete( resource_loader_wav );
memdelete( resource_loader_dynamic_font );
+ memdelete( resource_loader_stream_texture );
#ifdef TOOLS_ENABLED
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/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index a913687e7f..9719f321d6 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -32,7 +32,8 @@
#include "version.h"
#include "os/dir_access.h"
-#define FORMAT_VERSION 1
+//version 2: changed names for basis, rect3, poolvectors, etc.
+#define FORMAT_VERSION 2
#include "version.h"
#include "os/dir_access.h"
@@ -1158,7 +1159,7 @@ void ResourceFormatSaverTextInstance::_find_resources(const Variant& p_variant,b
static String _valprop(const String& p_name) {
if (p_name.find("\"")!=-1 || p_name.find("=")!=-1 || p_name.find(" ")!=-1)
- return "\""+p_name.c_escape()+"\"";
+ return "\""+p_name.c_escape_multiline()+"\"";
return p_name;
}
@@ -1360,13 +1361,11 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path,const RES& p_re
}
if (groups.size()) {
- String sgroups=" groups=[ ";
+ String sgroups=" groups=[\n";
for(int j=0;j<groups.size();j++) {
- if (j>0)
- sgroups+=", ";
- sgroups+="\""+groups[j].operator String().c_escape()+"\"";
+ sgroups+="\""+String(groups[j]).c_escape()+"\",\n";
}
- sgroups+=" ]";
+ sgroups+="]";
header+=sgroups;
}
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index a1ad5d8237..fa89b7ba00 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -453,6 +453,379 @@ ImageTexture::~ImageTexture() {
VisualServer::get_singleton()->free( texture );
}
+//////////////////////////////////////////
+
+
+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 {
+
+ return flags;
+}
+Image::Format StreamTexture::get_format() const {
+
+ return format;
+}
+
+
+Error StreamTexture::_load_data(const String& p_path,int &tw,int &th,int& flags,Image& image,int p_size_limit) {
+
+
+ FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
+ ERR_FAIL_COND_V(!f,ERR_CANT_OPEN);
+
+ uint8_t header[4];
+ f->get_buffer(header,4);
+ if (header[0]!='G' || header[1]!='D' || header[2]!='S' || header[3]!='T') {
+ memdelete(f);
+ ERR_FAIL_COND_V(header[0]!='G' || header[1]!='D' || header[2]!='S' || header[3]!='T',ERR_FILE_CORRUPT);
+ }
+
+ tw = f->get_32();
+ th = f->get_32();
+ flags= f->get_32(); //texture flags!
+ uint32_t df = f->get_32(); //data format
+
+ print_line("width: "+itos(tw));
+ print_line("height: "+itos(th));
+ 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;
+ }
+
+
+ if (df&FORMAT_BIT_LOSSLESS || df&FORMAT_BIT_LOSSY) {
+ //look for a PNG or WEBP file inside
+
+ int sw=tw;
+ int sh=th;
+
+ uint32_t mipmaps = f->get_32();
+ uint32_t size = f->get_32();
+
+ print_line("mipmaps: "+itos(mipmaps));
+
+ while(mipmaps>1 && p_size_limit>0 && (sw>p_size_limit || sh>p_size_limit)) {
+
+ f->seek(f->get_pos()+size);
+ mipmaps = f->get_32();
+ size = f->get_32();
+
+ sw=MAX(sw>>1,1);
+ sh=MAX(sh>>1,1);
+ mipmaps--;
+ }
+
+ //mipmaps need to be read independently, they will be later combined
+ Vector<Image> mipmap_images;
+ int total_size=0;
+
+ for(int i=0;i<mipmaps;i++) {
+ PoolVector<uint8_t> pv;
+ pv.resize(size);
+ {
+ PoolVector<uint8_t>::Write w = pv.write();
+ f->get_buffer(w.ptr(),size);
+ }
+
+ Image img;
+ if (df&FORMAT_BIT_LOSSLESS) {
+ img = Image::lossless_unpacker(pv);
+ } else {
+ img = Image::lossy_unpacker(pv);
+ }
+
+ if (img.empty()) {
+ memdelete(f);
+ ERR_FAIL_COND_V(img.empty(),ERR_FILE_CORRUPT);
+ }
+ total_size+=img.get_data().size();
+
+ mipmap_images.push_back(img);
+ }
+
+ print_line("mipmap read total: "+itos(mipmap_images.size()));
+
+
+ memdelete(f); //no longer needed
+
+ if (mipmap_images.size()==1) {
+
+ image=mipmap_images[0];
+ return OK;
+
+ } else {
+ PoolVector<uint8_t> img_data;
+ img_data.resize(total_size);
+
+ {
+ PoolVector<uint8_t>::Write w=img_data.write();
+
+ int ofs=0;
+ for(int i=0;i<mipmap_images.size();i++) {
+
+ PoolVector<uint8_t> id = mipmap_images[i].get_data();
+ int len = id.size();
+ PoolVector<uint8_t>::Read r = id.read();
+ copymem(&w[ofs],r.ptr(),len);
+ ofs+=len;
+ }
+ }
+
+ image = Image(sw,sh,true,mipmap_images[0].get_format(),img_data);
+ return OK;
+ }
+
+ } else {
+
+ //look for regular format
+ Image::Format format = (Image::Format)(df&FORMAT_MASK_IMAGE_FORMAT);
+ bool mipmaps = df&FORMAT_BIT_HAS_MIPMAPS;
+
+ if (!mipmaps) {
+ int size = Image::get_image_data_size(tw,th,format,0);
+
+ PoolVector<uint8_t> img_data;
+ img_data.resize(size);
+
+ {
+ PoolVector<uint8_t>::Write w=img_data.write();
+ f->get_buffer(w.ptr(),size);
+ }
+
+ memdelete(f);
+
+ image = Image(tw,th,false,format,img_data);
+ return OK;
+ } else {
+
+ int sw=tw;
+ int sh=th;
+
+ int mipmaps = Image::get_image_required_mipmaps(tw,th,format);
+ int total_size = Image::get_image_data_size(tw,th,format,mipmaps);
+ int idx=0;
+ int ofs=0;
+
+
+ while(mipmaps>1 && p_size_limit>0 && (sw>p_size_limit || sh>p_size_limit)) {
+
+ sw=MAX(sw>>1,1);
+ sh=MAX(sh>>1,1);
+ mipmaps--;
+ idx++;
+ }
+
+ if (idx>0) {
+ ofs=Image::get_image_data_size(tw,th,format,idx-1);
+ }
+
+ if (total_size - ofs <=0) {
+ memdelete(f);
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+
+ f->seek(f->get_pos()+ofs);
+
+
+ PoolVector<uint8_t> img_data;
+ img_data.resize(total_size - ofs);
+
+ {
+ 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);
+
+ if (bytes != total_size - ofs) {
+ ERR_FAIL_V(ERR_FILE_CORRUPT);
+ }
+ }
+
+ image = Image(sw,sh,true,format,img_data);
+
+ return OK;
+ }
+ }
+
+ return ERR_BUG; //unreachable
+}
+
+Error StreamTexture::load(const String& p_path) {
+
+
+ int lw,lh,lflags;
+ Image image;
+ Error err = _load_data(p_path,lw,lh,lflags,image);
+ if (err)
+ return err;
+
+ VS::get_singleton()->texture_allocate(texture,image.get_width(),image.get_height(),image.get_format(),lflags);
+ VS::get_singleton()->texture_set_data(texture,image);
+
+ w=lw;
+ h=lh;
+ flags=lflags;
+ path_to_file=p_path;
+ format=image.get_format();
+
+ return OK;
+}
+String StreamTexture::get_load_path() const {
+
+ return path_to_file;
+}
+
+int StreamTexture::get_width() const {
+
+ return w;
+}
+int StreamTexture::get_height() const {
+
+ return h;
+}
+RID StreamTexture::get_rid() const {
+
+ return texture;
+}
+
+
+void StreamTexture::draw(RID p_canvas_item, const Point2& p_pos, const Color& p_modulate, bool p_transpose) const {
+
+ if ((w|h)==0)
+ return;
+ VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item,Rect2( p_pos, Size2(w,h)),texture,false,p_modulate,p_transpose);
+
+}
+void StreamTexture::draw_rect(RID p_canvas_item,const Rect2& p_rect, bool p_tile,const Color& p_modulate, bool p_transpose) const {
+
+ if ((w|h)==0)
+ return;
+ VisualServer::get_singleton()->canvas_item_add_texture_rect(p_canvas_item,p_rect,texture,p_tile,p_modulate,p_transpose);
+
+}
+void StreamTexture::draw_rect_region(RID p_canvas_item,const Rect2& p_rect, const Rect2& p_src_rect,const Color& p_modulate, bool p_transpose) const{
+
+ if ((w|h)==0)
+ return;
+ VisualServer::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item,p_rect,texture,p_src_rect,p_modulate,p_transpose);
+}
+
+bool StreamTexture::has_alpha() const {
+
+ return false;
+}
+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);
+}
+
+void StreamTexture::_bind_methods() {
+
+ ClassDB::bind_method(_MD("load","path"),&StreamTexture::load);
+ ClassDB::bind_method(_MD("get_load_path"),&StreamTexture::get_load_path);
+
+ ADD_PROPERTY( PropertyInfo(Variant::STRING,"load_path",PROPERTY_HINT_FILE,"*.stex"),_SCS("load"),_SCS("get_load_path"));
+}
+
+
+StreamTexture::StreamTexture() {
+
+ format=Image::FORMAT_MAX;
+ flags=0;
+ w=0;
+ h=0;
+
+ texture = VS::get_singleton()->texture_create();
+}
+
+StreamTexture::~StreamTexture() {
+
+ VS::get_singleton()->free(texture);
+}
+
+
+
+RES ResourceFormatLoaderStreamTexture::load(const String &p_path,const String& p_original_path,Error *r_error) {
+
+ Ref<StreamTexture> st;
+ st.instance();
+ Error err = st->load(p_path);
+ if (r_error)
+ *r_error=err;
+ if (err!=OK)
+ return RES();
+
+ return st;
+}
+
+void ResourceFormatLoaderStreamTexture::get_recognized_extensions(List<String> *p_extensions) const{
+
+ p_extensions->push_back("stex");
+}
+bool ResourceFormatLoaderStreamTexture::handles_type(const String& p_type) const{
+ return p_type=="StreamTexture";
+
+}
+String ResourceFormatLoaderStreamTexture::get_resource_type(const String &p_path) const{
+
+ if (p_path.get_extension().to_lower()=="stex")
+ return "StreamTexture";
+ return "";
+}
+
+
+
+
//////////////////////////////////////////
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index aac3514af3..f684aeb658 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -31,6 +31,7 @@
#include "resource.h"
#include "servers/visual_server.h"
+#include "io/resource_loader.h"
#include "math_2d.h"
/**
@@ -160,6 +161,86 @@ public:
};
+
+class StreamTexture : public Texture {
+
+ GDCLASS( StreamTexture, Texture );
+public:
+ enum DataFormat {
+ DATA_FORMAT_IMAGE,
+ DATA_FORMAT_LOSSLESS,
+ DATA_FORMAT_LOSSY
+ };
+
+ enum FormatBits {
+ FORMAT_MASK_IMAGE_FORMAT=(1<<20)-1,
+ FORMAT_BIT_LOSSLESS=1<<20,
+ 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:
+
+ Error _load_data(const String &p_path, int &tw, int &th, int& flags, Image& image, int p_size_limit=0);
+ String path_to_file;
+ RID texture;
+ Image::Format format;
+ uint32_t flags;
+ int w,h;
+
+ virtual void reload_from_file();
+
+ static void _requested_3d(void* p_ud);
+ static void _requested_srgb(void* p_ud);
+
+protected:
+
+ static void _bind_methods();
+
+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);
+ String get_load_path() const;
+
+ int get_width() const;
+ int get_height() const;
+ virtual RID get_rid() const;
+
+ virtual void draw(RID p_canvas_item, const Point2& p_pos, const Color& p_modulate=Color(1,1,1), bool p_transpose=false) const;
+ virtual void draw_rect(RID p_canvas_item,const Rect2& p_rect, bool p_tile=false,const Color& p_modulate=Color(1,1,1), bool p_transpose=false) const;
+ virtual void draw_rect_region(RID p_canvas_item,const Rect2& p_rect, const Rect2& p_src_rect,const Color& p_modulate=Color(1,1,1), bool p_transpose=false) const;
+
+ virtual bool has_alpha() const;
+ virtual void set_flags(uint32_t p_flags);
+
+ StreamTexture();
+ ~StreamTexture();
+
+};
+
+
+class ResourceFormatLoaderStreamTexture : 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;
+
+};
+
+
+
VARIANT_ENUM_CAST( ImageTexture::Storage );
class AtlasTexture : public Texture {
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 43ab246fbc..8a8b9ebf76 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -30,6 +30,17 @@
#include "globals.h"
#include "os/os.h"
#include "servers/audio/effects/audio_effect_compressor.h"
+#include "io/resource_loader.h"
+#include "os/file_access.h"
+#ifdef TOOLS_ENABLED
+
+#define MARK_EDITED set_edited(true);
+
+#else
+
+#define MARK_EDITED
+
+#endif
AudioDriver *AudioDriver::singleton=NULL;
AudioDriver *AudioDriver::get_singleton() {
@@ -324,6 +335,9 @@ void AudioServer::set_bus_count(int p_count) {
ERR_FAIL_COND(p_count<1);
ERR_FAIL_INDEX(p_count,256);
+
+ MARK_EDITED
+
lock();
int cb = buses.size();
@@ -390,6 +404,8 @@ void AudioServer::remove_bus(int p_index) {
ERR_FAIL_INDEX(p_index,buses.size());
ERR_FAIL_COND(p_index==0);
+ MARK_EDITED
+
lock();
bus_map.erase(buses[p_index]->name);
memdelete(buses[p_index]);
@@ -399,6 +415,8 @@ void AudioServer::remove_bus(int p_index) {
void AudioServer::add_bus(int p_at_pos) {
+ MARK_EDITED
+
if (p_at_pos>=buses.size()) {
p_at_pos=-1;
} else if (p_at_pos==0) {
@@ -455,6 +473,8 @@ void AudioServer::move_bus(int p_bus,int p_to_pos) {
ERR_FAIL_COND(p_bus<1 || p_bus>=buses.size());
ERR_FAIL_COND(p_to_pos!=-1 && (p_to_pos<1 || p_to_pos>buses.size()));
+ MARK_EDITED
+
if (p_bus==p_to_pos)
return;
@@ -481,6 +501,9 @@ void AudioServer::set_bus_name(int p_bus,const String& p_name) {
ERR_FAIL_INDEX(p_bus,buses.size());
if (p_bus==0 && p_name!="Master")
return; //bus 0 is always master
+
+ MARK_EDITED
+
lock();
if (buses[p_bus]->name==p_name) {
@@ -526,6 +549,9 @@ String AudioServer::get_bus_name(int p_bus) const {
void AudioServer::set_bus_volume_db(int p_bus,float p_volume_db) {
ERR_FAIL_INDEX(p_bus,buses.size());
+
+ MARK_EDITED
+
buses[p_bus]->volume_db=p_volume_db;
}
@@ -540,6 +566,8 @@ void AudioServer::set_bus_send(int p_bus,const StringName& p_send) {
ERR_FAIL_INDEX(p_bus,buses.size());
+ MARK_EDITED
+
buses[p_bus]->send=p_send;
}
@@ -556,6 +584,8 @@ void AudioServer::set_bus_solo(int p_bus,bool p_enable) {
ERR_FAIL_INDEX(p_bus,buses.size());
+ MARK_EDITED
+
buses[p_bus]->solo=p_enable;
}
@@ -572,6 +602,8 @@ void AudioServer::set_bus_mute(int p_bus,bool p_enable){
ERR_FAIL_INDEX(p_bus,buses.size());
+ MARK_EDITED
+
buses[p_bus]->mute=p_enable;
}
bool AudioServer::is_bus_mute(int p_bus) const{
@@ -586,6 +618,8 @@ void AudioServer::set_bus_bypass_effects(int p_bus,bool p_enable){
ERR_FAIL_INDEX(p_bus,buses.size());
+ MARK_EDITED
+
buses[p_bus]->bypass=p_enable;
}
bool AudioServer::is_bus_bypassing_effects(int p_bus) const{
@@ -618,6 +652,9 @@ void AudioServer::add_bus_effect(int p_bus,const Ref<AudioEffect>& p_effect,int
ERR_FAIL_COND(p_effect.is_null());
ERR_FAIL_INDEX(p_bus,buses.size());
+ MARK_EDITED
+
+
lock();
Bus::Effect fx;
@@ -641,6 +678,9 @@ void AudioServer::remove_bus_effect(int p_bus,int p_effect) {
ERR_FAIL_INDEX(p_bus,buses.size());
+ MARK_EDITED
+
+
lock();
buses[p_bus]->effects.remove(p_effect);
@@ -672,6 +712,9 @@ void AudioServer::swap_bus_effects(int p_bus,int p_effect,int p_by_effect) {
ERR_FAIL_INDEX(p_effect,buses[p_bus]->effects.size());
ERR_FAIL_INDEX(p_by_effect,buses[p_bus]->effects.size());
+ MARK_EDITED
+
+
lock();
SWAP( buses[p_bus]->effects[p_effect], buses[p_bus]->effects[p_by_effect] );
_update_bus_effects(p_bus);
@@ -682,6 +725,10 @@ void AudioServer::set_bus_effect_enabled(int p_bus,int p_effect,bool p_enabled)
ERR_FAIL_INDEX(p_bus,buses.size());
ERR_FAIL_INDEX(p_effect,buses[p_bus]->effects.size());
+
+ MARK_EDITED
+
+
buses[p_bus]->effects[p_effect].enabled=p_enabled;
}
@@ -748,8 +795,23 @@ void AudioServer::init() {
if (AudioDriver::get_singleton())
AudioDriver::get_singleton()->start();
+#ifdef TOOLS_ENABLED
+ set_edited(false); //avoid editors from thinking this was edited
+#endif
}
+
+void AudioServer::load_default_bus_layout() {
+
+ if (FileAccess::exists("res://default_bus_layout.tres")) {
+ Ref<AudioBusLayout> default_layout = ResourceLoader::load("res://default_bus_layout.tres");
+ if (default_layout.is_valid()) {
+ set_bus_layout(default_layout);
+ }
+ }
+
+}
+
void AudioServer::finish() {
for(int i=0;i<buses.size();i++) {
@@ -872,6 +934,88 @@ void AudioServer::remove_callback(AudioCallback p_callback,void *p_userdata) {
}
+void AudioServer::set_bus_layout(const Ref<AudioBusLayout> &p_state) {
+
+ ERR_FAIL_COND(p_state.is_null() || p_state->buses.size()==0);
+
+ lock();
+ for(int i=0;i<buses.size();i++) {
+ memdelete(buses[i]);
+ }
+ buses.resize(p_state->buses.size());
+ bus_map.clear();
+ for(int i=0;i<p_state->buses.size();i++) {
+ Bus * bus = memnew(Bus);
+ if (i==0) {
+ bus->name="Master";
+ } else {
+ bus->name=p_state->buses[i].name;
+ bus->send=p_state->buses[i].send;
+ }
+
+ bus->solo=p_state->buses[i].solo;
+ bus->mute=p_state->buses[i].mute;
+ bus->bypass=p_state->buses[i].bypass;
+ bus->volume_db=p_state->buses[i].volume_db;
+
+ for(int j=0;j<p_state->buses[i].effects.size();j++) {
+
+ Ref<AudioEffect> fx = p_state->buses[i].effects[j].effect;
+
+ if (fx.is_valid()) {
+
+ Bus::Effect bfx;
+ bfx.effect=fx;
+ bfx.enabled=p_state->buses[i].effects[j].enabled;
+ bus->effects.push_back(bfx);
+ }
+ }
+
+ bus_map[bus->name]=bus;
+ buses[i]=bus;
+
+ buses[i]->channels.resize(_get_channel_count());
+ for(int j=0;j<_get_channel_count();j++) {
+ buses[i]->channels[j].buffer.resize(buffer_size);
+ }
+ _update_bus_effects(i);
+ }
+#ifdef TOOLS_ENABLED
+ set_edited(false);
+#endif
+ unlock();
+
+}
+
+
+Ref<AudioBusLayout> AudioServer::generate_bus_layout() const {
+
+ Ref<AudioBusLayout> state;
+ state.instance();
+
+ state->buses.resize( buses.size() );
+
+ for(int i=0;i<buses.size();i++) {
+
+ state->buses[i].name=buses[i]->name;
+ state->buses[i].send=buses[i]->send;
+ state->buses[i].mute=buses[i]->mute;
+ state->buses[i].solo=buses[i]->solo;
+ state->buses[i].bypass=buses[i]->bypass;
+ state->buses[i].volume_db=buses[i]->volume_db;
+ for(int j=0;j<buses[i]->effects.size();j++) {
+ AudioBusLayout::Bus::Effect fx;
+ fx.effect=buses[i]->effects[j].effect;
+ fx.enabled=buses[i]->effects[j].enabled;
+ state->buses[i].effects.push_back(fx);
+
+ }
+ }
+
+ return state;
+}
+
+
void AudioServer::_bind_methods() {
@@ -919,6 +1063,9 @@ void AudioServer::_bind_methods() {
ClassDB::bind_method(_MD("get_speaker_mode"),&AudioServer::get_speaker_mode);
ClassDB::bind_method(_MD("get_mix_rate"),&AudioServer::get_mix_rate);
+ ClassDB::bind_method(_MD("set_state","state:AudioServerState"),&AudioServer::set_bus_layout);
+ ClassDB::bind_method(_MD("generate_state:AudioServerState"),&AudioServer::generate_bus_layout);
+
ADD_SIGNAL(MethodInfo("bus_layout_changed") );
}
@@ -938,3 +1085,137 @@ AudioServer::~AudioServer() {
memdelete(audio_data_lock);
}
+/////////////////////////////////
+
+
+
+bool AudioBusLayout::_set(const StringName& p_name, const Variant& p_value) {
+
+ String s = p_name;
+ if (s.begins_with("bus/")) {
+ int index = s.get_slice("/",1).to_int();
+ if (buses.size()<=index) {
+ buses.resize(index+1);
+ }
+
+ Bus &bus = buses[index];
+
+ String what = s.get_slice("/",2);
+
+ if (what=="name") {
+ bus.name=p_value;
+ } else if (what=="solo") {
+ bus.solo=p_value;
+ } else if (what=="mute") {
+ bus.mute=p_value;
+ } else if (what=="bypass_fx") {
+ bus.bypass=p_value;
+ } else if (what=="volume_db") {
+ bus.volume_db=p_value;
+ } else if (what=="send") {
+ bus.send=p_value;
+ } else if (what=="effect") {
+ int which = s.get_slice("/",3).to_int();
+ if (bus.effects.size()<=which) {
+ bus.effects.resize(which+1);
+ }
+
+ Bus::Effect &fx = bus.effects[which];
+
+ String fxwhat = s.get_slice("/",4);
+ if (fxwhat=="effect") {
+ fx.effect=p_value;
+ } else if (fxwhat=="enabled") {
+ fx.enabled=p_value;
+ } else {
+ return false;
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
+
+}
+
+bool AudioBusLayout::_get(const StringName& p_name,Variant &r_ret) const{
+
+ String s = p_name;
+ if (s.begins_with("bus/")) {
+
+ int index = s.get_slice("/",1).to_int();
+ if (index<0 || index>=buses.size())
+ return false;
+
+ const Bus &bus = buses[index];
+
+ String what = s.get_slice("/",2);
+
+ if (what=="name") {
+ r_ret=bus.name;
+ } else if (what=="solo") {
+ r_ret=bus.solo;
+ } else if (what=="mute") {
+ r_ret=bus.mute;
+ } else if (what=="bypass_fx") {
+ r_ret=bus.bypass;
+ } else if (what=="volume_db") {
+ r_ret=bus.volume_db;
+ } else if (what=="send") {
+ r_ret=bus.send;
+ } else if (what=="effect") {
+ int which = s.get_slice("/",3).to_int();
+ if (which<0 || which>=bus.effects.size()) {
+ return false;
+ }
+
+ const Bus::Effect &fx = bus.effects[which];
+
+ String fxwhat = s.get_slice("/",4);
+ if (fxwhat=="effect") {
+ r_ret=fx.effect;
+ } else if (fxwhat=="enabled") {
+ r_ret=fx.enabled;
+ } else {
+ return false;
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
+
+}
+void AudioBusLayout::_get_property_list( List<PropertyInfo> *p_list) const{
+
+ for(int i=0;i<buses.size();i++) {
+ p_list->push_back(PropertyInfo(Variant::STRING,"bus/"+itos(i)+"/name",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::BOOL,"bus/"+itos(i)+"/solo",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::BOOL,"bus/"+itos(i)+"/mute",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::BOOL,"bus/"+itos(i)+"/bypass_fx",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::REAL,"bus/"+itos(i)+"/volume_db",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::REAL,"bus/"+itos(i)+"/send",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+
+ for(int j=0;j<buses[i].effects.size();j++) {
+ p_list->push_back(PropertyInfo(Variant::OBJECT,"bus/"+itos(i)+"/effect/"+itos(j)+"/effect",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ p_list->push_back(PropertyInfo(Variant::BOOL,"bus/"+itos(i)+"/effect/"+itos(j)+"/enabled",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR));
+ }
+ }
+}
+
+
+AudioBusLayout::AudioBusLayout() {
+
+ buses.resize(1);
+ buses[0].name="Master";
+}
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 9de330482b..88849bb591 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -100,7 +100,7 @@ public:
};
-
+class AudioBusLayout;
class AudioServer : public Object {
@@ -205,8 +205,6 @@ private:
Set<CallbackItem> callbacks;
-
-
friend class AudioDriver;
void _driver_process(int p_frames, int32_t *p_buffer);
protected:
@@ -266,6 +264,7 @@ public:
virtual void init();
virtual void finish();
virtual void update();
+ virtual void load_default_bus_layout();
/* MISC config */
@@ -293,13 +292,64 @@ public:
void add_callback(AudioCallback p_callback,void *p_userdata);
void remove_callback(AudioCallback p_callback,void *p_userdata);
+ void set_bus_layout(const Ref<AudioBusLayout>& p_state);
+ Ref<AudioBusLayout> generate_bus_layout() const;
+
AudioServer();
virtual ~AudioServer();
};
-
VARIANT_ENUM_CAST( AudioServer::SpeakerMode )
+class AudioBusLayout : public Resource {
+
+ GDCLASS(AudioBusLayout,Resource)
+
+friend class AudioServer;
+
+ struct Bus {
+
+ StringName name;
+ bool solo;
+ bool mute;
+ bool bypass;
+
+ struct Effect {
+ Ref<AudioEffect> effect;
+ bool enabled;
+ };
+
+ Vector<Effect> effects;
+
+ float volume_db;
+ StringName send;
+
+ Bus() {
+ solo=false;
+ mute=false;
+ bypass=false;
+ volume_db=0;
+ }
+ };
+
+ Vector<Bus> buses;
+
+protected:
+
+ bool _set(const StringName& p_name, const Variant& p_value);
+ bool _get(const StringName& p_name,Variant &r_ret) const;
+ void _get_property_list( List<PropertyInfo> *p_list) const;
+
+public:
+
+ AudioBusLayout();
+};
+
+
+
+
+
+
typedef AudioServer AS;
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/register_server_types.cpp b/servers/register_server_types.cpp
index 56bb0d32b2..01f8ffa504 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -85,6 +85,7 @@ void register_server_types() {
ClassDB::register_virtual_class<AudioStream>();
ClassDB::register_virtual_class<AudioStreamPlayback>();
ClassDB::register_virtual_class<AudioEffect>();
+ ClassDB::register_class<AudioBusLayout>();
{
//audio effects
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
index 767c63ad00..767c63ad00 100644
--- a/tools/editor_fonts/DroidSans.ttf
+++ b/thirdparty/fonts/DroidSans.ttf
Binary files differ
diff --git a/tools/editor_fonts/DroidSansArabic.ttf b/thirdparty/fonts/DroidSansArabic.ttf
index 660e2a9916..660e2a9916 100644
--- a/tools/editor_fonts/DroidSansArabic.ttf
+++ b/thirdparty/fonts/DroidSansArabic.ttf
Binary files differ
diff --git a/tools/editor_fonts/DroidSansFallback.ttf b/thirdparty/fonts/DroidSansFallback.ttf
index 206621fc6c..206621fc6c 100644
--- a/tools/editor_fonts/DroidSansFallback.ttf
+++ b/thirdparty/fonts/DroidSansFallback.ttf
Binary files differ
diff --git a/tools/editor_fonts/DroidSansHebrew.ttf b/thirdparty/fonts/DroidSansHebrew.ttf
index 8d77e3e4cf..8d77e3e4cf 100644
--- a/tools/editor_fonts/DroidSansHebrew.ttf
+++ b/thirdparty/fonts/DroidSansHebrew.ttf
Binary files differ
diff --git a/tools/editor_fonts/DroidSansJapanese.ttf b/thirdparty/fonts/DroidSansJapanese.ttf
index 412fa3de05..412fa3de05 100644
--- a/tools/editor_fonts/DroidSansJapanese.ttf
+++ b/thirdparty/fonts/DroidSansJapanese.ttf
Binary files differ
diff --git a/tools/editor_fonts/DroidSansThai.ttf b/thirdparty/fonts/DroidSansThai.ttf
index f849baeff9..f849baeff9 100644
--- a/tools/editor_fonts/DroidSansThai.ttf
+++ b/thirdparty/fonts/DroidSansThai.ttf
Binary files differ
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
index 4e3b9d0bcd..4e3b9d0bcd 100644
--- a/tools/editor_fonts/source_code_pro.otf
+++ b/thirdparty/fonts/source_code_pro.otf
Binary files differ
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 caf45d25be..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,24 +39,105 @@ 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")
- reg_exporters += '\tregister_' + e + '_exporter();\n'
+ 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'
f = open("register_exporters.cpp", "wb")
@@ -63,18 +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('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_audio_buses.cpp b/tools/editor/editor_audio_buses.cpp
index 425477890e..6ee18f08d8 100644
--- a/tools/editor/editor_audio_buses.cpp
+++ b/tools/editor/editor_audio_buses.cpp
@@ -2,6 +2,8 @@
#include "editor_node.h"
#include "servers/audio_server.h"
#include "os/keyboard.h"
+#include "io/resource_saver.h"
+#include "filesystem_dock.h"
void EditorAudioBus::_notification(int p_what) {
@@ -390,6 +392,9 @@ void EditorAudioBus::_delete_pressed(int p_option) {
if (p_option==1) {
emit_signal("delete_request");
+ } else if (p_option==0) {
+ //duplicate
+ emit_signal("duplicate_request",get_index());
}
}
@@ -598,6 +603,7 @@ void EditorAudioBus::_bind_methods() {
+ ADD_SIGNAL(MethodInfo("duplicate_request"));
ADD_SIGNAL(MethodInfo("delete_request"));
ADD_SIGNAL(MethodInfo("drop_end_request"));
ADD_SIGNAL(MethodInfo("dropped"));
@@ -770,6 +776,7 @@ void EditorAudioBuses::_update_buses() {
}
bus_hb->add_child(audio_bus);
audio_bus->connect("delete_request",this,"_delete_bus",varray(audio_bus),CONNECT_DEFERRED);
+ audio_bus->connect("duplicate_request",this,"_duplicate_bus",varray(),CONNECT_DEFERRED);
audio_bus->connect("drop_end_request",this,"_request_drop_end");
audio_bus->connect("dropped",this,"_drop_at_index",varray(),CONNECT_DEFERRED);
@@ -778,10 +785,11 @@ void EditorAudioBuses::_update_buses() {
}
}
-void EditorAudioBuses::register_editor() {
+EditorAudioBuses *EditorAudioBuses::register_editor() {
EditorAudioBuses * audio_buses = memnew( EditorAudioBuses );
EditorNode::get_singleton()->add_bottom_panel_item("Audio",audio_buses);
+ return audio_buses;
}
void EditorAudioBuses::_notification(int p_what) {
@@ -796,6 +804,29 @@ void EditorAudioBuses::_notification(int p_what) {
drop_end=NULL;
}
}
+
+ if (p_what==NOTIFICATION_PROCESS) {
+
+ //check if anything was edited
+ bool edited = AudioServer::get_singleton()->is_edited();
+ for(int i=0;i<AudioServer::get_singleton()->get_bus_count();i++) {
+ for(int j=0;j<AudioServer::get_singleton()->get_bus_effect_count(i);j++) {
+ Ref<AudioEffect> effect = AudioServer::get_singleton()->get_bus_effect(i,j);
+ if (effect->is_edited()) {
+ edited=true;
+ effect->set_edited(false);
+ }
+ }
+ }
+
+ AudioServer::get_singleton()->set_edited(false);
+
+ if (edited) {
+
+ save_timer->start();
+ }
+ }
+
}
@@ -860,6 +891,31 @@ void EditorAudioBuses::_delete_bus(Object* p_which) {
}
+
+void EditorAudioBuses::_duplicate_bus(int p_which) {
+
+ int add_at_pos = p_which+1;
+ UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
+ ur->create_action("Duplicate Audio Bus");
+ ur->add_do_method(AudioServer::get_singleton(),"add_bus",add_at_pos);
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_name",add_at_pos,AudioServer::get_singleton()->get_bus_name(p_which)+" Copy");
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_volume_db",add_at_pos,AudioServer::get_singleton()->get_bus_volume_db(p_which));
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_send",add_at_pos,AudioServer::get_singleton()->get_bus_send(p_which));
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_solo",add_at_pos,AudioServer::get_singleton()->is_bus_solo(p_which));
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_mute",add_at_pos,AudioServer::get_singleton()->is_bus_mute(p_which));
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_bypass_effects",add_at_pos,AudioServer::get_singleton()->is_bus_bypassing_effects(p_which));
+ for(int i=0;i<AudioServer::get_singleton()->get_bus_effect_count(p_which);i++) {
+
+ ur->add_do_method(AudioServer::get_singleton(),"add_bus_effect",add_at_pos,AudioServer::get_singleton()->get_bus_effect(p_which,i));
+ ur->add_do_method(AudioServer::get_singleton(),"set_bus_effect_enabled",add_at_pos,i,AudioServer::get_singleton()->is_bus_effect_enabled(p_which,i));
+ }
+ ur->add_undo_method(AudioServer::get_singleton(),"remove_bus",add_at_pos);
+ ur->add_do_method(this,"_update_buses");
+ ur->add_undo_method(this,"_update_buses");
+ ur->commit_action();
+
+}
+
void EditorAudioBuses::_request_drop_end() {
if (!drop_end && bus_hb->get_child_count()) {
@@ -896,6 +952,103 @@ void EditorAudioBuses::_drop_at_index(int p_bus,int p_index) {
ur->commit_action();
}
+void EditorAudioBuses::_server_save() {
+
+ Ref<AudioBusLayout> state = AudioServer::get_singleton()->generate_bus_layout();
+ ResourceSaver::save(edited_path,state);
+
+}
+
+void EditorAudioBuses::_select_layout() {
+
+ EditorNode::get_singleton()->get_filesystem_dock()->select_file(edited_path);
+}
+
+void EditorAudioBuses::_save_as_layout() {
+
+ file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ file_dialog->set_title(TTR("Save Audio Bus Layout As.."));
+ file_dialog->set_current_path(edited_path);
+ file_dialog->popup_centered_ratio();
+ new_layout=false;
+}
+
+
+void EditorAudioBuses::_new_layout() {
+
+ file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ file_dialog->set_title(TTR("Location for New Layout.."));
+ file_dialog->set_current_path(edited_path);
+ file_dialog->popup_centered_ratio();
+ new_layout=true;
+}
+
+void EditorAudioBuses::_load_layout() {
+
+ file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
+ file_dialog->set_title(TTR("Open Audio Bus Layout"));
+ file_dialog->set_current_path(edited_path);
+ file_dialog->popup_centered_ratio();
+ new_layout=false;
+}
+
+
+void EditorAudioBuses::_load_default_layout() {
+
+
+ Ref<AudioBusLayout> state = ResourceLoader::load("res://default_bus_layout.tres");
+ if (state.is_null()) {
+ EditorNode::get_singleton()->show_warning("There is no 'res://default_bus_layout.tres' file.");
+ return;
+ }
+
+ edited_path="res://default_bus_layout.tres";
+ file->set_text(edited_path.get_file());
+ AudioServer::get_singleton()->set_bus_layout(state);
+ _update_buses();
+ EditorNode::get_singleton()->get_undo_redo()->clear_history();
+ call_deferred("_select_layout");
+}
+
+void EditorAudioBuses::_file_dialog_callback(const String& p_string) {
+
+ if (file_dialog->get_mode()==EditorFileDialog::MODE_OPEN_FILE) {
+ Ref<AudioBusLayout> state = ResourceLoader::load(p_string);
+ if (state.is_null()) {
+ EditorNode::get_singleton()->show_warning("Invalid file, not an audio bus layout.");
+ return;
+ }
+
+ edited_path=p_string;
+ file->set_text(p_string.get_file());
+ AudioServer::get_singleton()->set_bus_layout(state);
+ _update_buses();
+ EditorNode::get_singleton()->get_undo_redo()->clear_history();
+ call_deferred("_select_layout");
+
+ } else if (file_dialog->get_mode()==EditorFileDialog::MODE_SAVE_FILE) {
+
+ if (new_layout) {
+ Ref<AudioBusLayout> empty_state;
+ empty_state.instance();
+ AudioServer::get_singleton()->set_bus_layout(empty_state);
+ }
+
+ Error err = ResourceSaver::save(p_string,AudioServer::get_singleton()->generate_bus_layout());
+
+ if (err!=OK) {
+ EditorNode::get_singleton()->show_warning("Error saving file: "+p_string);
+ return;
+ }
+
+ edited_path=p_string;
+ file->set_text(p_string.get_file());
+ _update_buses();
+ EditorNode::get_singleton()->get_undo_redo()->clear_history();
+ call_deferred("_select_layout");
+ }
+
+}
void EditorAudioBuses::_bind_methods() {
@@ -906,6 +1059,15 @@ void EditorAudioBuses::_bind_methods() {
ClassDB::bind_method("_delete_bus",&EditorAudioBuses::_delete_bus);
ClassDB::bind_method("_request_drop_end",&EditorAudioBuses::_request_drop_end);
ClassDB::bind_method("_drop_at_index",&EditorAudioBuses::_drop_at_index);
+ ClassDB::bind_method("_server_save",&EditorAudioBuses::_server_save);
+ ClassDB::bind_method("_select_layout",&EditorAudioBuses::_select_layout);
+ ClassDB::bind_method("_save_as_layout",&EditorAudioBuses::_save_as_layout);
+ ClassDB::bind_method("_load_layout",&EditorAudioBuses::_load_layout);
+ ClassDB::bind_method("_load_default_layout",&EditorAudioBuses::_load_default_layout);
+ ClassDB::bind_method("_new_layout",&EditorAudioBuses::_new_layout);
+ ClassDB::bind_method("_duplicate_bus",&EditorAudioBuses::_duplicate_bus);
+
+ ClassDB::bind_method("_file_dialog_callback",&EditorAudioBuses::_file_dialog_callback);
}
EditorAudioBuses::EditorAudioBuses()
@@ -917,25 +1079,38 @@ EditorAudioBuses::EditorAudioBuses()
add = memnew( Button );
top_hb->add_child(add);;
- add->set_text(TTR("Add"));
+ add->set_text(TTR("Add Bus"));
add->connect("pressed",this,"_add_bus");
- Ref<ButtonGroup> bg;
- bg.instance();
- buses = memnew( ToolButton );
- top_hb->add_child(buses);
- buses->set_text(TTR("Buses"));
- buses->set_button_group(bg);
- buses->set_toggle_mode(true);
- buses->set_pressed(true);
- groups = memnew( ToolButton );
- top_hb->add_child(groups);
- groups->set_text(TTR("Groups"));
- groups->set_button_group(bg);
- groups->set_toggle_mode(true);
+ top_hb->add_spacer();
+
+ file = memnew( ToolButton );
+ file->set_text("default_bus_layout.tres");
+ top_hb->add_child(file);
+ file->connect("pressed",this,"_select_layout");
+
+ load = memnew( Button );
+ load->set_text(TTR("Load"));
+ top_hb->add_child(load);
+ load->connect("pressed",this,"_load_layout");
+
+ save_as = memnew( Button );
+ save_as->set_text(TTR("Save As"));
+ top_hb->add_child(save_as);
+ save_as->connect("pressed",this,"_save_as_layout");
+
+ _default = memnew( Button );
+ _default->set_text(TTR("Default"));
+ top_hb->add_child(_default);
+ _default->connect("pressed",this,"_load_default_layout");
+
+ _new = memnew( Button );
+ _new->set_text(TTR("Create"));
+ top_hb->add_child(_new);
+ _new->connect("pressed",this,"_new_layout");
bus_scroll = memnew( ScrollContainer );
bus_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -945,18 +1120,73 @@ EditorAudioBuses::EditorAudioBuses()
bus_hb = memnew( HBoxContainer );
bus_scroll->add_child(bus_hb);
- group_scroll = memnew( ScrollContainer );
- group_scroll->set_v_size_flags(SIZE_EXPAND_FILL);
- group_scroll->set_enable_h_scroll(true);
- group_scroll->set_enable_v_scroll(false);
- add_child(group_scroll);
- group_hb = memnew( HBoxContainer );
- group_scroll->add_child(group_hb);
+ save_timer=memnew(Timer);
+ save_timer->set_wait_time(0.8);
+ save_timer->set_one_shot(true);
+ add_child(save_timer);
+ save_timer->connect("timeout",this,"_server_save");
- group_scroll->hide();
+ set_v_size_flags(SIZE_EXPAND_FILL);
- set_v_size_flags(SIZE_EXPAND_FILL);
+ edited_path = "res://default_bus_layout.tres";
+
+ file_dialog = memnew( EditorFileDialog );
+ List<String> ext;
+ ResourceLoader::get_recognized_extensions_for_type("AudioServerState",&ext);
+ for (List<String>::Element *E=ext.front();E;E=E->next()) {
+ file_dialog->add_filter("*."+E->get()+"; Audio Bus State");
+ }
+ add_child(file_dialog);
+ file_dialog->connect("file_selected",this,"_file_dialog_callback");
+
+ set_process(true);
+
+}
+void EditorAudioBuses::open_layout(const String& p_path) {
+
+ EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
+
+ Ref<AudioBusLayout> state = ResourceLoader::load(p_path);
+ if (state.is_null()) {
+ EditorNode::get_singleton()->show_warning("Invalid file, not an audio bus layout.");
+ return;
+ }
+
+ edited_path=p_path;
+ file->set_text(p_path.get_file());
+ AudioServer::get_singleton()->set_bus_layout(state);
+ _update_buses();
+ EditorNode::get_singleton()->get_undo_redo()->clear_history();
+ call_deferred("_select_layout");
+}
+
+void AudioBusesEditorPlugin::edit(Object *p_node) {
+
+ if (p_node->cast_to<AudioBusLayout>()) {
+
+ String path = p_node->cast_to<AudioBusLayout>()->get_path();
+ if (path.is_resource_file()) {
+ audio_bus_editor->open_layout(path);
+ }
+ }
+}
+
+bool AudioBusesEditorPlugin::handles(Object *p_node) const {
+
+ return (p_node->cast_to<AudioBusLayout>()!=NULL);
+}
+
+void AudioBusesEditorPlugin::make_visible(bool p_visible){
+
+
+}
+
+AudioBusesEditorPlugin::AudioBusesEditorPlugin(EditorAudioBuses *p_node) {
+
+ audio_bus_editor=p_node;
+}
+AudioBusesEditorPlugin::~AudioBusesEditorPlugin() {
}
diff --git a/tools/editor/editor_audio_buses.h b/tools/editor/editor_audio_buses.h
index c6621c08d8..e44f8cd579 100644
--- a/tools/editor/editor_audio_buses.h
+++ b/tools/editor/editor_audio_buses.h
@@ -14,6 +14,8 @@
#include "scene/gui/tree.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel.h"
+#include "tools/editor/editor_file_dialog.h"
+#include "editor_plugin.h"
class EditorAudioBuses;
@@ -109,36 +111,76 @@ class EditorAudioBuses : public VBoxContainer {
HBoxContainer *top_hb;
Button *add;
- ToolButton *buses;
- ToolButton *groups;
ScrollContainer *bus_scroll;
HBoxContainer *bus_hb;
- ScrollContainer *group_scroll;
- HBoxContainer *group_hb;
EditorAudioBusDrop *drop_end;
+ Button *file;
+ Button *load;
+ Button *save_as;
+ Button *_default;
+ Button *_new;
+
+ Timer *save_timer;
+ String edited_path;
+
void _add_bus();
void _update_buses();
void _update_bus(int p_index);
void _update_sends();
void _delete_bus(Object* p_which);
+ void _duplicate_bus(int p_which);
+
void _request_drop_end();
void _drop_at_index(int p_bus,int p_index);
+ void _server_save();
+
+ void _select_layout();
+ void _load_layout();
+ void _save_as_layout();
+ void _load_default_layout();
+ void _new_layout();
+
+ EditorFileDialog *file_dialog;
+ bool new_layout;
+
+ void _file_dialog_callback(const String& p_string);
+
protected:
static void _bind_methods();
void _notification(int p_what);
public:
+ void open_layout(const String& p_path);
-
- static void register_editor();
+ static EditorAudioBuses* register_editor();
EditorAudioBuses();
};
+
+
+class AudioBusesEditorPlugin : public EditorPlugin {
+
+ GDCLASS( AudioBusesEditorPlugin, EditorPlugin );
+
+ EditorAudioBuses *audio_bus_editor;
+public:
+
+ virtual String get_name() const { return "SampleLibrary"; }
+ bool has_main_screen() const { return false; }
+ virtual void edit(Object *p_node);
+ virtual bool handles(Object *p_node) const;
+ virtual void make_visible(bool p_visible);
+
+ AudioBusesEditorPlugin(EditorAudioBuses *p_node);
+ ~AudioBusesEditorPlugin();
+
+};
+
#endif // EDITORAUDIOBUSES_H
diff --git a/tools/editor/editor_data.cpp b/tools/editor/editor_data.cpp
index 44de1836b6..ef839d7e74 100644
--- a/tools/editor/editor_data.cpp
+++ b/tools/editor/editor_data.cpp
@@ -769,26 +769,6 @@ Dictionary EditorData::restore_edited_scene_state(EditorSelection *p_selection,
}
-void EditorData::set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_mdata) {
-
- ERR_FAIL_INDEX(current_edited_scene,edited_scene.size());
- edited_scene[current_edited_scene].medatata=p_mdata;
-
-}
-
-Ref<ResourceImportMetadata> EditorData::get_edited_scene_import_metadata(int idx) const{
-
- ERR_FAIL_INDEX_V(current_edited_scene,edited_scene.size(),Ref<ResourceImportMetadata>());
- if(idx<0) {
- return edited_scene[current_edited_scene].medatata;
- } else {
- ERR_FAIL_INDEX_V(idx,edited_scene.size(),Ref<ResourceImportMetadata>());
- return edited_scene[idx].medatata;
- }
-}
-
-
-
void EditorData::clear_edited_scenes() {
for(int i=0;i<edited_scene.size();i++) {
diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h
index f0bc5983a2..fce606f722 100644
--- a/tools/editor/editor_data.h
+++ b/tools/editor/editor_data.h
@@ -129,7 +129,6 @@ private:
struct EditedScene {
Node* root;
Dictionary editor_states;
- Ref<ResourceImportMetadata> medatata;
List<Node*> selection;
Vector<EditorHistory::History> history_stored;
int history_current;
@@ -184,8 +183,6 @@ public:
void remove_scene(int p_idx);
void set_edited_scene(int p_idx);
void set_edited_scene_root(Node* p_root);
- void set_edited_scene_import_metadata(Ref<ResourceImportMetadata> p_mdata);
- Ref<ResourceImportMetadata> get_edited_scene_import_metadata(int p_idx = -1) const;
int get_edited_scene() const;
Node* get_edited_scene_root(int p_idx = -1);
int get_edited_scene_count() const;
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index 39869beef4..c7b50a3c09 100644
--- a/tools/editor/editor_file_system.cpp
+++ b/tools/editor/editor_file_system.cpp
@@ -34,8 +34,10 @@
#include "os/file_access.h"
#include "editor_node.h"
#include "io/resource_saver.h"
+#include "io/resource_import.h"
#include "editor_settings.h"
#include "editor_resource_preview.h"
+#include "variant_parser.h"
EditorFileSystem *EditorFileSystem::singleton=NULL;
@@ -115,74 +117,12 @@ String EditorFileSystemDirectory::get_file_path(int p_idx) const {
return "res://"+file;
}
-bool EditorFileSystemDirectory::get_file_meta(int p_idx) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),"");
- return files[p_idx]->meta.enabled;
-}
Vector<String> EditorFileSystemDirectory::get_file_deps(int p_idx) const {
ERR_FAIL_INDEX_V(p_idx,files.size(),Vector<String>());
- return files[p_idx]->meta.deps;
-
-}
-Vector<String> EditorFileSystemDirectory::get_missing_sources(int p_idx) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),Vector<String>());
- Vector<String> missing;
- for(int i=0;i<files[p_idx]->meta.sources.size();i++) {
- if (files[p_idx]->meta.sources[i].missing)
- missing.push_back(files[p_idx]->meta.sources[i].path);
- }
-
- return missing;
-
-
-}
-bool EditorFileSystemDirectory::is_missing_sources(int p_idx) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),false);
- for(int i=0;i<files[p_idx]->meta.sources.size();i++) {
- if (files[p_idx]->meta.sources[i].missing)
- return true;
- }
-
- return false;
-}
+ return files[p_idx]->deps;
-bool EditorFileSystemDirectory::have_sources_changed(int p_idx) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),false);
- return files[p_idx]->meta.sources_changed;
-
-}
-
-int EditorFileSystemDirectory::get_source_count(int p_idx) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),0);
- if (!files[p_idx]->meta.enabled)
- return 0;
- return files[p_idx]->meta.sources.size();
-}
-String EditorFileSystemDirectory::get_source_file(int p_idx,int p_source) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),String());
- ERR_FAIL_INDEX_V(p_source,files[p_idx]->meta.sources.size(),String());
- if (!files[p_idx]->meta.enabled)
- return String();
-
- return files[p_idx]->meta.sources[p_source].path;
-
-}
-bool EditorFileSystemDirectory::is_source_file_missing(int p_idx,int p_source) const {
-
- ERR_FAIL_INDEX_V(p_idx,files.size(),false);
- ERR_FAIL_INDEX_V(p_source,files[p_idx]->meta.sources.size(),false);
- if (!files[p_idx]->meta.enabled)
- return false;
-
- return files[p_idx]->meta.sources[p_source].missing;
}
@@ -210,7 +150,6 @@ void EditorFileSystemDirectory::_bind_methods() {
ClassDB::bind_method(_MD("get_file","idx"),&EditorFileSystemDirectory::get_file);
ClassDB::bind_method(_MD("get_file_path","idx"),&EditorFileSystemDirectory::get_file_path);
ClassDB::bind_method(_MD("get_file_type","idx"),&EditorFileSystemDirectory::get_file_type);
- ClassDB::bind_method(_MD("is_missing_sources","idx"),&EditorFileSystemDirectory::is_missing_sources);
ClassDB::bind_method(_MD("get_name"),&EditorFileSystemDirectory::get_name);
ClassDB::bind_method(_MD("get_path"),&EditorFileSystemDirectory::get_path);
ClassDB::bind_method(_MD("get_parent:EditorFileSystemDirectory"),&EditorFileSystemDirectory::get_parent);
@@ -244,39 +183,6 @@ EditorFileSystemDirectory::~EditorFileSystemDirectory() {
-
-EditorFileSystemDirectory::ImportMeta EditorFileSystem::_get_meta(const String& p_path) {
-
- Ref<ResourceImportMetadata> imd = ResourceLoader::load_import_metadata(p_path);
- EditorFileSystemDirectory::ImportMeta m;
- if (imd.is_null()) {
- m.enabled=false;
- m.sources_changed=false;
- } else {
- m.enabled=true;
- m.sources_changed=false;
-
- for(int i=0;i<imd->get_source_count();i++) {
- EditorFileSystemDirectory::ImportMeta::Source s;
- s.path=imd->get_source_path(i);
- s.md5=imd->get_source_md5(i);
- s.modified_time=0;
- s.missing=false;
- m.sources.push_back(s);
- }
- m.import_editor=imd->get_editor();
- }
-
- List<String> deps;
- ResourceLoader::get_dependencies(p_path,&deps);
- for(List<String>::Element *E=deps.front();E;E=E->next()) {
- m.deps.push_back(E->get());
- }
-
- return m;
-}
-
-
void EditorFileSystem::_scan_filesystem() {
ERR_FAIL_COND(!scanning || new_filesystem);
@@ -289,7 +195,7 @@ void EditorFileSystem::_scan_filesystem() {
String project=GlobalConfig::get_singleton()->get_resource_path();
- String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache");
+ String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache2");
FileAccess *f =FileAccess::open(fscache,FileAccess::READ);
if (f) {
@@ -319,30 +225,14 @@ void EditorFileSystem::_scan_filesystem() {
FileCache fc;
fc.type=split[1];
fc.modification_time=split[2].to_int64();
- String meta = split[3].strip_edges();
- fc.meta.enabled=false;
- if (meta.find("<>")!=-1){
- Vector<String> spl = meta.split("<>");
- int sc = spl.size()-1;
- if (sc%3==0){
- fc.meta.enabled=true;
- fc.meta.import_editor=spl[0];
- fc.meta.sources.resize(sc/3);
- for(int i=0;i<fc.meta.sources.size();i++) {
- fc.meta.sources[i].path=spl[1+i*3+0];
- fc.meta.sources[i].md5=spl[1+i*3+1];
- fc.meta.sources[i].modified_time=spl[1+i*3+2].to_int64();
- }
-
- }
+ fc.import_modification_time = split[3].to_int64();
- }
String deps = split[4].strip_edges();
if (deps.length()) {
Vector<String> dp = deps.split("<>");
for(int i=0;i<dp.size();i++) {
String path=dp[i];
- fc.meta.deps.push_back(path);
+ fc.deps.push_back(path);
}
}
@@ -390,7 +280,14 @@ void EditorFileSystem::_scan_filesystem() {
}
+void EditorFileSystem::_save_filesystem_cache() {
+ String fscache = EditorSettings::get_singleton()->get_project_settings_path().plus_file("filesystem_cache2");
+ FileAccess *f=FileAccess::open(fscache,FileAccess::WRITE);
+ _save_filesystem_cache(filesystem,f);
+ f->close();
+ memdelete(f);
+}
void EditorFileSystem::_thread_func(void *_userdata) {
@@ -405,6 +302,8 @@ bool EditorFileSystem::_update_scan_actions() {
bool fs_changed=false;
+ Vector<String> reimports;
+
for (List<ItemAction>::Element *E=scan_actions.front();E;E=E->next()) {
ItemAction&ia = E->get();
@@ -469,18 +368,25 @@ bool EditorFileSystem::_update_scan_actions() {
//print_line("*ACTION REMOVE FILE: "+ia.file);
} break;
- case ItemAction::ACTION_FILE_SOURCES_CHANGED: {
+ case ItemAction::ACTION_FILE_REIMPORT: {
+
int idx = ia.dir->find_file_index(ia.file);
ERR_CONTINUE(idx==-1);
String full_path = ia.dir->get_file_path(idx);
- sources_changed.push_back(full_path);
+ reimports.push_back(full_path);
+ fs_changed=true;
} break;
}
}
+
+ if (reimports.size()) {
+ reimport_files(reimports);
+
+ }
scan_actions.clear();
return fs_changed;
@@ -492,9 +398,10 @@ void EditorFileSystem::scan() {
if (false /*&& bool(Globals::get_singleton()->get("debug/disable_scan"))*/)
return;
- if (scanning || scanning_sources|| thread)
+ if (scanning || scanning_changes|| thread)
return;
+ _update_extensions();
abort_scan=false;
if (!use_threads) {
@@ -529,42 +436,6 @@ void EditorFileSystem::scan() {
}
-bool EditorFileSystem::_check_meta_sources(EditorFileSystemDirectory::ImportMeta & p_meta) {
-
- if (p_meta.enabled) {
-
- for(int j=0;j<p_meta.sources.size();j++) {
-
-
- String src = EditorImportPlugin::expand_source_path(p_meta.sources[j].path);
-
- if (!FileAccess::exists(src)) {
- p_meta.sources[j].missing=true;
- continue;
- }
-
- p_meta.sources[j].missing=false;
-
- uint64_t mt = FileAccess::get_modified_time(src);
-
- if (mt!=p_meta.sources[j].modified_time) {
- //scan
- String md5 = FileAccess::get_md5(src);
- //print_line("checking: "+src);
- //print_line("md5: "+md5);
- //print_line("vs: "+p_meta.sources[j].md5);
- if (md5!=p_meta.sources[j].md5) {
- //really changed
- return true;
- }
- p_meta.sources[j].modified_time=mt;
- }
- }
- }
-
- return false;
-}
-
void EditorFileSystem::ScanProgress::update(int p_current,int p_total) const {
float ratio = low + ((hi-low)/p_total)*p_current;
@@ -580,9 +451,75 @@ EditorFileSystem::ScanProgress EditorFileSystem::ScanProgress::get_sub(int p_cur
sp.hi=slice;
return sp;
-
}
+bool EditorFileSystem::_check_missing_imported_files(const String& p_path) {
+
+ if (!reimport_on_missing_imported_files)
+ return true;
+
+ Error err;
+ FileAccess *f= FileAccess::open(p_path+".import",FileAccess::READ,&err);
+
+ if (!f) {
+ print_line("could not open import for "+p_path);
+ return false;
+ }
+
+ VariantParser::StreamFile stream;
+ stream.f=f;
+
+ String assign;
+ Variant value;
+ VariantParser::Tag next_tag;
+
+ int lines=0;
+ String error_text;
+
+ List<String> to_check;
+
+ while(true) {
+
+ assign=Variant();
+ next_tag.fields.clear();
+ next_tag.name=String();
+
+ err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
+ if (err==ERR_FILE_EOF) {
+ memdelete(f);
+ return OK;
+ }
+ else if (err!=OK) {
+ ERR_PRINTS("ResourceFormatImporter::load - "+p_path+".import:"+itos(lines)+" error: "+error_text);
+ memdelete(f);
+ return false;
+ }
+
+ if (assign!=String()) {
+ if (assign.begins_with("path")) {
+ to_check.push_back(value);
+ } else if (assign=="files") {
+ Array fa = value;
+ for(int i=0;i<fa.size();i++) {
+ to_check.push_back(fa[i]);
+ }
+ }
+
+ } else if (next_tag.name!="remap" && next_tag.name!="deps") {
+ break;
+ }
+ }
+
+ memdelete(f);
+
+ for (List<String>::Element *E=to_check.front();E;E=E->next()) {
+ if (!FileAccess::exists(E->get())) {
+ print_line("missing "+E->get()+", reimport" );
+ return false;
+ }
+ }
+ return true;
+}
void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess *da,const ScanProgress& p_progress) {
@@ -607,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);
@@ -671,9 +608,11 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
for (List<String>::Element*E=files.front();E;E=E->next(),idx++) {
+
String ext = E->get().get_extension().to_lower();
- if (!valid_extensions.has(ext))
+ if (!valid_extensions.has(ext)) {
continue; //invalid
+ }
EditorFileSystemDirectory::FileInfo *fi = memnew( EditorFileSystemDirectory::FileInfo );
fi->file=E->get();
@@ -683,32 +622,59 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
FileCache *fc = file_cache.getptr(path);
uint64_t mt = FileAccess::get_modified_time(path);
- if (fc && fc->modification_time == mt) {
+ if (import_extensions.has(ext)) {
- fi->meta=fc->meta;
- fi->type=fc->type;
- fi->modified_time=fc->modification_time;
- } else {
- fi->meta=_get_meta(path);
- fi->type=ResourceLoader::get_resource_type(path);
- fi->modified_time=mt;
+ //is imported
+ uint64_t import_mt=0;
+ if (FileAccess::exists(path+".import")) {
+ import_mt=FileAccess::get_modified_time(path+".import");
+ }
- }
- if (fi->meta.enabled) {
- if (_check_meta_sources(fi->meta)) {
+ if (fc && fc->modification_time==mt && fc->import_modification_time==import_mt && _check_missing_imported_files(path)) {
+
+ fi->type=fc->type;
+ fi->modified_time=fc->modification_time;
+ fi->import_modified_time=fc->import_modification_time;
+
+ } else {
+
+ 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;
+
ItemAction ia;
- ia.action=ItemAction::ACTION_FILE_SOURCES_CHANGED;
+ ia.action=ItemAction::ACTION_FILE_REIMPORT;
ia.dir=p_dir;
ia.file=E->get();
scan_actions.push_back(ia);
- fi->meta.sources_changed=true;
- } else {
- fi->meta.sources_changed=false;
}
-
} else {
- fi->meta.sources_changed=true;
+ //not imported, so just update type if changed
+ if (fc && fc->modification_time == mt) {
+
+ fi->type=fc->type;
+ fi->modified_time=fc->modification_time;
+ fi->import_modified_time=0;
+ } else {
+ fi->type=ResourceLoader::get_resource_type(path);
+ fi->modified_time=mt;
+ fi->import_modified_time=0;
+ }
}
p_dir->files.push_back(fi);
@@ -718,11 +684,13 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
}
+
void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const ScanProgress& p_progress) {
uint64_t current_mtime = FileAccess::get_modified_time(p_dir->get_path());
bool updated_dir=false;
+ String cd = p_dir->get_path();
//print_line("dir: "+p_dir->get_path()+" MODTIME: "+itos(p_dir->modified_time)+" CTIME: "+itos(current_mtime));
@@ -747,7 +715,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
//then scan files and directories and check what's different
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- String cd = p_dir->get_path();
+
da->change_dir(cd);
da->list_dir_begin();
while (true) {
@@ -765,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 );
@@ -803,7 +771,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
String path = cd.plus_file(fi->file);
fi->modified_time=FileAccess::get_modified_time(path);
- fi->meta=_get_meta(path);
+ fi->import_modified_time=0;
fi->type=ResourceLoader::get_resource_type(path);
{
@@ -813,19 +781,22 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
ia.file=f;
ia.new_file=fi;
scan_actions.push_back(ia);
- }
- //take the chance and scan sources
- if (_check_meta_sources(fi->meta)) {
+ }
+
+ 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_SOURCES_CHANGED;
+ ia.action=ItemAction::ACTION_FILE_REIMPORT;
ia.dir=p_dir;
ia.file=f;
scan_actions.push_back(ia);
- fi->meta.sources_changed=true;
- } else {
- fi->meta.sources_changed=false;
}
} else {
@@ -855,15 +826,43 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
}
- if (_check_meta_sources(p_dir->files[i]->meta)) {
- ItemAction ia;
- ia.action=ItemAction::ACTION_FILE_SOURCES_CHANGED;
- ia.dir=p_dir;
- ia.file=p_dir->files[i]->file;
- scan_actions.push_back(ia);
- p_dir->files[i]->meta.sources_changed=true;
- } else {
- p_dir->files[i]->meta.sources_changed=false;
+ if (import_extensions.has(p_dir->files[i]->file.get_extension().to_lower())) {
+ //check here if file must be imported or not
+
+ String path = cd.plus_file(p_dir->files[i]->file);
+
+ uint64_t mt = FileAccess::get_modified_time(path);
+
+ bool reimport=false;
+
+ if (mt!=p_dir->files[i]->modified_time) {
+ print_line("REIMPORT: modified time changed, reimport");
+ reimport=true; //it was modified, must be reimported.
+ } else if (!FileAccess::exists(path+".import")) {
+ print_line("REIMPORT: no .import exists, reimport");
+ reimport=true; //no .import file, obviously reimport
+ } 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;
+ } else if (!_check_missing_imported_files(path)) {
+ print_line("REIMPORT: imported files removed");
+ reimport=true;
+ }
+ }
+
+ if (reimport) {
+
+ ItemAction ia;
+ ia.action=ItemAction::ACTION_FILE_REIMPORT;
+ ia.dir=p_dir;
+ ia.file=p_dir->files[i]->file;
+ scan_actions.push_back(ia);
+ }
+
}
EditorResourcePreview::get_singleton()->check_for_invalidation(p_dir->get_file_path(i));
@@ -896,7 +895,7 @@ void EditorFileSystem::_thread_func_sources(void *_userdata) {
sp.low=0;
efs->_scan_fs_changes(efs->filesystem,sp);
}
- efs->scanning_sources_done=true;
+ efs->scanning_changes_done=true;
}
void EditorFileSystem::get_changed_sources(List<String> *r_changed) {
@@ -904,14 +903,15 @@ void EditorFileSystem::get_changed_sources(List<String> *r_changed) {
*r_changed=sources_changed;
}
-void EditorFileSystem::scan_sources() {
+void EditorFileSystem::scan_changes() {
- if (scanning || scanning_sources|| thread)
+ if (scanning || scanning_changes|| thread)
return;
+ _update_extensions();
sources_changed.clear();
- scanning_sources=true;
- scanning_sources_done=false;
+ scanning_changes=true;
+ scanning_changes_done=false;
abort_scan=false;
@@ -927,8 +927,8 @@ void EditorFileSystem::scan_sources() {
if (_update_scan_actions())
emit_signal("filesystem_changed");
}
- scanning_sources=false;
- scanning_sources_done=true;
+ scanning_changes=false;
+ scanning_changes_done=true;
emit_signal("sources_changed",sources_changed.size()>0);
} else {
@@ -983,11 +983,11 @@ void EditorFileSystem::_notification(int p_what) {
if (use_threads) {
- if (scanning_sources) {
+ if (scanning_changes) {
- if (scanning_sources_done) {
+ if (scanning_changes_done) {
- scanning_sources=false;
+ scanning_changes=false;
set_process(false);
@@ -1028,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 {
@@ -1049,22 +1049,13 @@ void EditorFileSystem::_save_filesystem_cache(EditorFileSystemDirectory*p_dir,Fi
for(int i=0;i<p_dir->files.size();i++) {
- String s=p_dir->files[i]->file+"::"+p_dir->files[i]->type+"::"+String::num(p_dir->files[i]->modified_time)+"::";
- if (p_dir->files[i]->meta.enabled) {
- s+=p_dir->files[i]->meta.import_editor;
- for(int j=0;j<p_dir->files[i]->meta.sources.size();j++){
- s+="<>"+p_dir->files[i]->meta.sources[j].path;
- s+="<>"+p_dir->files[i]->meta.sources[j].md5;
- s+="<>"+String::num(p_dir->files[i]->meta.sources[j].modified_time);
-
- }
- }
+ String s=p_dir->files[i]->file+"::"+p_dir->files[i]->type+"::"+itos(p_dir->files[i]->modified_time)+"::"+itos(p_dir->files[i]->import_modified_time);
s+="::";
- for(int j=0;j<p_dir->files[i]->meta.deps.size();j++) {
+ for(int j=0;j<p_dir->files[i]->deps.size();j++) {
if (j>0)
s+="<>";
- s+=p_dir->files[i]->meta.deps[j];
+ s+=p_dir->files[i]->deps[j];
}
p_file->store_line(s);
@@ -1107,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++) {
@@ -1257,34 +1250,8 @@ void EditorFileSystem::_resource_saved(const String& p_path){
}
-String EditorFileSystem::_find_first_from_source(EditorFileSystemDirectory* p_dir,const String &p_src) const {
-
- for(int i=0;i<p_dir->files.size();i++) {
- for(int j=0;j<p_dir->files[i]->meta.sources.size();j++) {
-
- if (p_dir->files[i]->meta.sources[j].path==p_src)
- return p_dir->get_file_path(i);
- }
- }
-
- for(int i=0;i<p_dir->subdirs.size();i++) {
-
- String ret = _find_first_from_source(p_dir->subdirs[i],p_src);
- if (ret.length()>0)
- return ret;
- }
-
- return String();
-}
-
-
-String EditorFileSystem::find_resource_from_source(const String& p_path) const {
- if (filesystem)
- return _find_first_from_source(filesystem,p_path);
- return String();
-}
void EditorFileSystem::update_file(const String& p_file) {
@@ -1320,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);
@@ -1335,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]->meta=_get_meta(p_file);
+ //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
@@ -1343,6 +1313,173 @@ void EditorFileSystem::update_file(const String& p_file) {
}
+void EditorFileSystem::_reimport_file(const String& p_file) {
+
+ print_line("REIMPORTING: "+p_file);
+
+ EditorFileSystemDirectory *fs=NULL;
+ int cpos=-1;
+ bool found = _find_file(p_file,&fs,cpos);
+ ERR_FAIL_COND(!found);
+
+ //try to obtain existing params
+
+ Map<StringName,Variant> params;
+ String importer_name;
+
+ if (FileAccess::exists(p_file+".import")) {
+
+ Ref<ConfigFile> cf;
+ cf.instance();
+ Error err = cf->load(p_file+".import");
+ if (err==OK) {
+ List<String> sk;
+ cf->get_section_keys("params",&sk);
+ for(List<String>::Element *E=sk.front();E;E=E->next()) {
+ params[E->get()]=cf->get_value("params",E->get());
+ }
+ importer_name = cf->get_value("remap","importer");
+ }
+ }
+
+ Ref<ResourceImporter> importer;
+ //find the importer
+ if (importer_name!="") {
+ importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(importer_name);
+ }
+
+ if (importer.is_null()) {
+ //not found by name, find by extension
+ importer = ResourceFormatImporter::get_singleton()->get_importer_by_extension(p_file.get_extension());
+ if (importer.is_null()) {
+ ERR_PRINT("BUG: File queued for import, but can't be imported!");
+ ERR_FAIL();
+
+ }
+ }
+
+ //mix with default params, in case a parameter is missing
+
+ List<ResourceImporter::ImportOption> opts;
+ importer->get_import_options(&opts);
+ for (List<ResourceImporter::ImportOption>::Element *E=opts.front();E;E=E->next()) {
+ if (!params.has(E->get().option.name)) { //this one is not present
+ params[E->get().option.name]=E->get().default_value;
+ }
+ }
+
+ //finally, perform import!!
+ String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_file);
+
+ List<String> import_variants;
+ List<String> gen_files;
+
+ Error err = importer->import(p_file,base_path,params,&import_variants,&gen_files);
+
+ if (err!=OK) {
+ ERR_PRINTS("Error importing: "+p_file);
+ }
+
+ //as import is complete, save the .import file
+
+ FileAccess *f = FileAccess::open(p_file+".import",FileAccess::WRITE);
+ ERR_FAIL_COND(!f);
+
+ //write manually, as order matters ([remap] has to go first for performance).
+ f->store_line("[remap]");
+ f->store_line("");
+ f->store_line("importer=\""+importer->get_importer_name()+"\"");
+ if (importer->get_resource_type()!="") {
+ f->store_line("type=\""+importer->get_resource_type()+"\"");
+ }
+
+
+ if (importer->get_save_extension()=="") {
+ //no path
+ } else if (import_variants.size()) {
+ //import with variants
+ for(List<String>::Element *E=import_variants.front();E;E=E->next()) {
+
+
+ String path = base_path.c_escape()+"."+E->get()+"."+importer->get_save_extension();
+
+ f->store_line("path."+E->get()+"=\""+path+"\"");
+
+ }
+ } else {
+
+ f->store_line("path=\""+base_path+"."+importer->get_save_extension()+"\"");
+ }
+
+ f->store_line("");
+ if (gen_files.size()) {
+ f->store_line("[gen]");
+ Array genf;
+ for (List<String>::Element *E=gen_files.front();E;E=E->next()) {
+ genf.push_back(E->get());
+ }
+
+ String value;
+ VariantWriter::write_to_string(genf,value);
+ f->store_line("files="+value);
+ f->store_line("");
+ }
+
+
+ f->store_line("[params]");
+ 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;
+ String value;
+ VariantWriter::write_to_string(params[base],value);
+ f->store_line(base+"="+value);
+
+
+ }
+
+ 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);
+
+ _reimport_file(p_files[i]);
+ }
+
+ _save_filesystem_cache();
+ importing=false;
+ if (!is_scanning()) {
+ emit_signal("filesystem_changed");
+ }
+}
void EditorFileSystem::_bind_methods() {
@@ -1351,7 +1488,7 @@ void EditorFileSystem::_bind_methods() {
ClassDB::bind_method(_MD("is_scanning"),&EditorFileSystem::is_scanning);
ClassDB::bind_method(_MD("get_scanning_progress"),&EditorFileSystem::get_scanning_progress);
ClassDB::bind_method(_MD("scan"),&EditorFileSystem::scan);
- ClassDB::bind_method(_MD("scan_sources"),&EditorFileSystem::scan_sources);
+ ClassDB::bind_method(_MD("scan_sources"),&EditorFileSystem::scan_changes);
ClassDB::bind_method(_MD("update_file","path"),&EditorFileSystem::update_file);
ClassDB::bind_method(_MD("get_filesystem_path:EditorFileSystemDirectory","path"),&EditorFileSystem::get_filesystem_path);
ClassDB::bind_method(_MD("get_file_type","path"),&EditorFileSystem::get_file_type);
@@ -1361,30 +1498,48 @@ void EditorFileSystem::_bind_methods() {
}
+void EditorFileSystem::_update_extensions() {
+ valid_extensions.clear();
+ import_extensions.clear();
+
+ List<String> extensionsl;
+ ResourceLoader::get_recognized_extensions_for_type("",&extensionsl);
+ for(List<String>::Element *E = extensionsl.front();E;E=E->next()) {
+
+ valid_extensions.insert(E->get());
+ }
+
+ extensionsl.clear();
+ ResourceFormatImporter::get_singleton()->get_recognized_extensions(&extensionsl);
+ for(List<String>::Element *E = extensionsl.front();E;E=E->next()) {
+
+ import_extensions.insert(E->get());
+ }
+}
EditorFileSystem::EditorFileSystem() {
+ reimport_on_missing_imported_files = GLOBAL_DEF("editor/reimport_missing_imported_files",true);
singleton=this;
filesystem=memnew( EditorFileSystemDirectory ); //like, empty
thread = NULL;
scanning=false;
+ importing=false;
use_threads=true;
thread_sources=NULL;
new_filesystem=NULL;
- scanning_sources=false;
+ scanning_changes=false;
ResourceSaver::set_save_callback(_resource_saved);
- List<String> extensionsl;
- ResourceLoader::get_recognized_extensions_for_type("",&extensionsl);
- for(List<String>::Element *E = extensionsl.front();E;E=E->next()) {
-
- valid_extensions.insert(E->get());
+ DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ if (da->change_dir("res://.import")!=OK) {
+ da->make_dir("res://.import");
}
-
+ memdelete(da);
scan_total=0;
}
diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h
index 3a26f46aa9..10d9b919fc 100644
--- a/tools/editor/editor_file_system.h
+++ b/tools/editor/editor_file_system.h
@@ -48,30 +48,13 @@ class EditorFileSystemDirectory : public Object {
EditorFileSystemDirectory *parent;
Vector<EditorFileSystemDirectory*> subdirs;
- struct ImportMeta {
-
- struct Source {
-
- String path;
- String md5;
- uint64_t modified_time;
- bool missing;
-
- };
-
- Vector<Source> sources;
- String import_editor;
- Vector<String> deps;
- bool enabled;
- bool sources_changed;
-
- };
struct FileInfo {
String file;
StringName type;
uint64_t modified_time;
- ImportMeta meta;
+ uint64_t import_modified_time;
+ Vector<String> deps;
bool verified; //used for checking changes
};
@@ -101,14 +84,7 @@ public:
String get_file(int p_idx) const;
String get_file_path(int p_idx) const;
StringName get_file_type(int p_idx) const;
- bool get_file_meta(int p_idx) const;
- bool is_missing_sources(int p_idx) const;
- bool have_sources_changed(int p_idx) const;
- Vector<String> get_missing_sources(int p_idx) const;
Vector<String> get_file_deps(int p_idx) const;
- int get_source_count(int p_idx) const;
- String get_source_file(int p_idx,int p_source) const;
- bool is_source_file_missing(int p_idx,int p_source) const;
EditorFileSystemDirectory *get_parent();
@@ -136,7 +112,7 @@ class EditorFileSystem : public Node {
ACTION_DIR_REMOVE,
ACTION_FILE_ADD,
ACTION_FILE_REMOVE,
- ACTION_FILE_SOURCES_CHANGED
+ ACTION_FILE_REIMPORT
};
Action action;
@@ -157,6 +133,7 @@ class EditorFileSystem : public Node {
bool abort_scan;
bool scanning;
+ bool importing;
float scan_total;
@@ -171,7 +148,7 @@ class EditorFileSystem : public Node {
String type;
uint64_t modification_time;
- EditorFileSystemDirectory::ImportMeta meta;
+ uint64_t import_modification_time;
Vector<String> deps;
};
@@ -186,25 +163,25 @@ class EditorFileSystem : public Node {
ScanProgress get_sub(int p_current,int p_total) const;
};
- static EditorFileSystemDirectory::ImportMeta _get_meta(const String& p_path);
-
- bool _check_meta_sources(EditorFileSystemDirectory::ImportMeta & p_meta);
+ void _save_filesystem_cache();
void _save_filesystem_cache(EditorFileSystemDirectory *p_dir,FileAccess *p_file);
bool _find_file(const String& p_file,EditorFileSystemDirectory ** r_d, int &r_file_pos) const;
void _scan_fs_changes(EditorFileSystemDirectory *p_dir, const ScanProgress &p_progress);
+
int md_count;
Set<String> valid_extensions;
+ Set<String> import_extensions;
void _scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess *da,const ScanProgress& p_progress);
Thread *thread_sources;
- bool scanning_sources;
- bool scanning_sources_done;
+ bool scanning_changes;
+ bool scanning_changes_done;
static void _thread_func_sources(void *_userdata);
@@ -214,7 +191,14 @@ class EditorFileSystem : public Node {
bool _update_scan_actions();
static void _resource_saved(const String& p_path);
- String _find_first_from_source(EditorFileSystemDirectory* p_dir,const String &p_src) const;
+
+ void _update_extensions();
+
+ void _reimport_file(const String &p_file);
+
+ bool _check_missing_imported_files(const String& p_path);
+
+ bool reimport_on_missing_imported_files;
protected:
@@ -227,16 +211,19 @@ public:
EditorFileSystemDirectory *get_filesystem();
bool is_scanning() const;
+ bool is_importing() const { return importing; }
float get_scanning_progress() const;
void scan();
- void scan_sources();
+ void scan_changes();
void get_changed_sources(List<String> *r_changed);
void update_file(const String& p_file);
- String find_resource_from_source(const String& p_path) const;
+
EditorFileSystemDirectory *get_filesystem_path(const String& p_path);
String get_file_type(const String& p_file) const;
EditorFileSystemDirectory* find_file(const String& p_file,int* r_index) const;
+ void reimport_files(const Vector<String>& p_files);
+
EditorFileSystem();
~EditorFileSystem();
};
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 6ef238920d..69a004fc08 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "editor_import_export.h"
+#if 0
#include "version.h"
#include "script_language.h"
#include "globals.h"
@@ -389,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) {
@@ -986,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
@@ -1040,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;
@@ -1084,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);
@@ -2302,3 +2303,4 @@ EditorImportExport::~EditorImportExport() {
}
+#endif
diff --git a/tools/editor/editor_import_export.h b/tools/editor/editor_import_export.h
index fb75373f17..2654a4ea33 100644
--- a/tools/editor/editor_import_export.h
+++ b/tools/editor/editor_import_export.h
@@ -29,6 +29,8 @@
#ifndef EDITOR_IMPORT_EXPORT_H
#define EDITOR_IMPORT_EXPORT_H
+#if 0
+
#include "resource.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
@@ -419,4 +421,5 @@ VARIANT_ENUM_CAST(EditorImportExport::ImageAction);
VARIANT_ENUM_CAST(EditorImportExport::ScriptAction);
VARIANT_ENUM_CAST(EditorImportExport::SampleAction);
+#endif
#endif // EDITOR_IMPORT_EXPORT_H
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 2d66429ea5..352b0818b4 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -99,7 +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_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"
@@ -110,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"
@@ -304,6 +308,8 @@ void EditorNode::_notification(int p_what) {
}
+ ResourceImporterTexture::get_singleton()->update_imports();
+
}
if (p_what==NOTIFICATION_ENTER_TREE) {
@@ -333,21 +339,6 @@ void EditorNode::_notification(int p_what) {
_editor_select(EDITOR_3D);
- if (defer_load_scene!="") {
-
- load_scene(defer_load_scene);
- defer_load_scene="";
- }
-
- if (defer_translatable!="") {
-
- Error ok = save_translatable_strings(defer_translatable);
- if (ok!=OK)
- OS::get_singleton()->set_exit_code(255);
- defer_translatable="";
- get_tree()->quit();
- }
-
/*
if (defer_optimize!="") {
Error ok = save_optimized_copy(defer_optimize,defer_optimize_preset);
@@ -370,40 +361,7 @@ void EditorNode::_notification(int p_what) {
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) {
- /*
- List<Ref<Resource> > cached;
- ResourceCache::get_cached_resources(&cached);
-
- bool changes=false;
- for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
-
- if (!E->get()->can_reload_from_file())
- continue;
- if (E->get()->get_path().find("::")!=-1)
- continue;
- uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
- if (mt!=E->get()->get_last_modified_time()) {
- changes=true;
- break;
- }
- }
-
-
-
- sources_button->get_popup()->set_item_disabled(sources_button->get_popup()->get_item_index(DEPENDENCY_UPDATE_LOCAL),!changes);
- if (changes && sources_button->get_popup()->is_item_disabled(sources_button->get_popup()->get_item_index(DEPENDENCY_UPDATE_IMPORTED))) {
- sources_button->set_icon(gui_base->get_icon("DependencyLocalChanged","EditorIcons"));
- }
-*/
-
- if (bool(EDITOR_DEF("filesystem/resources/auto_reload_modified_images",true))) {
-
- _menu_option_confirm(DEPENDENCY_LOAD_CHANGED_IMAGES,true);
- }
-
- waiting_for_sources_changed=true;
- EditorFileSystem::get_singleton()->scan_sources();
-
+ EditorFileSystem::get_singleton()->scan_changes();
}
if (p_what == MainLoop::NOTIFICATION_WM_QUIT_REQUEST) {
@@ -431,63 +389,75 @@ void EditorNode::_fs_changed() {
if (export_defer.platform!="") {
- project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
+ //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true);
export_defer.platform="";
}
-}
-
-void EditorNode::_sources_changed(bool p_exist) {
+ {
- if (p_exist && bool(EditorSettings::get_singleton()->get("filesystem/import/automatic_reimport_on_sources_changed"))) {
- p_exist=false;
+ //reload changed resources
+ List<Ref<Resource> > changed;
- List<String> changed_sources;
- EditorFileSystem::get_singleton()->get_changed_sources(&changed_sources);
+ List<Ref<Resource> > cached;
+ ResourceCache::get_cached_resources(&cached);
+ //this should probably be done in a thread..
+ for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
+ if (!E->get()->editor_can_reload_from_file())
+ continue;
+ if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path())
+ continue;
+ if (!FileAccess::exists(E->get()->get_path()))
+ continue;
- EditorProgress ep("reimport",TTR("Re-Importing"),changed_sources.size());
- int step_idx=0;
+ 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()));
- for(List<String>::Element *E=changed_sources.front();E;E=E->next()) {
+ if (mt!=E->get()->get_import_last_modified_time()) {
+ print_line("success");
+ changed.push_back(E->get());
+ }
- ep.step(TTR("Importing:")+" "+E->get(),step_idx++);
+ } else {
+ uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
- Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(E->get());
- ERR_CONTINUE(rimd.is_null());
- String editor = rimd->get_editor();
- if (editor.begins_with("texture_")) {
- editor="texture"; //compatibility fix for old versions
- }
- Ref<EditorImportPlugin> eip = EditorImportExport::get_singleton()->get_import_plugin_by_name(editor);
- ERR_CONTINUE(eip.is_null());
- Error err = eip->import(E->get(),rimd);
- if (err!=OK) {
- EditorNode::add_io_error("Error Re Importing:\n "+E->get());
+ if (mt!=E->get()->get_last_modified_time()) {
+ changed.push_back(E->get());
+ }
}
+ }
+
+ if (changed.size()) {
+ //EditorProgress ep("reload_res","Reload Modified Resources",changed.size());
+ int idx=0;
+ for(List<Ref<Resource> >::Element *E=changed.front();E;E=E->next()) {
+ //ep.step(E->get()->get_path(),idx++);
+ E->get()->reload_from_file();
+ }
}
- EditorFileSystem::get_singleton()->scan_sources();
- waiting_for_sources_changed=false;
- return;
}
+}
- if (p_exist) {
+void EditorNode::_sources_changed(bool p_exist) {
- sources_button->set_icon(gui_base->get_icon("DependencyChanged","EditorIcons"));
- sources_button->set_disabled(false);
+ if (waiting_for_first_scan) {
- } else {
+ if (defer_load_scene!="") {
- sources_button->set_icon(gui_base->get_icon("DependencyOk","EditorIcons"));
- sources_button->set_disabled(true);
+ print_line("loading scene DEFERED");
+ load_scene(defer_load_scene);
+ defer_load_scene="";
+ }
+ waiting_for_first_scan=false;
}
- waiting_for_sources_changed=false;
}
@@ -502,9 +472,11 @@ void EditorNode::_rebuild_import_menu()
p->clear();
//p->add_item(TTR("Node From Scene"), FILE_IMPORT_SUBSCENE);
//p->add_separator();
+#if 0
for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) {
p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i);
}
+#endif
}
void EditorNode::_node_renamed() {
@@ -1008,7 +980,6 @@ void EditorNode::_save_scene(String p_file, int idx) {
return;
}
- sdata->set_import_metadata(editor_data.get_edited_scene_import_metadata(idx));
int flg=0;
if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources"))
flg|=ResourceSaver::FLAG_COMPRESS;
@@ -1205,12 +1176,6 @@ void EditorNode::_dialog_action(String p_file) {
get_undo_redo()->clear_history();
} break;
- case FILE_DUMP_STRINGS: {
-
- save_translatable_strings(p_file);
-
- } break;
-
case FILE_SAVE_SCENE:
case FILE_SAVE_AS_SCENE: {
@@ -1928,11 +1893,11 @@ void EditorNode::_run(bool p_current,const String& p_custom) {
editor_data.save_editor_external_data();
}
- if (bool(EDITOR_DEF("run/always_clear_output_on_play", true))) {
+ if (bool(EDITOR_DEF("run/output/always_clear_output_on_play", true))) {
log->clear();
}
- if (bool(EDITOR_DEF("run/always_open_output_on_play", true))) {
+ if (bool(EDITOR_DEF("run/output/always_open_output_on_play", true))) {
make_bottom_panel_item_visible(log);
}
@@ -2202,46 +2167,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
_menu_option_confirm(FILE_SAVE_AND_RUN, true);
} break;
- case FILE_DUMP_STRINGS: {
-
- Node *scene = editor_data.get_edited_scene_root();
-
- if (!scene) {
-
- current_option=-1;
- //confirmation->get_cancel()->hide();
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text("This operation can't be done without a tree root.");
- accept->popup_centered_minsize();
- break;
- }
-
- String cpath;
- if (scene->get_filename()!="") {
- cpath = scene->get_filename();
-
- String fn = cpath.substr(0,cpath.length() - cpath.get_extension().size());
- String ext=cpath.get_extension();
- cpath=fn+".pot";
-
-
- } else {
- current_option=-1;
- //confirmation->get_cancel()->hide();
- accept->get_ok()->set_text(TTR("I see.."));
- accept->set_text(TTR("Please save the scene first."));
- accept->popup_centered_minsize();
- break;
-
- }
-
- file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
-
- file->set_current_path(cpath);
- file->set_title(TTR("Save Translatable Strings"));
- file->popup_centered_ratio();
-
- } break;
case FILE_SAVE_OPTIMIZED: {
#if 0
Node *scene = editor_data.get_edited_scene_root();
@@ -2282,7 +2207,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
case FILE_EXPORT_PROJECT: {
- project_export_settings->popup_export();
+ //project_export_settings->popup_export();
/*
String target = export_db->get_current_platform();
Ref<EditorExporter> exporter = export_db->get_exporter(target);
@@ -2861,29 +2786,11 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case SOURCES_REIMPORT: {
- reimport_dialog->popup_reimport();
+ //reimport_dialog->popup_reimport();
} break;
case DEPENDENCY_LOAD_CHANGED_IMAGES: {
- List<Ref<Resource> > cached;
- ResourceCache::get_cached_resources(&cached);
- //this should probably be done in a thread..
- for(List<Ref<Resource> >::Element *E=cached.front();E;E=E->next()) {
-
- if (!E->get()->editor_can_reload_from_file())
- continue;
- if (!E->get()->get_path().is_resource_file() && !E->get()->get_path().is_abs_path())
- continue;
- if (!FileAccess::exists(E->get()->get_path()))
- continue;
- uint64_t mt = FileAccess::get_modified_time(E->get()->get_path());
- if (mt!=E->get()->get_last_modified_time()) {
- E->get()->reload_from_file();
- }
-
- }
-
} break;
case DEPENDENCY_UPDATE_IMPORTED: {
@@ -2951,10 +2858,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
current->call(name);
} else if (p_option>=IMPORT_PLUGIN_BASE) {
- Ref<EditorImportPlugin> p = editor_import_export->get_import_plugin(p_option-IMPORT_PLUGIN_BASE);
- if (p.is_valid()) {
- p->import_dialog();
- }
}
}
@@ -3055,20 +2958,6 @@ void EditorNode::remove_editor_plugin(EditorPlugin *p_editor) {
}
-void EditorNode::add_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
-
- ERR_FAIL_COND( p_editor_import.is_null() );
- editor_import_export->add_import_plugin(p_editor_import);
- _rebuild_import_menu();
-}
-
-void EditorNode::remove_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
- ERR_FAIL_COND( p_editor_import.is_null() );
-
- editor_import_export->remove_import_plugin(p_editor_import);
- _rebuild_import_menu();
-}
-
void EditorNode::_update_addon_config() {
@@ -3228,232 +3117,6 @@ void EditorNode::set_edited_scene(Node *p_scene) {
}
-void EditorNode::_fetch_translatable_strings(const Object *p_object,Set<StringName>& strings) {
-
-
- List<String> tstrings;
- p_object->get_translatable_strings(&tstrings);
- for(List<String>::Element *E=tstrings.front();E;E=E->next())
- strings.insert(E->get());
-
-
-
- const Node * node = p_object->cast_to<Node>();
-
- if (!node)
- return;
-
- Ref<Script> script = node->get_script();
- if (script.is_valid())
- _fetch_translatable_strings(script.ptr(),strings);
-
- for(int i=0;i<node->get_child_count();i++) {
-
- Node *c=node->get_child(i);
- if (c->get_owner()!=get_edited_scene())
- continue;
-
- _fetch_translatable_strings(c,strings);
- }
-
-}
-
-
-Error EditorNode::save_translatable_strings(const String& p_to_file) {
-
- if (!is_inside_tree()) {
- defer_translatable=p_to_file;
- return OK;
- }
-
- ERR_FAIL_COND_V(!get_edited_scene(),ERR_INVALID_DATA);
-
- Set<StringName> strings;
- _fetch_translatable_strings(get_edited_scene(),strings);
-
- Error err;
- FileAccess *f = FileAccess::open(p_to_file,FileAccess::WRITE,&err);
- ERR_FAIL_COND_V(err,err);
-
- OS::Date date = OS::get_singleton()->get_date();
- OS::Time time = OS::get_singleton()->get_time();
- f->store_line("# Translation Strings Dump.");
- f->store_line("# Created By.");
- f->store_line("# \t" VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.");
- f->store_line("# From Scene: ");
- f->store_line("# \t"+get_edited_scene()->get_filename());
- f->store_line("");
- f->store_line("msgid \"\"");
- f->store_line("msgstr \"\"");
- f->store_line("\"Report-Msgid-Bugs-To: <define>\\n\"");
- f->store_line("\"POT-Creation-Date: "+itos(date.year)+"-"+itos(date.month)+"-"+itos(date.day)+" "+itos(time.hour)+":"+itos(time.min)+"0000\\n\"");
- //f->store_line("\"PO-Revision-Date: 2006-08-30 13:56-0700\\n\"");
- //f->store_line("\"Last-Translator: Rubén C. Díaz Alonso <outime@gmail.com>\\n\"");
- f->store_line("\"Language-Team: <define>\\n\"");
- f->store_line("\"MIME-Version: 1.0\\n\"");
- f->store_line("\"Content-Type: text/plain; charset=UTF-8\\n\"");
- f->store_line("\"Content-Transfer-Encoding: 8bit\\n\"");
- f->store_line("");
-
- for(Set<StringName>::Element *E=strings.front();E;E=E->next()) {
-
- String s = E->get();
- if (s=="" || s.strip_edges()=="")
- continue;
- Vector<String> substr = s.split("\n");
- ERR_CONTINUE(substr.size()==0);
-
- f->store_line("");
-
- if (substr.size()==1) {
-
- f->store_line("msgid \""+substr[0].c_escape()+"\"");
- } else {
-
- f->store_line("msgid \"\"");
- for(int i=0;i<substr.size();i++) {
-
- String s = substr[i];
- if (i!=substr.size()-1)
- s+="\n";
- f->store_line("\""+s.c_escape()+"\"");
- }
- }
-
- f->store_line("msgstr \"\"");
-
- }
-
-
- f->close();
- memdelete(f);
-
- return OK;
-
-}
-
-Error EditorNode::save_optimized_copy(const String& p_scene,const String& p_preset) {
-
-#if 0
-
- if (!is_inside_scene()) {
- defer_optimize=p_scene;
- defer_optimize_preset=p_preset;
- return OK;
- }
-
-
- if (!get_edited_scene()) {
-
- get_scene()->quit();
- ERR_EXPLAIN("No scene to optimize (loading failed?)");
- ERR_FAIL_V(ERR_FILE_NOT_FOUND);
- }
-
-
- String src_scene=GlobalConfig::get_singleton()->localize_path(get_edited_scene()->get_filename());
-
-
- String path=p_scene;
- print_line("p_path: "+p_scene);
- print_line("src_scene: "+p_scene);
-
- if (path.is_rel_path()) {
- print_line("rel path!?");
- path=src_scene.get_base_dir()+"/"+path;
- }
- path = GlobalConfig::get_singleton()->localize_path(path);
-
- print_line("path: "+path);
-
-
- String preset = "optimizer_presets/"+p_preset;
- if (!GlobalConfig::get_singleton()->has(preset)) {
-
- //accept->"()->hide();
- accept->get_ok()->set_text("I see..");
- accept->set_text("Optimizer preset not found: "+p_preset);
- accept->popup_centered(Size2(300,70));
- ERR_EXPLAIN("Optimizer preset not found: "+p_preset);
- ERR_FAIL_V(ERR_INVALID_PARAMETER);
-
- }
-
- Dictionary d = GlobalConfig::get_singleton()->get(preset);
-
- ERR_FAIL_COND_V(!d.has("__type__"),ERR_INVALID_DATA);
- String type=d["__type__"];
-
- Ref<EditorOptimizedSaver> saver;
-
- for(int i=0;i<editor_data.get_optimized_saver_count();i++) {
-
- print_line(type+" vs "+editor_data.get_optimized_saver(i)->get_target_name());
- if (editor_data.get_optimized_saver(i)->get_target_name()==type) {
- saver=editor_data.get_optimized_saver(i);
- }
- }
-
- ERR_EXPLAIN("Preset '"+p_preset+"' references nonexistent saver: "+type);
- ERR_FAIL_COND_V(saver.is_null(),ERR_INVALID_DATA);
-
- List<Variant> keys;
- d.get_key_list(&keys);
-
- saver->clear();
-
- for(List<Variant>::Element *E=keys.front();E;E=E->next()) {
-
- saver->set(E->get(),d[E->get()]);
- }
-
- uint32_t flags=0;
-
- /*
- if (saver->is_bundle_scenes_enabled())
- flags|=ResourceSaver::FLAG_BUNDLE_INSTANCED_SCENES;
- */
- if (saver->is_bundle_resources_enabled())
- flags|=ResourceSaver::FLAG_BUNDLE_RESOURCES;
- if (saver->is_remove_editor_data_enabled())
- flags|=ResourceSaver::FLAG_OMIT_EDITOR_PROPERTIES;
- if (saver->is_big_endian_data_enabled())
- flags|=ResourceSaver::FLAG_SAVE_BIG_ENDIAN;
-
- String platform=saver->get_target_platform();
- if (platform=="")
- platform="all";
-
- Ref<PackedScene> sdata = memnew( PackedScene );
- Error err = sdata->pack(get_edited_scene());
-
- if (err) {
-
- current_option=-1;
- //accept->get_cancel()->hide();
- accept->get_ok()->set_text("I see..");
- accept->set_text("Couldn't save scene. Likely dependencies (instances) couldn't be satisfied.");
- accept->popup_centered(Size2(300,70));
- return ERR_INVALID_DATA;
-
- }
- err = ResourceSaver::save(path,sdata,flags); //todo, saverSceneSaver::save(path,get_edited_scene(),flags,saver);
-
- if (err) {
-
- //accept->"()->hide();
- accept->get_ok()->set_text("I see..");
- accept->set_text("Error saving optimized scene: "+path);
- accept->popup_centered(Size2(300,70));
-
- ERR_FAIL_COND_V(err,err);
-
- }
-
- project_settings->add_remapped_path(src_scene,path,platform);
-#endif
- return OK;
-}
int EditorNode::_get_current_main_editor() {
@@ -3645,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;
@@ -3654,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) {
@@ -3661,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();
@@ -3812,7 +3490,6 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
property_editor->edit(new_scene);
editor_data.set_edited_scene_root(new_scene);
*/
- editor_data.set_edited_scene_import_metadata( sdata->get_import_metadata() );
//editor_data.get_undo_redo().clear_history();
saved_version=editor_data.get_undo_redo().get_version();
@@ -3852,6 +3529,10 @@ void EditorNode::request_instance_scenes(const Vector<String>& p_files) {
scene_tree_dock->instance_scenes(p_files);
}
+ImportDock *EditorNode::get_import_dock() {
+ return import_dock;
+}
+
FileSystemDock *EditorNode::get_filesystem_dock() {
return filesystem_dock;
@@ -4155,9 +3836,9 @@ bool EditorNode::is_scene_in_use(const String& p_path) {
void EditorNode::register_editor_types() {
ClassDB::register_class<EditorPlugin>();
- ClassDB::register_class<EditorImportPlugin>();
- ClassDB::register_class<EditorExportPlugin>();
- ClassDB::register_class<EditorScenePostImport>();
+// ClassDB::register_class<EditorImportPlugin>();
+// ClassDB::register_class<EditorExportPlugin>();
+// ClassDB::register_class<EditorScenePostImport>();
ClassDB::register_class<EditorScript>();
ClassDB::register_class<EditorSelection>();
ClassDB::register_class<EditorFileDialog>();
@@ -4514,6 +4195,8 @@ void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String& p
}
}
+ p_layout->set_value(p_section,"dock_filesystem_split",filesystem_dock->get_split_offset());
+
VSplitContainer*splits[DOCK_SLOT_MAX/2]={
left_l_vsplit,
left_r_vsplit,
@@ -4690,6 +4373,12 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String&
}
}
+ int fs_split_ofs = 0;
+ if (p_layout->has_section_key(p_section,"dock_filesystem_split")) {
+ fs_split_ofs = p_layout->get_value(p_section,"dock_filesystem_split");
+ }
+ filesystem_dock->set_split_offset(fs_split_ofs);
+
VSplitContainer*splits[DOCK_SLOT_MAX/2]={
left_l_vsplit,
left_r_vsplit,
@@ -5073,7 +4762,6 @@ Variant EditorNode::drag_resource(const Ref<Resource>& p_res,Control* p_from) {
TextureRect *drag_preview = memnew( TextureRect );
Label* label=memnew( Label );
- waiting_for_sources_changed=true; //
Ref<Texture> preview;
{
@@ -5179,9 +4867,9 @@ Variant EditorNode::drag_files_and_dirs(const Vector<String>& p_files, Control *
void EditorNode::_dropped_files(const Vector<String>& p_files,int p_screen) {
String cur_path = filesystem_dock->get_current_path();
- for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) {
- EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path);
- }
+// for(int i=0;i<EditorImportExport::get_singleton()->get_import_plugin_count();i++) {
+// EditorImportExport::get_singleton()->get_import_plugin(i)->import_from_drop(p_files,cur_path);
+// }
}
void EditorNode::_file_access_close_error_notify(const String& p_str) {
@@ -5289,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() {
@@ -5361,11 +5062,13 @@ void EditorNode::_bind_methods() {
- ClassDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
- ClassDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
+// ClassDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
+ //ClassDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
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") );
@@ -5415,7 +5118,6 @@ EditorNode::EditorNode() {
FileAccess::set_backup_save(true);
- PathRemap::get_singleton()->clear_remaps(); //editor uses no remaps
TranslationServer::get_singleton()->set_enabled(false);
// load settings
if (!EditorSettings::get_singleton())
@@ -5451,6 +5153,37 @@ EditorNode::EditorNode() {
ResourceLoader::set_timestamp_on_load(true);
ResourceSaver::set_timestamp_on_save(true);
+
+ { //register importers at the begining, so dialogs are created with the right extensions
+ Ref<ResourceImporterTexture> import_texture;
+ import_texture.instance();
+ ResourceFormatImporter::get_singleton()->add_importer(import_texture);
+
+ Ref<ResourceImporterCSVTranslation> import_csv_translation;
+ 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();
editor_selection = memnew( EditorSelection );
@@ -5468,13 +5201,8 @@ EditorNode::EditorNode() {
EditorFileDialog::unregister_func=_editor_file_dialog_unregister;
- editor_import_export = memnew( EditorImportExport );
- add_child(editor_import_export);
-
register_exporters();
- editor_import_export->load_config();
-
GLOBAL_DEF("editor/main_run_args","$scene");
ClassDB::set_class_enabled("CollisionShape",true);
@@ -5781,7 +5509,6 @@ EditorNode::EditorNode() {
pm_export->set_name("Export");
p->add_child(pm_export);
p->add_submenu_item(TTR("Convert To.."),"Export");
- pm_export->add_item(TTR("Translatable Strings.."),FILE_DUMP_STRINGS);
pm_export->add_separator();
pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary..")), FILE_EXPORT_MESH_LIBRARY);
pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet..")), FILE_EXPORT_TILESET);
@@ -6264,6 +5991,11 @@ EditorNode::EditorNode() {
property_editor->set_undo_redo(&editor_data.get_undo_redo());
+ import_dock = memnew( ImportDock );
+ dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock);
+ import_dock->set_name(TTR("Import"));
+
+
node_dock = memnew( NodeDock );
//node_dock->set_undoredo(&editor_data.get_undo_redo());
if (use_single_dock_column) {
@@ -6388,11 +6120,11 @@ EditorNode::EditorNode() {
//gui_base->add_child(optimized_save);
//optimized_save->connect("confirmed",this,"_save_optimized");
- project_export = memnew( ProjectExport(&editor_data) );
- gui_base->add_child(project_export);
+ //project_export = memnew( ProjectExport(&editor_data) );
+ //gui_base->add_child(project_export);
- project_export_settings = memnew( ProjectExportDialog(this) );
- gui_base->add_child(project_export_settings);
+ //project_export_settings = memnew( ProjectExportDialog(this) );
+ //gui_base->add_child(project_export_settings);
//optimized_presets = memnew( OptimizedPresetsDialog(&editor_data) );
//gui_base->add_child(optimized_presets);
@@ -6506,8 +6238,8 @@ EditorNode::EditorNode() {
gui_base->add_child(file_script);
file_script->connect("file_selected",this,"_dialog_action");
- reimport_dialog = memnew( EditorReImportDialog );
- gui_base->add_child(reimport_dialog);
+ //reimport_dialog = memnew( EditorReImportDialog );
+ //gui_base->add_child(reimport_dialog);
@@ -6533,26 +6265,6 @@ EditorNode::EditorNode() {
file_server = memnew( EditorFileServer );
- editor_import_export->add_import_plugin( Ref<EditorTextureImportPlugin>( memnew(EditorTextureImportPlugin(this) )));
- Ref<EditorSceneImportPlugin> _scene_import = memnew(EditorSceneImportPlugin(this) );
- Ref<EditorSceneImporterCollada> _collada_import = memnew( EditorSceneImporterCollada);
- _scene_import->add_importer(_collada_import);
- //Ref<EditorSceneImporterFBXConv> _fbxconv_import = memnew( EditorSceneImporterFBXConv);
- //_scene_import->add_importer(_fbxconv_import);
- editor_import_export->add_import_plugin( _scene_import);
- // TODO: This plugin has no code, it should be either implemented or dropped (GH-3667)
- // editor_import_export->add_import_plugin( Ref<EditorSceneAnimationImportPlugin>( memnew(EditorSceneAnimationImportPlugin(this))));
- editor_import_export->add_import_plugin( Ref<EditorMeshImportPlugin>( memnew(EditorMeshImportPlugin(this))));
- editor_import_export->add_import_plugin( Ref<EditorFontImportPlugin>( memnew(EditorFontImportPlugin(this))));
-// editor_import_export->add_import_plugin( Ref<EditorSampleImportPlugin>( memnew(EditorSampleImportPlugin(this))));
- editor_import_export->add_import_plugin( Ref<EditorTranslationImportPlugin>( memnew(EditorTranslationImportPlugin(this))));
- editor_import_export->add_import_plugin( Ref<EditorBitMaskImportPlugin>( memnew(EditorBitMaskImportPlugin(this))));
-
-
- editor_import_export->add_export_plugin( Ref<EditorTextureExportPlugin>( memnew(EditorTextureExportPlugin)));
-// editor_import_export->add_export_plugin( Ref<EditorSampleExportPlugin>( memnew(EditorSampleExportPlugin)));
- editor_import_export->add_export_plugin( Ref<EditorSceneExportPlugin>( memnew(EditorSceneExportPlugin)));
-
add_editor_plugin( memnew( AnimationPlayerEditorPlugin(this) ) );
add_editor_plugin( memnew( CanvasItemEditorPlugin(this) ) );
@@ -6560,7 +6272,7 @@ EditorNode::EditorNode() {
add_editor_plugin( memnew( ScriptEditorPlugin(this) ) );
- EditorAudioBuses::register_editor();
+ EditorAudioBuses *audio_bus_editor = EditorAudioBuses::register_editor();
ScriptTextEditor::register_editor(); //register one for text scripts
@@ -6609,6 +6321,7 @@ EditorNode::EditorNode() {
add_editor_plugin( memnew( ColorRampEditorPlugin(this) ) );
add_editor_plugin( memnew( CollisionShape2DEditorPlugin(this) ) );
add_editor_plugin( memnew( TextureEditorPlugin(this) ) );
+ add_editor_plugin( memnew( AudioBusesEditorPlugin(audio_bus_editor) ) );
//add_editor_plugin( memnew( MaterialEditorPlugin(this) ) );
//add_editor_plugin( memnew( MeshEditorPlugin(this) ) );
@@ -6619,6 +6332,9 @@ EditorNode::EditorNode() {
plugin_init_callbacks[i]();
}
+
+
+
/*resource_preview->add_preview_generator( Ref<EditorTexturePreviewPlugin>( memnew(EditorTexturePreviewPlugin )));
resource_preview->add_preview_generator( Ref<EditorPackedScenePreviewPlugin>( memnew(EditorPackedScenePreviewPlugin )));
resource_preview->add_preview_generator( Ref<EditorMaterialPreviewPlugin>( memnew(EditorMaterialPreviewPlugin )));
@@ -6675,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;
@@ -6765,6 +6489,7 @@ EditorNode::EditorNode() {
FileAccess::set_file_close_fail_notify_callback(_file_access_close_error_notify);
+ waiting_for_first_scan=true;
}
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index fbba7ae7a9..4aca433f9c 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -50,6 +50,7 @@
#include "tools/editor/reparent_dialog.h"
#include "tools/editor/connections_dialog.h"
#include "tools/editor/node_dock.h"
+#include "tools/editor/import_dock.h"
#include "tools/editor/settings_config_dialog.h"
#include "tools/editor/groups_editor.h"
#include "tools/editor/editor_data.h"
@@ -134,7 +135,6 @@ private:
FILE_EXPORT_MESH_LIBRARY,
FILE_EXPORT_TILESET,
FILE_SAVE_OPTIMIZED,
- FILE_DUMP_STRINGS,
FILE_OPEN_RECENT,
FILE_OPEN_OLD_SCENE,
FILE_QUICK_OPEN_SCENE,
@@ -278,6 +278,7 @@ private:
//ResourcesDock *resources_dock;
PropertyEditor *property_editor;
NodeDock *node_dock;
+ ImportDock *import_dock;
VBoxContainer *prop_editor_vb;
FileSystemDock *filesystem_dock;
EditorRunNative *run_native;
@@ -318,9 +319,6 @@ private:
//TabContainer *prop_pallete;
//TabContainer *top_pallete;
String defer_load_scene;
- String defer_translatable;
- String defer_optimize;
- String defer_optimize_preset;
String defer_export;
String defer_export_platform;
bool defer_export_debug;
@@ -340,7 +338,7 @@ private:
Vector<ToolButton*> main_editor_buttons;
Vector<EditorPlugin*> editor_table;
- EditorReImportDialog *reimport_dialog;
+// EditorReImportDialog *reimport_dialog;
ProgressDialog *progress_dialog;
BackgroundProgress *progress_hb;
@@ -348,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];
@@ -376,6 +378,7 @@ private:
bool unsaved_cache;
String open_navigate;
bool changing_scene;
+ bool waiting_for_first_scan;
bool waiting_for_sources_changed;
@@ -391,8 +394,8 @@ private:
EditorData editor_data;
EditorRun editor_run;
EditorSelection *editor_selection;
- ProjectExport *project_export;
- ProjectExportDialog *project_export_settings;
+// ProjectExport *project_export;
+// ProjectExportDialog *project_export_settings;
EditorResourcePreview *resource_preview;
EditorFileServer *file_server;
@@ -488,7 +491,6 @@ private:
static void _load_error_notify(void* p_ud,const String& p_text);
bool has_main_screen() const { return true; }
- void _fetch_translatable_strings(const Object *p_object,Set<StringName>& strings);
bool _find_editing_changed_scene(Node *p_from);
@@ -586,6 +588,8 @@ private:
MAX_BUILD_CALLBACKS=128
};
+ void _inherit_imported(const String &p_action);
+ void _open_imported();
static int plugin_init_callback_count;
@@ -647,9 +651,6 @@ public:
void add_control_to_dock(DockSlot p_slot,Control* p_control);
void remove_control_from_dock(Control* p_control);
- void add_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
- void remove_editor_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
-
void set_addon_plugin_enabled(const String& p_addon,bool p_enabled);
bool is_addon_plugin_enabled(const String &p_addon) const;
@@ -686,11 +687,10 @@ public:
Node *get_edited_scene() { return editor_data.get_edited_scene_root(); }
Viewport *get_scene_root() { return scene_root; } //root of the scene being edited
- Error save_optimized_copy(const String& p_scene,const String& p_preset);
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);
@@ -706,13 +706,12 @@ public:
void request_instance_scene(const String &p_path);
void request_instance_scenes(const Vector<String>& p_files);
FileSystemDock *get_filesystem_dock();
+ ImportDock *get_import_dock();
SceneTreeDock *get_scene_tree_dock();
static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); }
EditorSelection *get_editor_selection() { return editor_selection; }
- Error save_translatable_strings(const String& p_to_file);
-
void set_convert_old_scene(bool p_old) { convert_old=p_old; }
void notify_child_process_exited();
@@ -787,7 +786,6 @@ public:
};
-
struct EditorProgress {
String task;
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 2f59b0bd07..2f44b5558c 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -319,27 +319,6 @@ EditorResourcePreview *EditorPlugin::get_resource_previewer() {
return EditorResourcePreview::get_singleton();
}
-void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import) {
-
- EditorNode::get_singleton()->add_editor_import_plugin(p_editor_import);
-}
-
-void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import){
-
- EditorNode::get_singleton()->remove_editor_import_plugin(p_editor_import);
-
-}
-
-void EditorPlugin::add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){
-
- EditorImportExport::get_singleton()->add_export_plugin(p_editor_export);
-}
-void EditorPlugin::remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export){
-
- EditorImportExport::get_singleton()->remove_export_plugin(p_editor_export);
-
-}
-
Control *EditorPlugin::get_base_control() {
return EditorNode::get_singleton()->get_gui_base();
@@ -378,12 +357,6 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(_MD("remove_custom_type","type"),&EditorPlugin::remove_custom_type);
ClassDB::bind_method(_MD("get_editor_viewport:Control"), &EditorPlugin::get_editor_viewport);
- ClassDB::bind_method(_MD("add_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::add_import_plugin);
- ClassDB::bind_method(_MD("remove_import_plugin","plugin:EditorImportPlugin"),&EditorPlugin::remove_import_plugin);
-
- ClassDB::bind_method(_MD("add_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::add_export_plugin);
- ClassDB::bind_method(_MD("remove_export_plugin","plugin:EditorExportPlugin"),&EditorPlugin::remove_export_plugin);
-
ClassDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer);
ClassDB::bind_method(_MD("get_resource_filesystem:EditorFileSystem"),&EditorPlugin::get_resource_file_system);
diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h
index 928b096859..cf998dd55b 100644
--- a/tools/editor/editor_plugin.h
+++ b/tools/editor/editor_plugin.h
@@ -139,12 +139,6 @@ public:
void make_bottom_panel_item_visible(Control *p_item);
void hide_bottom_panel();
- void add_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
- void remove_import_plugin(const Ref<EditorImportPlugin>& p_editor_import);
-
- void add_export_plugin(const Ref<EditorExportPlugin>& p_editor_export);
- void remove_export_plugin(const Ref<EditorExportPlugin>& p_editor_export);
-
EditorSelection* get_selection();
//EditorImportExport *get_import_export();
EditorSettings *get_editor_settings();
diff --git a/tools/editor/editor_reimport_dialog.cpp b/tools/editor/editor_reimport_dialog.cpp
index e5ae33e919..5904070230 100644
--- a/tools/editor/editor_reimport_dialog.cpp
+++ b/tools/editor/editor_reimport_dialog.cpp
@@ -31,6 +31,7 @@
#include "editor_file_system.h"
#include "editor_node.h"
+#if 0
void EditorReImportDialog::popup_reimport() {
if (EditorFileSystem::get_singleton()->is_scanning()) {
@@ -144,3 +145,4 @@ EditorReImportDialog::EditorReImportDialog() {
scene_must_save=false;
}
+#endif
diff --git a/tools/editor/editor_reimport_dialog.h b/tools/editor/editor_reimport_dialog.h
index 68e1ca0597..7379c70c5e 100644
--- a/tools/editor/editor_reimport_dialog.h
+++ b/tools/editor/editor_reimport_dialog.h
@@ -29,6 +29,7 @@
#ifndef EDITOR_REIMPORT_DIALOG_H
#define EDITOR_REIMPORT_DIALOG_H
+#if 0
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
@@ -49,3 +50,4 @@ public:
};
#endif // EDITOR_REIMPORT_DIALOG_H
+#endif
diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp
index 12b7b761ed..25cb41befc 100644
--- a/tools/editor/editor_run_native.cpp
+++ b/tools/editor/editor_run_native.cpp
@@ -32,7 +32,7 @@
void EditorRunNative::_notification(int p_what) {
-
+#if 0
if (p_what==NOTIFICATION_ENTER_TREE) {
List<StringName> ep;
@@ -97,11 +97,12 @@ void EditorRunNative::_notification(int p_what) {
first=false;
}
}
-
+#endif
}
void EditorRunNative::_run_native(int p_idx,const String& p_platform) {
+#if 0
Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform);
ERR_FAIL_COND(eep.is_null());
if (p_idx == -1) {
@@ -125,6 +126,8 @@ void EditorRunNative::_run_native(int p_idx,const String& p_platform) {
flags|=EditorExportPlatform::EXPORT_VIEW_NAVIGATION;
eep->run(p_idx,flags);
+
+#endif
}
void EditorRunNative::_bind_methods() {
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 27aeaeb5b6..1cdc426541 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -653,6 +653,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("run/auto_save/save_before_running",true);
+ set("run/output/always_clear_output_on_play",true);
+ set("run/output/always_open_output_on_play",true);
set("filesystem/resources/save_compressed_resources",true);
set("filesystem/resources/auto_reload_modified_images",true);
@@ -713,6 +715,7 @@ void EditorSettings::_load_default_text_editor_theme() {
set("text_editor/highlighting/selection_color",Color::html("7b5dbe"));
set("text_editor/highlighting/brace_mismatch_color",Color(1,0.2,0.2));
set("text_editor/highlighting/current_line_color",Color(0.3,0.5,0.8,0.15));
+ set("text_editor/highlighting/line_length_guideline_color",Color(0.3,0.5,0.8,0.1));
set("text_editor/highlighting/mark_color", Color(1.0,0.4,0.4,0.4));
set("text_editor/highlighting/breakpoint_color", Color(0.8,0.8,0.4,0.2));
set("text_editor/highlighting/word_highlighted_color",Color(0.8,0.9,0.9,0.15));
@@ -970,6 +973,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
cf->set_value(theme_section, "selection_color", ((Color)get("text_editor/highlighting/selection_color")).to_html());
cf->set_value(theme_section, "brace_mismatch_color", ((Color)get("text_editor/highlighting/brace_mismatch_color")).to_html());
cf->set_value(theme_section, "current_line_color", ((Color)get("text_editor/highlighting/current_line_color")).to_html());
+ cf->set_value(theme_section, "line_length_guideline_color", ((Color)get("text_editor/highlighting/line_length_guideline_color")).to_html());
cf->set_value(theme_section, "mark_color", ((Color)get("text_editor/highlighting/mark_color")).to_html());
cf->set_value(theme_section, "breakpoint_color", ((Color)get("text_editor/highlighting/breakpoint_color")).to_html());
cf->set_value(theme_section, "word_highlighted_color", ((Color)get("text_editor/highlighting/word_highlighted_color")).to_html());
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/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp
index 26a118521b..08b8307eb4 100644
--- a/tools/editor/filesystem_dock.cpp
+++ b/tools/editor/filesystem_dock.cpp
@@ -350,25 +350,9 @@ void FileSystemDock::_search(EditorFileSystemDirectory *p_path,List<FileInfo>* m
FileInfo fi;
fi.name=file;
fi.type=p_path->get_file_type(i);
- fi.path=p_path->get_file_path(i);
- if (p_path->get_file_meta(i)) {
- if (p_path->is_missing_sources(i)) {
- fi.import_status=3;
- } else if (p_path->have_sources_changed(i)) {
- fi.import_status=2;
- } else {
- fi.import_status=1;
- }
- } else {
- fi.import_status=0;
- }
- for(int j=0;j<p_path->get_source_count(i);j++) {
- String s = EditorImportPlugin::expand_source_path(p_path->get_source_file(i,j));
- if (p_path->is_source_file_missing(i,j)) {
- s+=" (Missing)";
- }
- fi.sources.push_back(s);
- }
+ fi.path=p_path->get_file_path(i);
+ fi.import_status=0;
+
matches->push_back(fi);
if (matches->size()>p_max_items)
@@ -500,25 +484,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
fi.name=efd->get_file(i);
fi.path=path.plus_file(fi.name);
fi.type=efd->get_file_type(i);
- if (efd->get_file_meta(i)) {
- if (efd->is_missing_sources(i)) {
- fi.import_status=3;
- } else if (efd->have_sources_changed(i)) {
- fi.import_status=2;
- } else {
- fi.import_status=1;
- }
-
- for(int j=0;j<efd->get_source_count(i);j++) {
- String s = EditorImportPlugin::expand_source_path(efd->get_source_file(i,j));
- if (efd->is_source_file_missing(i,j)) {
- s+=" (Missing)";
- }
- fi.sources.push_back(s);
- }
- } else {
- fi.import_status=0;
- }
+ fi.import_status=0;
@@ -1068,7 +1034,7 @@ void FileSystemDock::_file_option(int p_option) {
}
ERR_FAIL_COND(reimport.size()==0);
-
+/*
Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(reimport[0]);
ERR_FAIL_COND(!rimd.is_valid());
String editor=rimd->get_editor();
@@ -1086,6 +1052,7 @@ void FileSystemDock::_file_option(int p_option) {
rimp->reimport_multiple_files(reimport);
}
+ */
} break;
case FILE_COPY_PATH:
@@ -1537,25 +1504,6 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
if (efsd) {
- if (!efsd->get_file_meta(pos)) {
- all_can_reimport=false;
-
-
- } else {
- Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path);
- if (rimd.is_valid()) {
-
- String editor=rimd->get_editor();
- if (editor.begins_with("texture_")) { //compatibility fix for old texture format
- editor="texture";
- }
- types.insert(editor);
-
- } else {
- all_can_reimport=false;
-
- }
- }
} else {
all_can_reimport=false;
@@ -1603,7 +1551,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
if (all_can_reimport && types.size()==1) { //all can reimport and are of the same type
-
+/*
bool valid=true;
Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(types.front()->get());
if (rimp.is_valid()) {
@@ -1619,6 +1567,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
file_options->add_separator();
file_options->add_item(TTR("Re-Import.."),FILE_REIMPORT);
}
+ */
}
file_options->set_pos(files->get_global_pos() + p_pos);
@@ -1626,6 +1575,70 @@ void FileSystemDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
}
+void FileSystemDock::select_file(const String& p_file) {
+
+ _go_to_dir(p_file.get_base_dir());
+ for(int i=0;i<files->get_item_count();i++) {
+ if (files->get_item_metadata(i)==p_file) {
+ files->select(i);
+ files->ensure_current_is_visible();
+ break;
+ }
+ }
+
+}
+
+void FileSystemDock::_file_multi_selected(int p_index,bool p_selected) {
+
+
+ _file_selected();
+}
+
+void FileSystemDock::_file_selected() {
+
+ //check import
+ Vector<String> imports;
+ String import_type;
+
+ for(int i=0;i<files->get_item_count();i++) {
+ if (!files->is_selected(i))
+ continue;
+
+ String p = files->get_item_metadata(i);
+ if (!FileAccess::exists(p+".import")) {
+ imports.clear();
+ break;
+ }
+ Ref<ConfigFile> cf;
+ cf.instance();
+ Error err = cf->load(p+".import");
+ if (err!=OK) {
+ imports.clear();
+ break;
+ }
+
+ String type = cf->get_value("remap","type");
+ if (import_type=="") {
+ import_type=type;
+ } else if (import_type!=type) {
+ //all should be the same type
+ imports.clear();
+ break;
+ }
+ imports.push_back(p);
+ }
+
+
+ if (imports.size()==0) {
+ EditorNode::get_singleton()->get_import_dock()->clear();
+ } else if (imports.size()==1) {
+ EditorNode::get_singleton()->get_import_dock()->set_edit_path(imports[0]);
+ } else {
+ EditorNode::get_singleton()->get_import_dock()->set_edit_multiple_paths(imports);
+ }
+}
+
+
void FileSystemDock::_bind_methods() {
ClassDB::bind_method(_MD("_update_tree"),&FileSystemDock::_update_tree);
@@ -1657,6 +1670,8 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(_MD("_files_list_rmb_select"),&FileSystemDock::_files_list_rmb_select);
ClassDB::bind_method(_MD("_preview_invalidated"),&FileSystemDock::_preview_invalidated);
+ ClassDB::bind_method(_MD("_file_selected"),&FileSystemDock::_file_selected);
+ ClassDB::bind_method(_MD("_file_multi_selected"),&FileSystemDock::_file_multi_selected);
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
@@ -1761,6 +1776,8 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
files->set_select_mode(ItemList::SELECT_MULTI);
files->set_drag_forwarding(this);
files->connect("item_rmb_selected",this,"_files_list_rmb_select");
+ files->connect("item_selected",this,"_file_selected");
+ files->connect("multi_selected",this,"_file_multi_selected");
files->set_allow_rmb_select(true);
file_list_vb = memnew( VBoxContainer );
diff --git a/tools/editor/filesystem_dock.h b/tools/editor/filesystem_dock.h
index 382fcf198d..224efe0f28 100644
--- a/tools/editor/filesystem_dock.h
+++ b/tools/editor/filesystem_dock.h
@@ -126,6 +126,11 @@ private:
Tree * tree; //directories
ItemList *files;
+
+ void _file_multi_selected(int p_index, bool p_selected);
+ void _file_selected();
+
+
void _go_to_tree();
void _go_to_dir(const String& p_dir);
void _select_file(int p_idx);
@@ -199,6 +204,10 @@ public:
void set_display_mode(int p_mode);
+ int get_split_offset() { return split_box->get_split_offset(); }
+ void set_split_offset(int p_offset) { split_box->set_split_offset(p_offset); }
+ void select_file(const String& p_file);
+
FileSystemDock(EditorNode *p_editor);
~FileSystemDock();
};
diff --git a/tools/editor/icons/2x/icon_transparent.png b/tools/editor/icons/2x/icon_transparent.png
new file mode 100644
index 0000000000..627607039b
--- /dev/null
+++ b/tools/editor/icons/2x/icon_transparent.png
Binary files differ
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/icons/icon_transparent.png b/tools/editor/icons/icon_transparent.png
new file mode 100644
index 0000000000..07e9b52b5c
--- /dev/null
+++ b/tools/editor/icons/icon_transparent.png
Binary files differ
diff --git a/tools/editor/import/SCsub b/tools/editor/import/SCsub
new file mode 100644
index 0000000000..f1fa50148f
--- /dev/null
+++ b/tools/editor/import/SCsub
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+Import('env')
+Export('env')
+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 a910b9c3ab..a901de1faf 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/import/editor_import_collada.cpp
@@ -28,7 +28,7 @@
/*************************************************************************/
#include "editor_import_collada.h"
-#include "collada/collada.h"
+
#include "scene/3d/spatial.h"
#include "scene/3d/skeleton.h"
#include "scene/3d/path.h"
@@ -39,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>
@@ -64,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;
@@ -86,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);
@@ -428,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!="") {
@@ -441,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
@@ -463,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));
@@ -475,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);
}
@@ -609,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;
@@ -1493,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());
}
}
@@ -1752,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;
@@ -1763,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);
+ }
+
+ }
+ }
}
}
}
@@ -2374,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);
@@ -2434,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());
@@ -2464,3 +2505,4 @@ EditorSceneImporterCollada::EditorSceneImporterCollada() {
}
+
diff --git a/tools/editor/io_plugins/editor_import_collada.h b/tools/editor/import/editor_import_collada.h
index f6642778ed..cd3614bb40 100644
--- a/tools/editor/io_plugins/editor_import_collada.h
+++ b/tools/editor/import/editor_import_collada.h
@@ -29,7 +29,7 @@
#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"
diff --git a/tools/editor/import/resource_importer_csv_translation.cpp b/tools/editor/import/resource_importer_csv_translation.cpp
new file mode 100644
index 0000000000..f14c10fb99
--- /dev/null
+++ b/tools/editor/import/resource_importer_csv_translation.cpp
@@ -0,0 +1,126 @@
+
+#include "resource_importer_csv_translation.h"
+#include "os/file_access.h"
+#include "translation.h"
+#include "io/resource_saver.h"
+#include "compressed_translation.h"
+
+String ResourceImporterCSVTranslation::get_importer_name() const {
+
+ return "csv_translation";
+}
+
+String ResourceImporterCSVTranslation::get_visible_name() const{
+
+ return "CSV Translation";
+}
+void ResourceImporterCSVTranslation::get_recognized_extensions(List<String> *p_extensions) const{
+
+ p_extensions->push_back("csv");
+}
+
+String ResourceImporterCSVTranslation::get_save_extension() const {
+ return ""; //does not save a single resoure
+}
+
+String ResourceImporterCSVTranslation::get_resource_type() const{
+
+ return "StreamCSVTranslation";
+}
+
+bool ResourceImporterCSVTranslation::get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const {
+
+ return true;
+}
+
+int ResourceImporterCSVTranslation::get_preset_count() const {
+ return 0;
+}
+String ResourceImporterCSVTranslation::get_preset_name(int p_idx) const {
+
+ return "";
+}
+
+
+void ResourceImporterCSVTranslation::get_import_options(List<ImportOption> *r_options,int p_preset) const {
+
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"compress"),true));
+
+}
+
+
+
+Error ResourceImporterCSVTranslation::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 compress = p_options["compress"];
+ FileAccessRef f = FileAccess::open(p_source_file,FileAccess::READ);
+
+ ERR_FAIL_COND_V( !f, ERR_INVALID_PARAMETER );
+
+ Vector<String> line = f->get_csv_line();
+ if (line.size()<=1) {
+ return ERR_PARSE_ERROR;
+ }
+
+ Vector<String> locales;
+ Vector<Ref<Translation> > translations;
+
+ for(int i=1;i<line.size();i++) {
+
+ String locale = line[i];
+ if (!TranslationServer::is_locale_valid(locale)) {
+ return ERR_PARSE_ERROR;
+ }
+
+ locales.push_back(locale);
+ Ref<Translation> translation;
+ translation.instance();
+ translation->set_locale(locale);
+ translations.push_back(translation);
+ }
+
+ line = f->get_csv_line();
+
+ while(line.size()==locales.size()+1) {
+
+ String key = line[0];
+ if (key!="") {
+
+ for(int i=1;i<line.size();i++) {
+ translations[i-1]->add_message(key,line[i]);
+ }
+ }
+
+ line = f->get_csv_line();
+ }
+
+
+ for(int i=0;i<translations.size();i++) {
+ Ref<Translation> xlt = translations[i];
+
+ if (compress) {
+ Ref<PHashTranslation> cxl = memnew( PHashTranslation );
+ cxl->generate( xlt );
+ xlt=cxl;
+ }
+
+ String save_path = p_source_file.get_basename()+"."+translations[i]->get_locale()+".xl";
+
+ ResourceSaver::save(save_path,xlt);
+ if (r_gen_files) {
+ r_gen_files->push_back(save_path);
+ }
+ }
+
+
+
+ return OK;
+
+}
+
+ResourceImporterCSVTranslation::ResourceImporterCSVTranslation()
+{
+
+}
diff --git a/tools/editor/import/resource_importer_csv_translation.h b/tools/editor/import/resource_importer_csv_translation.h
new file mode 100644
index 0000000000..d08218e7d9
--- /dev/null
+++ b/tools/editor/import/resource_importer_csv_translation.h
@@ -0,0 +1,27 @@
+#ifndef RESOURCEIMPORTERCSVTRANSLATION_H
+#define RESOURCEIMPORTERCSVTRANSLATION_H
+
+#include "io/resource_import.h"
+
+
+class ResourceImporterCSVTranslation : public ResourceImporter {
+ GDCLASS(ResourceImporterCSVTranslation,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);
+
+ ResourceImporterCSVTranslation();
+};
+
+#endif // RESOURCEIMPORTERCSVTRANSLATION_H
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_importer_texture.cpp b/tools/editor/import/resource_importer_texture.cpp
new file mode 100644
index 0000000000..21e434fa11
--- /dev/null
+++ b/tools/editor/import/resource_importer_texture.cpp
@@ -0,0 +1,393 @@
+#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 {
+
+ return "texture";
+}
+
+String ResourceImporterTexture::get_visible_name() const{
+
+ return "Texture";
+}
+void ResourceImporterTexture::get_recognized_extensions(List<String> *p_extensions) const{
+
+ ImageLoader::get_recognized_extensions(p_extensions);
+}
+String ResourceImporterTexture::get_save_extension() const {
+ return "stex";
+}
+
+String ResourceImporterTexture::get_resource_type() const{
+
+ return "StreamTexture";
+}
+
+bool ResourceImporterTexture::get_option_visibility(const String& p_option,const Map<StringName,Variant>& p_options) const {
+
+ if (p_option=="compress/lossy_quality" && int(p_options["compress/mode"])!=COMPRESS_LOSSY)
+ return false;
+
+ return true;
+}
+
+int ResourceImporterTexture::get_preset_count() const {
+ return 4;
+}
+String ResourceImporterTexture::get_preset_name(int p_idx) const {
+
+ static const char* preset_names[]={
+ "2D, Detect 3D",
+ "2D",
+ "2D Pixel",
+ "3D"
+ };
+
+ return preset_names[p_idx];
+}
+
+
+void ResourceImporterTexture::get_import_options(List<ImportOption> *r_options,int p_preset) const {
+
+
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"compress/mode",PROPERTY_HINT_ENUM,"Lossless,Lossy,Video RAM,Uncompressed",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED),p_preset==PRESET_3D?2:0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::REAL,"compress/lossy_quality",PROPERTY_HINT_RANGE,"0,1,0.01"),0.7));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"flags/repeat",PROPERTY_HINT_ENUM,"Disabled,Enabled,Mirrored"),p_preset==PRESET_3D?1:0));
+ 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::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));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::INT,"size_limit",PROPERTY_HINT_RANGE,"0,4096,1"),0));
+ r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL,"detect_3d"),p_preset==PRESET_DETECT));
+
+}
+
+
+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);
+ f->store_8('G');
+ f->store_8('D');
+ f->store_8('S');
+ f->store_8('T'); //godot streamable texture
+
+ f->store_32(p_image.get_width());
+ f->store_32(p_image.get_height());
+ f->store_32(p_texture_flags);
+
+ uint32_t format=0;
+
+ if (p_streamable)
+ 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: {
+
+ Image image = p_image;
+ if (p_mipmaps) {
+ image.generate_mipmaps();
+ } else {
+ image.clear_mipmaps();
+ }
+
+ int mmc = image.get_mipmap_count() + 1;
+
+ format|=StreamTexture::FORMAT_BIT_LOSSLESS;
+ f->store_32(format);
+ f->store_32(mmc);
+
+ for(int i=0;i<mmc;i++) {
+
+ if (i>0) {
+ image.shrink_x2();
+ }
+
+ PoolVector<uint8_t> data = Image::lossless_packer(image);
+ int data_len = data.size();
+ f->store_32(data_len);
+
+ PoolVector<uint8_t>::Read r= data.read();
+ f->store_buffer(r.ptr(),data_len);
+
+ }
+
+
+ } break;
+ case COMPRESS_LOSSY: {
+ Image image = p_image;
+ if (p_mipmaps) {
+ image.generate_mipmaps();
+ } else {
+ image.clear_mipmaps();
+ }
+
+ int mmc = image.get_mipmap_count() + 1;
+
+ format|=StreamTexture::FORMAT_BIT_LOSSY;
+ f->store_32(format);
+ f->store_32(mmc);
+
+ for(int i=0;i<mmc;i++) {
+
+ if (i>0) {
+ image.shrink_x2();
+ }
+
+ PoolVector<uint8_t> data = Image::lossy_packer(image,p_lossy_quality);
+ int data_len = data.size();
+ f->store_32(data_len);
+
+ PoolVector<uint8_t>::Read r = data.read();
+ f->store_buffer(r.ptr(),data_len);
+
+ }
+ } break;
+ case COMPRESS_VIDEO_RAM: {
+
+ Image image = p_image;
+ image.generate_mipmaps();
+ image.compress(p_vram_compression);
+
+ format |= image.get_format();
+
+ f->store_32(format);
+
+ 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;
+ case COMPRESS_UNCOMPRESSED: {
+
+ Image image = p_image;
+ if (p_mipmaps) {
+ image.generate_mipmaps();
+ } else {
+ image.clear_mipmaps();
+ }
+
+ format |= image.get_format();
+ f->store_32(format);
+
+ 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;
+ }
+
+ memdelete(f);
+}
+
+Error ResourceImporterTexture::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) {
+
+ int compress_mode = p_options["compress/mode"];
+ float lossy= p_options["compress/lossy_quality"];
+ int repeat= p_options["flags/repeat"];
+ bool filter= p_options["flags/filter"];
+ bool mipmaps= p_options["flags/mipmaps"];
+ bool anisotropic= p_options["flags/anisotropic"];
+ 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"];
+ int size_limit = p_options["size_limit"];
+
+
+ Image image;
+ Error err = ImageLoader::load_image(p_source_file,&image);
+ if (err!=OK)
+ return err;
+
+
+ int tex_flags=0;
+ if (repeat>0)
+ tex_flags|=Texture::FLAG_REPEAT;
+ if (repeat==2)
+ tex_flags|=Texture::FLAG_MIRRORED_REPEAT;
+ if (filter)
+ tex_flags|=Texture::FLAG_FILTER;
+ if (mipmaps || compress_mode==COMPRESS_VIDEO_RAM)
+ tex_flags|=Texture::FLAG_MIPMAPS;
+ if (anisotropic)
+ tex_flags|=Texture::FLAG_ANISOTROPIC_FILTER;
+ if (srgb==1)
+ tex_flags|=Texture::FLAG_CONVERT_TO_LINEAR;
+
+ if (size_limit >0 && (image.get_width()>size_limit || image.get_height()>size_limit )) {
+ //limit size
+ if (image.get_width() >= image.get_height()) {
+ int new_width = size_limit;
+ int new_height = image.get_height() * new_width / image.get_width();
+
+ image.resize(new_width,new_height,Image::INTERPOLATE_CUBIC);
+ } else {
+
+ int new_height = size_limit;
+ int new_width = image.get_width() * new_height / image.get_height();
+
+ image.resize(new_width,new_height,Image::INTERPOLATE_CUBIC);
+ }
+ }
+
+ if (fix_alpha_border) {
+ image.fix_alpha_edges();
+ }
+
+ if (premult_alpha) {
+ 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,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,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,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_importer_texture.h b/tools/editor/import/resource_importer_texture.h
new file mode 100644
index 0000000000..4c795e132c
--- /dev/null
+++ b/tools/editor/import/resource_importer_texture.h
@@ -0,0 +1,70 @@
+#ifndef RESOURCEIMPORTTEXTURE_H
+#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;
+ virtual String get_save_extension() const;
+ virtual String get_resource_type() const;
+
+
+ enum Preset {
+ PRESET_DETECT,
+ PRESET_2D,
+ PRESET_2D_PIXEL,
+ PRESET_3D,
+ };
+
+ enum CompressMode {
+ COMPRESS_LOSSLESS,
+ COMPRESS_LOSSY,
+ COMPRESS_VIDEO_RAM,
+ COMPRESS_UNCOMPRESSED
+ };
+
+ 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 _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/import_dock.cpp b/tools/editor/import_dock.cpp
new file mode 100644
index 0000000000..b1bd698239
--- /dev/null
+++ b/tools/editor/import_dock.cpp
@@ -0,0 +1,331 @@
+#include "import_dock.h"
+
+class ImportDockParameters : public Object {
+ GDCLASS(ImportDockParameters,Object)
+public:
+ Map<StringName,Variant> values;
+ List<PropertyInfo> properties;
+ Ref<ResourceImporter> importer;
+ Vector<String> paths;
+
+
+ bool _set(const StringName& p_name, const Variant& p_value) {
+
+ if (values.has(p_name)) {
+ values[p_name]=p_value;
+ return true;
+ }
+
+ return false;
+ }
+
+ bool _get(const StringName& p_name,Variant &r_ret) const {
+
+ if (values.has(p_name)) {
+ r_ret=values[p_name];
+ return true;
+ }
+
+ return false;
+
+ }
+ void _get_property_list( List<PropertyInfo> *p_list) const {
+
+ for (const List<PropertyInfo>::Element *E=properties.front();E;E=E->next()) {
+ if (!importer->get_option_visibility(E->get().name,values))
+ continue;
+ p_list->push_back(E->get());
+ }
+ }
+
+ void update() {
+ _change_notify();
+ }
+};
+
+void ImportDock::set_edit_path(const String& p_path) {
+
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(p_path+".import");
+ if (err!=OK) {
+ clear();
+ return;
+ }
+
+
+ params->importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(config->get_value("remap","importer"));
+ if (params->importer.is_null()) {
+ clear();
+ return;
+ }
+
+ List<ResourceImporter::ImportOption> options;
+ params->importer->get_import_options(&options);
+
+ params->properties.clear();
+ params->values.clear();
+
+ for (List<ResourceImporter::ImportOption>::Element *E=options.front();E;E=E->next()) {
+
+ params->properties.push_back(E->get().option);
+ if (config->has_section_key("params",E->get().option.name)) {
+ params->values[E->get().option.name]=config->get_value("params",E->get().option.name);
+ } else {
+ params->values[E->get().option.name]=E->get().default_value;
+ }
+ }
+
+ params->update();
+
+ List<Ref<ResourceImporter> > importers;
+ ResourceFormatImporter::get_singleton()->get_importers_for_extension(p_path.get_extension(),&importers);
+ List<Pair<String,String> > importer_names;
+
+ for (List<Ref<ResourceImporter> > ::Element *E=importers.front();E;E=E->next()) {
+ importer_names.push_back(Pair<String,String>(E->get()->get_visible_name(),E->get()->get_importer_name()));
+ }
+
+ importer_names.sort_custom<PairSort<String,String> >();
+
+ import_as->clear();
+
+ for (List<Pair<String,String> >::Element *E=importer_names.front();E;E=E->next()) {
+ import_as->add_item(E->get().first);
+ import_as->set_item_metadata(import_as->get_item_count()-1,E->get().second);
+ if (E->get().second==params->importer->get_importer_name()) {
+ import_as->select(import_as->get_item_count()-1);
+ }
+ }
+
+ preset->get_popup()->clear();
+
+ if (params->importer->get_preset_count()==0) {
+ preset->get_popup()->add_item(TTR("Default"));
+ } else {
+ for (int i=0;i<params->importer->get_preset_count();i++) {
+ preset->get_popup()->add_item(params->importer->get_preset_name(i));
+ }
+ }
+
+ params->paths.clear();
+ params->paths.push_back(p_path);
+ import->set_disabled(false);
+ import_as->set_disabled(false);
+
+ imported->set_text(p_path.get_file());
+}
+
+void ImportDock::set_edit_multiple_paths(const Vector<String>& p_paths) {
+
+ clear();
+
+ //use the value that is repeated the mot
+ Map<String,Dictionary> value_frequency;
+
+ for(int i=0;i<p_paths.size();i++) {
+
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(p_paths[i]+".import");
+ ERR_CONTINUE(err!=OK);
+
+ if (i==0) {
+ params->importer = ResourceFormatImporter::get_singleton()->get_importer_by_name(config->get_value("remap","importer"));
+ if (params->importer.is_null()) {
+ clear();
+ return;
+ }
+ }
+
+ List<String> keys;
+ config->get_section_keys("params",&keys);
+
+
+ for (List<String>::Element *E=keys.front();E;E=E->next()) {
+
+ if (!value_frequency.has(E->get())) {
+ value_frequency[E->get()]=Dictionary();
+ }
+
+ Variant value = config->get_value("params",E->get());
+
+ if (value_frequency[E->get()].has(value)) {
+ value_frequency[E->get()][value]=int(value_frequency[E->get()][value])+1;
+ } else {
+ value_frequency[E->get()][value]=1;
+ }
+ }
+
+ }
+
+ ERR_FAIL_COND(params->importer.is_null());
+
+ List<ResourceImporter::ImportOption> options;
+ params->importer->get_import_options(&options);
+
+ params->properties.clear();
+ params->values.clear();
+
+ for (List<ResourceImporter::ImportOption>::Element *E=options.front();E;E=E->next()) {
+
+ params->properties.push_back(E->get().option);
+
+ if (value_frequency.has(E->get().option.name)) {
+
+ Dictionary d = value_frequency[E->get().option.name];
+ int freq=0;
+ List<Variant> v;
+ d.get_key_list(&v);
+ Variant value;
+ for (List<Variant>::Element *F=v.front();F;F=F->next()) {
+ int f = d[F->get()];
+ if (f>freq) {
+ value=F->get();
+ }
+ }
+
+ params->values[E->get().option.name]=value;
+ } else {
+ params->values[E->get().option.name]=E->get().default_value;
+ }
+ }
+
+ params->update();
+
+ List<Ref<ResourceImporter> > importers;
+ ResourceFormatImporter::get_singleton()->get_importers_for_extension(p_paths[0].get_extension(),&importers);
+ List<Pair<String,String> > importer_names;
+
+ for (List<Ref<ResourceImporter> > ::Element *E=importers.front();E;E=E->next()) {
+ importer_names.push_back(Pair<String,String>(E->get()->get_visible_name(),E->get()->get_importer_name()));
+ }
+
+ importer_names.sort_custom<PairSort<String,String> >();
+
+ import_as->clear();
+
+ for (List<Pair<String,String> >::Element *E=importer_names.front();E;E=E->next()) {
+ import_as->add_item(E->get().first);
+ import_as->set_item_metadata(import_as->get_item_count()-1,E->get().second);
+ if (E->get().second==params->importer->get_importer_name()) {
+ import_as->select(import_as->get_item_count()-1);
+ }
+ }
+
+ preset->get_popup()->clear();
+
+ if (params->importer->get_preset_count()==0) {
+ preset->get_popup()->add_item(TTR("Default"));
+ } else {
+ for (int i=0;i<params->importer->get_preset_count();i++) {
+ preset->get_popup()->add_item(params->importer->get_preset_name(i));
+ }
+ }
+
+ params->paths=p_paths;
+ import->set_disabled(false);
+ import_as->set_disabled(false);
+
+ imported->set_text(itos(p_paths.size())+TTR(" Files"));
+}
+
+void ImportDock::_preset_selected(int p_idx) {
+
+ print_line("preset selected? "+p_idx);
+ List<ResourceImporter::ImportOption> options;
+
+ params->importer->get_import_options(&options,p_idx);
+
+ for (List<ResourceImporter::ImportOption>::Element *E=options.front();E;E=E->next()) {
+
+ params->values[E->get().option.name]=E->get().default_value;
+ }
+
+ params->update();
+
+}
+
+
+void ImportDock::clear() {
+
+ imported->set_text("");
+ import->set_disabled(true);
+ import_as->clear();
+ import_as->set_disabled(true);
+ params->values.clear();
+ params->properties.clear();
+ params->update();
+ preset->get_popup()->clear();
+
+}
+
+void ImportDock::_reimport() {
+
+ for(int i=0;i<params->paths.size();i++) {
+
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(params->paths[i]+".import");
+ ERR_CONTINUE(err!=OK);
+
+ config->erase_section("params");
+
+ for (List<PropertyInfo>::Element *E=params->properties.front();E;E=E->next()) {
+ config->set_value("params",E->get().name,params->values[E->get().name]);
+ }
+
+ config->save(params->paths[i]+".import");
+ }
+
+ EditorFileSystem::get_singleton()->reimport_files(params->paths);
+ EditorFileSystem::get_singleton()->emit_signal("filesystem_changed"); //it changed, so force emitting the signal
+
+}
+
+void ImportDock::_bind_methods() {
+
+ ClassDB::bind_method(_MD("_reimport"),&ImportDock::_reimport);
+ ClassDB::bind_method(_MD("_preset_selected"),&ImportDock::_preset_selected);
+}
+
+ImportDock::ImportDock() {
+
+
+ imported = memnew( LineEdit );
+ imported->set_editable(false);
+ add_child(imported);
+ HBoxContainer *hb = memnew(HBoxContainer);
+ add_margin_child(TTR("Import As:"),hb);
+ import_as = memnew( OptionButton );
+ hb->add_child(import_as);
+ import_as->set_h_size_flags(SIZE_EXPAND_FILL);
+ preset = memnew( MenuButton );
+ preset->set_text(TTR("Preset.."));
+ preset->get_popup()->connect("index_pressed",this,"_preset_selected");
+ hb->add_child(preset);
+
+ import_opts = memnew( PropertyEditor );
+ add_child(import_opts);
+ import_opts->set_v_size_flags(SIZE_EXPAND_FILL);
+ import_opts->hide_top_label();
+ import_opts->set_hide_script(true);
+
+ hb = memnew( HBoxContainer );
+ add_child(hb);
+ import = memnew( Button );
+ import->set_text(TTR("Reimport"));
+ import->connect("pressed",this,"_reimport");
+ hb->add_spacer();
+ hb->add_child(import);
+ hb->add_spacer();
+
+ params = memnew( ImportDockParameters );
+ import_opts->edit(params);
+
+}
+
+ImportDock::~ImportDock() {
+
+ memdelete(params);
+}
diff --git a/tools/editor/import_dock.h b/tools/editor/import_dock.h
new file mode 100644
index 0000000000..bddf5480b8
--- /dev/null
+++ b/tools/editor/import_dock.h
@@ -0,0 +1,42 @@
+#ifndef IMPORTDOCK_H
+#define IMPORTDOCK_H
+
+#include "io/resource_import.h"
+#include "editor_file_system.h"
+#include "scene/gui/box_container.h"
+#include "scene/gui/option_button.h"
+#include "scene/gui/popup_menu.h"
+#include "property_editor.h"
+
+class ImportDockParameters;
+class ImportDock : public VBoxContainer {
+ GDCLASS(ImportDock,VBoxContainer)
+
+ LineEdit *imported;
+ OptionButton *import_as;
+ MenuButton *preset;
+ PropertyEditor *import_opts;
+
+ List<PropertyInfo> properties;
+ Map<StringName,Variant> property_values;
+
+ Button *import;
+
+ ImportDockParameters *params;
+
+ void _preset_selected(int p_idx);
+
+ void _reimport();
+protected:
+ static void _bind_methods();
+public:
+
+ void set_edit_path(const String& p_path);
+ void set_edit_multiple_paths(const Vector<String>& p_paths);
+ void clear();
+
+ ImportDock();
+ ~ImportDock();
+};
+
+#endif // IMPORTDOCK_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_bitmask_import_plugin.cpp b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
index 222a9d9517..587353fef8 100644
--- a/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_bitmask_import_plugin.h"
-
+#if 0
#include "io/image_loader.h"
#include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_dir_dialog.h"
@@ -384,3 +384,4 @@ EditorBitMaskImportPlugin::EditorBitMaskImportPlugin(EditorNode* p_editor) {
EditorBitMaskExportPlugin::EditorBitMaskExportPlugin() {
}
+#endif
diff --git a/tools/editor/io_plugins/editor_bitmask_import_plugin.h b/tools/editor/io_plugins/editor_bitmask_import_plugin.h
index 3a6aababe2..89ff58ec93 100644
--- a/tools/editor/io_plugins/editor_bitmask_import_plugin.h
+++ b/tools/editor/io_plugins/editor_bitmask_import_plugin.h
@@ -28,7 +28,7 @@
/*************************************************************************/
#ifndef EDITOR_BITMASK_IMPORT_PLUGIN_H
#define EDITOR_BITMASK_IMPORT_PLUGIN_H
-
+#if 0
#include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h"
@@ -66,4 +66,5 @@ public:
EditorBitMaskExportPlugin();
};
+#endif
#endif // EDITOR_SAMPLE_IMPORT_PLUGIN_H
diff --git a/tools/editor/io_plugins/editor_export_scene.cpp b/tools/editor/io_plugins/editor_export_scene.cpp
index 7d19258411..f4ab9880ff 100644
--- a/tools/editor/io_plugins/editor_export_scene.cpp
+++ b/tools/editor/io_plugins/editor_export_scene.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_export_scene.h"
-
+#if 0
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/dir_access.h"
@@ -139,3 +139,4 @@ Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref<
EditorSceneExportPlugin::EditorSceneExportPlugin()
{
}
+#endif
diff --git a/tools/editor/io_plugins/editor_export_scene.h b/tools/editor/io_plugins/editor_export_scene.h
index 13493220cb..191029bd84 100644
--- a/tools/editor/io_plugins/editor_export_scene.h
+++ b/tools/editor/io_plugins/editor_export_scene.h
@@ -31,7 +31,7 @@
#include "tools/editor/editor_import_export.h"
-
+#if 0
class EditorSceneExportPlugin : public EditorExportPlugin {
GDCLASS( EditorSceneExportPlugin, EditorExportPlugin );
public:
@@ -40,5 +40,5 @@ public:
EditorSceneExportPlugin();
};
-
+#endif
#endif // EDITOR_EXPORT_SCENE_H
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp
index 0deb5cbbfa..417aad0db8 100644
--- a/tools/editor/io_plugins/editor_font_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_font_import_plugin.h"
-
+#if 0
#include "scene/gui/dialogs.h"
#include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_node.h"
@@ -1701,3 +1701,4 @@ EditorFontImportPlugin::EditorFontImportPlugin(EditorNode* p_editor) {
dialog = memnew( EditorFontImportDialog(this) );
p_editor->get_gui_base()->add_child(dialog);
}
+#endif
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.h b/tools/editor/io_plugins/editor_font_import_plugin.h
index 73c699c090..a5b265736f 100644
--- a/tools/editor/io_plugins/editor_font_import_plugin.h
+++ b/tools/editor/io_plugins/editor_font_import_plugin.h
@@ -31,7 +31,7 @@
#include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h"
-
+#if 0
class EditorNode;
class EditorFontImportDialog;
@@ -55,3 +55,4 @@ public:
};
#endif // EDITOR_FONT_IMPORT_PLUGIN_H
+#endif
diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp
index d07a21fc7d..fc3f8fd8c9 100644
--- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp
@@ -28,6 +28,8 @@
/*************************************************************************/
#include "editor_mesh_import_plugin.h"
+#if 0
+
#include "tools/editor/editor_file_dialog.h"
#include "tools/editor/editor_dir_dialog.h"
#include "tools/editor/editor_node.h"
@@ -588,3 +590,4 @@ EditorMeshImportPlugin::EditorMeshImportPlugin(EditorNode* p_editor) {
dialog = memnew( EditorMeshImportDialog(this));
p_editor->get_gui_base()->add_child(dialog);
}
+#endif
diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.h b/tools/editor/io_plugins/editor_mesh_import_plugin.h
index 1f15fee3a7..ba8ec58191 100644
--- a/tools/editor/io_plugins/editor_mesh_import_plugin.h
+++ b/tools/editor/io_plugins/editor_mesh_import_plugin.h
@@ -29,7 +29,7 @@
#ifndef EDITOR_MESH_IMPORT_PLUGIN_H
#define EDITOR_MESH_IMPORT_PLUGIN_H
-
+#if 0
#include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h"
@@ -55,4 +55,5 @@ public:
EditorMeshImportPlugin(EditorNode* p_editor);
};
+#endif
#endif // EDITOR_MESH_IMPORT_PLUGIN_H
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index ce6c49fcba..bffccb9072 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_scene_import_plugin.h"
-
+#if 0
#include "globals.h"
#include "tools/editor/editor_node.h"
#include "scene/resources/packed_scene.h"
@@ -2989,3 +2989,4 @@ EditorSceneAnimationImportPlugin::EditorSceneAnimationImportPlugin(EditorNode* p
}
+#endif
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h
index 61153e3654..bbafc126bb 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.h
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.h
@@ -28,7 +28,7 @@
/*************************************************************************/
#ifndef EDITOR_SCENE_IMPORT_PLUGIN_H
#define EDITOR_SCENE_IMPORT_PLUGIN_H
-
+#if 0
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
#include "scene/gui/label.h"
@@ -196,5 +196,5 @@ public:
};
-
+#endif
#endif // EDITOR_SCENE_IMPORT_PLUGIN_H
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 8e1bcb8e4b..c41199f291 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_texture_import_plugin.h"
-
+#if 0
#include "io/image_loader.h"
#include "tools/editor/editor_node.h"
#include "io/resource_saver.h"
@@ -1890,3 +1890,4 @@ EditorTextureExportPlugin::EditorTextureExportPlugin() {
}
+#endif
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h
index b2117f1475..ce15df0f18 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.h
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.h
@@ -29,6 +29,12 @@
#ifndef EDITOR_TEXTURE_IMPORT_PLUGIN_H
#define EDITOR_TEXTURE_IMPORT_PLUGIN_H
+
+
+
+
+
+#if 0
#include "tools/editor/editor_import_export.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
@@ -170,3 +176,4 @@ public:
};
#endif // EDITOR_TEXTURE_IMPORT_PLUGIN_H
+#endif
diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp
index 7079120feb..5ecb0b1abf 100644
--- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp
@@ -28,6 +28,7 @@
/*************************************************************************/
#include "editor_translation_import_plugin.h"
+#if 0
#include "scene/gui/file_dialog.h"
#include "tools/editor/editor_dir_dialog.h"
#include "tools/editor/editor_node.h"
@@ -345,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);
@@ -474,3 +475,5 @@ EditorTranslationImportPlugin::EditorTranslationImportPlugin(EditorNode* p_edito
dialog = memnew(EditorTranslationImportDialog(this));
p_editor->get_gui_base()->add_child(dialog);
}
+
+#endif
diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.h b/tools/editor/io_plugins/editor_translation_import_plugin.h
index 38727bd778..4884ea71c5 100644
--- a/tools/editor/io_plugins/editor_translation_import_plugin.h
+++ b/tools/editor/io_plugins/editor_translation_import_plugin.h
@@ -31,7 +31,7 @@
#include "tools/editor/editor_import_export.h"
#include "scene/resources/font.h"
-
+#if 0
class EditorNode;
class EditorTranslationImportDialog;
@@ -52,4 +52,5 @@ public:
EditorTranslationImportPlugin(EditorNode* p_editor);
};
+#endif
#endif // EDITOR_TRANSLATION_IMPORT_PLUGIN_H
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/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index b3d16bb660..f10526fb77 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -448,22 +448,27 @@ void AnimationPlayerEditor::_animation_save_as(const Ref<Resource>& p_resource)
file->set_title(TTR("Save Resource As.."));
current_option = RESOURCE_SAVE;
}
+
void AnimationPlayerEditor::_animation_remove() {
- if (animation->get_item_count()==0)
+ if (animation->get_item_count() == 0)
return;
- String current = animation->get_item_text(animation->get_selected());
- Ref<Animation> anim = player->get_animation(current);
+ delete_dialog->set_text(TTR("Delete Animation?"));
+ delete_dialog->popup_centered_minsize();
+}
+
+void AnimationPlayerEditor::_animation_remove_confirmed() {
+ String current = animation->get_item_text(animation->get_selected());
+ Ref<Animation> anim = player->get_animation(current);
undo_redo->create_action(TTR("Remove Animation"));
- undo_redo->add_do_method(player,"remove_animation",current);
- undo_redo->add_undo_method(player,"add_animation",current,anim);
- undo_redo->add_do_method(this,"_animation_player_changed",player);
- undo_redo->add_undo_method(this,"_animation_player_changed",player);
+ undo_redo->add_do_method(player, "remove_animation", current);
+ undo_redo->add_undo_method(player, "add_animation", current, anim);
+ undo_redo->add_do_method(this, "_animation_player_changed", player);
+ undo_redo->add_undo_method(this, "_animation_player_changed", player);
undo_redo->commit_action();
-
}
void AnimationPlayerEditor::_select_anim_by_name(const String& p_anim) {
@@ -1268,6 +1273,7 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(_MD("_animation_rename"),&AnimationPlayerEditor::_animation_rename);
ClassDB::bind_method(_MD("_animation_load"),&AnimationPlayerEditor::_animation_load);
ClassDB::bind_method(_MD("_animation_remove"),&AnimationPlayerEditor::_animation_remove);
+ ClassDB::bind_method(_MD("_animation_remove_confirmed"),&AnimationPlayerEditor::_animation_remove_confirmed);
ClassDB::bind_method(_MD("_animation_blend"),&AnimationPlayerEditor::_animation_blend);
ClassDB::bind_method(_MD("_animation_edit"),&AnimationPlayerEditor::_animation_edit);
ClassDB::bind_method(_MD("_animation_resource_edit"),&AnimationPlayerEditor::_animation_resource_edit);
@@ -1392,6 +1398,10 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
add_child(accept);
accept->connect("confirmed", this, "_menu_confirm_current");
+ delete_dialog = memnew(ConfirmationDialog);
+ add_child(delete_dialog);
+ delete_dialog->connect("confirmed", this, "_animation_remove_confirmed");
+
duplicate_anim = memnew( ToolButton );
hb->add_child(duplicate_anim);
ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate Animation"));
@@ -1405,7 +1415,6 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
rename_anim->set_tooltip(TTR("Rename Animation"));
remove_anim = memnew( ToolButton );
-
hb->add_child(remove_anim);
ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove Animation"));
remove_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/remove_animation"));
diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h
index 840c39ba49..e28600a7ab 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.h
+++ b/tools/editor/plugins/animation_player_editor_plugin.h
@@ -97,6 +97,7 @@ class AnimationPlayerEditor : public VBoxContainer {
EditorFileDialog *file;
AcceptDialog *accept;
+ ConfirmationDialog* delete_dialog;
int current_option;
struct BlendEditor {
@@ -138,6 +139,7 @@ class AnimationPlayerEditor : public VBoxContainer {
void _animation_save_as(const Ref<Resource>& p_resource);
void _animation_remove();
+ void _animation_remove_confirmed();
void _animation_blend();
void _animation_edit();
void _animation_duplicate();
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.h b/tools/editor/plugins/canvas_item_editor_plugin.h
index f4f628fe28..dac8af5ae9 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.h
+++ b/tools/editor/plugins/canvas_item_editor_plugin.h
@@ -454,8 +454,8 @@ public:
};
-class CanvasItemEditorViewport : public VBoxContainer {
- GDCLASS( CanvasItemEditorViewport, VBoxContainer );
+class CanvasItemEditorViewport : public Control {
+ GDCLASS( CanvasItemEditorViewport, Control );
String default_type;
Vector<String> types;
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/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp
index e26a3b23bc..9ec6266419 100644
--- a/tools/editor/plugins/script_text_editor.cpp
+++ b/tools/editor/plugins/script_text_editor.cpp
@@ -115,6 +115,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_color_override("selection_color",EDITOR_DEF("text_editor/highlighting/selection_color",Color(0.2,0.2,1)));
text_edit->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/highlighting/brace_mismatch_color",Color(1,0.2,0.2)));
text_edit->add_color_override("current_line_color",EDITOR_DEF("text_editor/highlighting/current_line_color",Color(0.3,0.5,0.8,0.15)));
+ text_edit->add_color_override("line_length_guideline_color", EDITOR_DEF("text_editor/highlighting/line_length_guideline_color", Color(0,0,0)));
text_edit->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/highlighting/word_highlighted_color",Color(0.8,0.9,0.9,0.15)));
text_edit->add_color_override("number_color",EDITOR_DEF("text_editor/highlighting/number_color",Color(0.9,0.6,0.0,2)));
text_edit->add_color_override("function_color",EDITOR_DEF("text_editor/highlighting/function_color",Color(0.4,0.6,0.8)));
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 cacefaa1a2..2fa62df5bc 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -27,7 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "project_export.h"
-
+#if 0
#include "os/dir_access.h"
#include "os/file_access.h"
#include "globals.h"
@@ -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);
@@ -2127,3 +2127,4 @@ ProjectExport::ProjectExport(EditorData* p_data) {
}
+#endif
diff --git a/tools/editor/project_export.h b/tools/editor/project_export.h
index 06992a7e34..c528a23121 100644
--- a/tools/editor/project_export.h
+++ b/tools/editor/project_export.h
@@ -46,6 +46,7 @@
#include "property_editor.h"
#include "editor_import_export.h"
+#if 0
class EditorNode;
class ProjectExportDialog : public ConfirmationDialog {
@@ -242,3 +243,4 @@ public:
#endif // PROJECT_EXPORT_SETTINGS_H
+#endif
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 15d03b8a2b..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;
@@ -1342,7 +1342,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
hbc->add_spacer();
- List<StringName> ep;
+ /*List<StringName> ep;
EditorImportExport::get_singleton()->get_export_platforms(&ep);
ep.sort_custom<StringName::AlphCompare>();
@@ -1350,7 +1350,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
popup_platform->get_popup()->add_item( E->get() );
- }
+ }*/
popup_platform->get_popup()->connect("id_pressed",this,"_copy_to_platform");
get_ok()->set_text(TTR("Close"));
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index ab850ba1a7..8e3791eb8d 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -118,7 +118,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
Set<String> valid_extensions;
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
-
+ print_line("found: "+E->get());
valid_extensions.insert(E->get());
}
@@ -208,13 +208,13 @@ void CustomPropertyEditor::_menu_option(int p_which) {
case OBJ_MENU_REIMPORT: {
RES r=v;
- if (r.is_valid() && r->get_import_metadata().is_valid()) {
+/* if (r.is_valid() && r->get_import_metadata().is_valid()) {
Ref<ResourceImportMetadata> rimd = r->get_import_metadata();
Ref<EditorImportPlugin> eip = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
if (eip.is_valid()) {
eip->import_dialog(r->get_path());
}
- }
+ }*/
} break;
case OBJ_MENU_NEW_SCRIPT: {
@@ -945,11 +945,11 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
menu->add_icon_item(get_icon("EditResource","EditorIcons"),"Edit",OBJ_MENU_EDIT);
menu->add_icon_item(get_icon("Del","EditorIcons"),"Clear",OBJ_MENU_CLEAR);
menu->add_icon_item(get_icon("Duplicate","EditorIcons"),"Make Unique",OBJ_MENU_MAKE_UNIQUE);
- RES r = v;
+ /*RES r = v;
if (r.is_valid() && r->get_path().is_resource_file() && r->get_import_metadata().is_valid()) {
menu->add_separator();
menu->add_icon_item(get_icon("ReloadSmall","EditorIcons"),"Re-Import",OBJ_MENU_REIMPORT);
- }
+ }*/
/*if (r.is_valid() && r->get_path().is_resource_file()) {
menu->set_item_tooltip(1,r->get_path());
} else if (r.is_valid()) {
@@ -2431,7 +2431,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p
} break;
case Variant::COLOR: {
- p_item->set_custom_bg_color(1,obj->get(p_name));
+ tree->update();
//p_item->set_text(1,obj->get(p_name));
} break;
@@ -3140,6 +3140,10 @@ void PropertyEditor::update_tree() {
} else if ( ! (p.usage&PROPERTY_USAGE_EDITOR ) )
continue;
+
+ if (hide_script && p.name=="script/script")
+ continue;
+
String basename=p.name;
if (group!="") {
if (group_base!="") {
@@ -3708,7 +3712,7 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM );
item->set_editable( 1, !read_only );
//item->set_text(1,obj->get(p.name));
- item->set_custom_bg_color(1,obj->get(p.name));
+ item->set_custom_draw(1,this,"_draw_transparency");
if (show_type_icons)
item->set_icon( 0,get_icon("Color","EditorIcons") );
@@ -3856,6 +3860,25 @@ void PropertyEditor::update_tree() {
}
}
+void PropertyEditor::_draw_transparency(Object *t, const Rect2& p_rect) {
+
+ TreeItem *ti=t->cast_to<TreeItem>();
+ if (!ti)
+ return;
+
+ Color color=obj->get(ti->get_metadata(1));
+ Ref<Texture> arrow=tree->get_icon("select_arrow");
+
+ // make a little space between consecutive color fields
+ Rect2 area=p_rect;
+ area.pos.y+=1;
+ area.size.height-=2;
+ area.size.width-=arrow->get_size().width+5;
+ tree->draw_texture_rect(get_icon("Transparent", "EditorIcons"), area, true);
+ tree->draw_rect(area, color);
+
+}
+
void PropertyEditor::_item_selected() {
@@ -3867,7 +3890,7 @@ void PropertyEditor::_item_selected() {
}
-void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) {
+void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value, bool p_refresh_all) {
if (autoclear) {
TreeItem *item = tree->get_selected();
@@ -3880,7 +3903,11 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) {
if (!undo_redo || obj->cast_to<MultiNodeEdit>() || obj->cast_to<ArrayPropertyEdit>()) { //kind of hacky
obj->set(p_name,p_value);
- _changed_callbacks(obj,p_name);
+ if (p_refresh_all)
+ _changed_callbacks(obj,"");
+ else
+ _changed_callbacks(obj,p_name);
+
emit_signal(_prop_edited,p_name);
@@ -3890,9 +3917,14 @@ void PropertyEditor::_edit_set(const String& p_name, const Variant& p_value) {
undo_redo->add_do_property(obj,p_name,p_value);
undo_redo->add_undo_property(obj,p_name,obj->get(p_name));
+ if (p_refresh_all) {
+ undo_redo->add_do_method(this,"_changed_callback",obj,"");
+ undo_redo->add_undo_method(this,"_changed_callback",obj,"");
+ } else {
- undo_redo->add_do_method(this,"_changed_callback",obj,p_name);
- undo_redo->add_undo_method(this,"_changed_callback",obj,p_name);
+ undo_redo->add_do_method(this,"_changed_callback",obj,p_name);
+ undo_redo->add_undo_method(this,"_changed_callback",obj,p_name);
+ }
Resource *r = obj->cast_to<Resource>();
if (r) {
@@ -3954,6 +3986,9 @@ void PropertyEditor::_item_edited() {
int type=d["type"];
int hint= d["hint"];
+ int usage = d["usage"];
+ bool refresh_all = usage&PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED;
+
String hint_text=d["hint_text"];
switch(type) {
@@ -3962,7 +3997,7 @@ void PropertyEditor::_item_edited() {
} break;
case Variant::BOOL: {
- _edit_set(name,item->is_checked(1));
+ _edit_set(name,item->is_checked(1),refresh_all);
item->set_tooltip(1, item->is_checked(1) ? "True" : "False");
} break;
case Variant::INT:
@@ -3976,9 +4011,9 @@ void PropertyEditor::_item_edited() {
break;
if (type==Variant::INT)
- _edit_set(name,int(item->get_range(1)));
+ _edit_set(name,int(item->get_range(1)),refresh_all);
else
- _edit_set(name,item->get_range(1));
+ _edit_set(name,item->get_range(1),refresh_all);
} break;
case Variant::STRING: {
@@ -3993,9 +4028,9 @@ void PropertyEditor::_item_edited() {
txt=strings[idx];
}
- _edit_set(name,txt);
+ _edit_set(name,txt,refresh_all);
} else {
- _edit_set(name,item->get_text(1));
+ _edit_set(name,item->get_text(1),refresh_all);
}
} break;
// math types
@@ -4026,7 +4061,7 @@ void PropertyEditor::_item_edited() {
} break;
case Variant::NODE_PATH: {
- _edit_set(name, NodePath(item->get_text(1)));
+ _edit_set(name, NodePath(item->get_text(1)),refresh_all);
} break;
@@ -4366,6 +4401,7 @@ void PropertyEditor::_bind_methods() {
ClassDB::bind_method( "update_tree",&PropertyEditor::update_tree);
ClassDB::bind_method( "_resource_preview_done",&PropertyEditor::_resource_preview_done);
ClassDB::bind_method( "refresh",&PropertyEditor::refresh);
+ ClassDB::bind_method( "_draw_transparency",&PropertyEditor::_draw_transparency);
ClassDB::bind_method(_MD("get_drag_data_fw"), &PropertyEditor::get_drag_data_fw);
ClassDB::bind_method(_MD("can_drop_data_fw"), &PropertyEditor::can_drop_data_fw);
@@ -4456,6 +4492,8 @@ PropertyEditor::PropertyEditor() {
_prop_edited="property_edited";
+ hide_script=false;
+
undo_redo=NULL;
obj=NULL;
search_box=NULL;
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index 900d06497f..969340d5a2 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -192,6 +192,7 @@ class PropertyEditor : public Control {
bool use_doc_hints;
bool use_filter;
bool subsection_selectable;
+ bool hide_script;
HashMap<String,String> pending;
String selected_property;
@@ -224,7 +225,7 @@ class PropertyEditor : public Control {
void _node_removed(Node *p_node);
friend class ProjectExportDialog;
- void _edit_set(const String& p_name, const Variant& p_value);
+ void _edit_set(const String& p_name, const Variant& p_value,bool p_refresh_all=false);
void _draw_flags(Object *ti,const Rect2& p_rect);
bool _might_be_in_instance();
@@ -245,6 +246,7 @@ friend class ProjectExportDialog;
void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from);
void _resource_preview_done(const String& p_path,const Ref<Texture>& p_preview,Variant p_ud);
+ void _draw_transparency(Object *t, const Rect2& p_rect);
UndoRedo *undo_redo;
protected:
@@ -275,6 +277,7 @@ public:
void set_show_categories(bool p_show);
void set_use_doc_hints(bool p_enable) { use_doc_hints=p_enable; }
+ void set_hide_script(bool p_hide) { hide_script=p_hide; }
void set_use_filter(bool p_use);
void register_text_enter(Node *p_line_edit);
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index b3e4c8ed70..ae7a80377d 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -649,6 +649,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *tocopy = selection.front()->get();
+ if (tocopy==scene){
+ accept->get_ok()->set_text(TTR("I see.."));
+ accept->set_text(TTR("Can not perform with the root node."));
+ accept->popup_centered_minsize();
+ break;
+ }
+
if (tocopy!=editor_data->get_edited_scene_root() && tocopy->get_filename()!="") {
accept->get_ok()->set_text(TTR("I see.."));
accept->set_text(TTR("This operation can't be done on instanced scenes."));
@@ -768,6 +775,7 @@ Node *SceneTreeDock::_duplicate(Node *p_node, Map<Node*,Node*> &duplimap) {
ERR_FAIL_COND_V(!sd.is_valid(),NULL);
node = sd->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
ERR_FAIL_COND_V(!node,NULL);
+ node->set_scene_instance_load_placeholder(p_node->get_scene_instance_load_placeholder());
//node->generate_instance_state();
} else {
Object *obj = ClassDB::instance(p_node->get_class());
@@ -1760,7 +1768,9 @@ void SceneTreeDock::_nodes_dragged(Array p_nodes,NodePath p_to,int p_type) {
for(int i=0;i<p_nodes.size();i++) {
Node *n=get_node((p_nodes[i]));
- nodes.push_back(n);
+ if (n) {
+ nodes.push_back(n);
+ }
}
if (nodes.size()==0)
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