summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore6
-rw-r--r--.travis.yml20
-rw-r--r--COPYRIGHT.txt5
-rw-r--r--SConstruct2
-rw-r--r--core/SCsub3
-rw-r--r--core/core_builders.py35
-rw-r--r--core/input_map.cpp4
-rw-r--r--core/io/file_access_compressed.cpp1
-rw-r--r--core/io/http_client.cpp33
-rw-r--r--core/io/multiplayer_api.cpp23
-rw-r--r--core/io/multiplayer_api.h9
-rw-r--r--core/io/stream_peer_ssl.cpp57
-rw-r--r--core/io/stream_peer_ssl.h5
-rw-r--r--core/io/stream_peer_tcp.cpp31
-rw-r--r--core/math/math_funcs.cpp12
-rw-r--r--core/math/octree.h2
-rw-r--r--core/math/triangulate.cpp2
-rw-r--r--core/os/dir_access.h2
-rw-r--r--core/os/input_event.cpp16
-rw-r--r--core/os/input_event.h2
-rw-r--r--core/os/os.h2
-rw-r--r--core/project_settings.cpp2
-rw-r--r--core/script_debugger_remote.cpp16
-rw-r--r--core/variant_op.cpp8
-rw-r--r--core/variant_parser.cpp4
-rw-r--r--doc/classes/AnimatedTexture.xml1060
-rw-r--r--doc/classes/CanvasItem.xml2
-rw-r--r--doc/classes/ColorPicker.xml2
-rw-r--r--doc/classes/ColorPickerButton.xml2
-rw-r--r--doc/classes/ConfigFile.xml2
-rw-r--r--doc/classes/EditorFileSystemDirectory.xml2
-rw-r--r--doc/classes/EditorInterface.xml2
-rw-r--r--doc/classes/EditorSettings.xml8
-rw-r--r--doc/classes/Input.xml4
-rw-r--r--doc/classes/MultiplayerAPI.xml29
-rw-r--r--doc/classes/Node.xml7
-rw-r--r--doc/classes/Object.xml2
-rw-r--r--doc/classes/PhysicsBody.xml6
-rw-r--r--doc/classes/PhysicsBody2D.xml12
-rw-r--r--doc/classes/ProceduralSky.xml2
-rw-r--r--doc/classes/ProjectSettings.xml8
-rw-r--r--doc/classes/SceneState.xml2
-rw-r--r--doc/classes/SceneTree.xml4
-rw-r--r--doc/classes/Shader.xml2
-rw-r--r--doc/classes/ShaderMaterial.xml16
-rw-r--r--doc/classes/Shape2D.xml6
-rw-r--r--doc/classes/ShortCut.xml8
-rw-r--r--doc/classes/SoftBody.xml13
-rw-r--r--doc/classes/SpriteFrames.xml2
-rw-r--r--doc/classes/StreamPeerTCP.xml4
-rw-r--r--doc/classes/Timer.xml17
-rw-r--r--doc/classes/Viewport.xml7
-rw-r--r--doc/classes/VisualServer.xml10
-rwxr-xr-xdoc/tools/makerst.py222
-rw-r--r--drivers/dummy/rasterizer_dummy.h1
-rw-r--r--drivers/gles2/rasterizer_canvas_gles2.cpp2
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp15
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h1
-rw-r--r--drivers/gles2/shader_gles2.cpp2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp34
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h1
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp14
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h1
-rw-r--r--drivers/gles3/shaders/canvas.glsl10
-rw-r--r--drivers/gles3/shaders/tonemap.glsl2
-rw-r--r--drivers/unix/dir_access_unix.cpp2
-rw-r--r--drivers/unix/net_socket_posix.cpp19
-rw-r--r--drivers/unix/net_socket_posix.h1
-rw-r--r--drivers/unix/os_unix.cpp2
-rw-r--r--editor/SCsub4
-rw-r--r--editor/animation_bezier_editor.cpp9
-rw-r--r--editor/code_editor.cpp2
-rw-r--r--editor/connections_dialog.cpp5
-rw-r--r--editor/create_dialog.cpp50
-rw-r--r--editor/dependency_editor.cpp59
-rw-r--r--editor/editor_about.cpp1
-rw-r--r--editor/editor_audio_buses.cpp5
-rw-r--r--editor/editor_builders.py26
-rw-r--r--editor/editor_data.cpp45
-rw-r--r--editor/editor_data.h11
-rw-r--r--editor/editor_file_dialog.cpp20
-rw-r--r--editor/editor_file_dialog.h4
-rw-r--r--editor/editor_file_system.cpp19
-rw-r--r--editor/editor_help.cpp76
-rw-r--r--editor/editor_inspector.cpp7
-rw-r--r--editor/editor_node.cpp356
-rw-r--r--editor/editor_node.h19
-rw-r--r--editor/editor_path.cpp14
-rw-r--r--editor/editor_plugin.cpp30
-rw-r--r--editor/editor_plugin.h8
-rw-r--r--editor/editor_plugin_settings.cpp2
-rw-r--r--editor/editor_properties.cpp36
-rw-r--r--editor/editor_properties_array_dict.cpp179
-rw-r--r--editor/editor_resource_preview.cpp109
-rw-r--r--editor/editor_resource_preview.h11
-rw-r--r--editor/editor_settings.cpp37
-rw-r--r--editor/editor_settings.h6
-rw-r--r--editor/editor_spin_slider.cpp2
-rw-r--r--editor/editor_sub_scene.cpp5
-rw-r--r--editor/filesystem_dock.cpp1468
-rw-r--r--editor/filesystem_dock.h90
-rw-r--r--editor/find_in_files.cpp2
-rw-r--r--editor/groups_editor.cpp7
-rw-r--r--editor/icons/README.md2
-rw-r--r--editor/icons/icon_GUI_checked.svg4
-rw-r--r--editor/icons/icon_GUI_radio_checked.svg7
-rw-r--r--editor/icons/icon_GUI_radio_unchecked.svg6
-rw-r--r--editor/icons/icon_GUI_unchecked.svg4
-rw-r--r--editor/icons/icon_g_l_e_s_2.svg69
-rw-r--r--editor/icons/icon_g_l_e_s_3.svg67
-rw-r--r--editor/import/resource_importer_layered_texture.cpp2
-rw-r--r--editor/import/resource_importer_texture.cpp2
-rw-r--r--editor/inspector_dock.cpp14
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.cpp20
-rw-r--r--editor/plugins/abstract_polygon_2d_editor.h4
-rw-r--r--editor/plugins/animation_blend_tree_editor_plugin.cpp10
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp4
-rw-r--r--editor/plugins/animation_player_editor_plugin.h4
-rw-r--r--editor/plugins/animation_state_machine_editor.cpp2
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp72
-rw-r--r--editor/plugins/canvas_item_editor_plugin.h10
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.h4
-rw-r--r--editor/plugins/editor_preview_plugins.cpp151
-rw-r--r--editor/plugins/editor_preview_plugins.h26
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp5
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.cpp8
-rw-r--r--editor/plugins/light_occluder_2d_editor_plugin.h4
-rw-r--r--editor/plugins/path_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/path_2d_editor_plugin.h4
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp3
-rw-r--r--editor/plugins/root_motion_editor_plugin.cpp19
-rw-r--r--editor/plugins/script_editor_plugin.cpp44
-rw-r--r--editor/plugins/script_text_editor.cpp6
-rw-r--r--editor/plugins/shader_editor_plugin.cpp6
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp31
-rw-r--r--editor/plugins/spatial_editor_plugin.h1
-rw-r--r--editor/plugins/text_editor.cpp12
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp40
-rw-r--r--editor/plugins/tile_map_editor_plugin.h8
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp22
-rw-r--r--editor/project_export.cpp9
-rw-r--r--editor/project_manager.cpp3
-rw-r--r--editor/project_settings_editor.cpp4
-rw-r--r--editor/property_editor.cpp153
-rw-r--r--editor/property_editor.h3
-rw-r--r--editor/property_selector.cpp9
-rw-r--r--editor/scene_tree_dock.cpp51
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--editor/script_create_dialog.cpp2
-rw-r--r--editor/script_editor_debugger.cpp96
-rw-r--r--editor/script_editor_debugger.h3
-rw-r--r--editor/settings_config_dialog.cpp6
-rwxr-xr-xeditor/translations/extract.py2
-rw-r--r--main/input_default.cpp8
-rw-r--r--main/main.cpp194
-rw-r--r--main/main.h9
-rw-r--r--main/tests/test_gui.cpp2
-rw-r--r--main/timer_sync.cpp2
-rw-r--r--methods.py3
-rw-r--r--modules/bullet/godot_result_callbacks.cpp8
-rw-r--r--modules/bullet/rigid_body_bullet.cpp7
-rw-r--r--modules/bullet/space_bullet.cpp44
-rw-r--r--modules/csg/csg.cpp10
-rw-r--r--modules/enet/doc_classes/NetworkedMultiplayerENet.xml2
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp12
-rw-r--r--modules/freetype/SCsub2
-rw-r--r--modules/gdnative/arvr/config.py2
-rw-r--r--modules/gdnative/gdnative.cpp2
-rw-r--r--modules/gdnative/gdnative/variant.cpp18
-rw-r--r--modules/gdnative/gdnative_api.json18
-rw-r--r--modules/gdnative/include/gdnative/variant.h44
-rw-r--r--modules/gdnative/include/nativescript/godot_nativescript.h7
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp22
-rw-r--r--modules/gdscript/gdscript.cpp19
-rw-r--r--modules/gdscript/gdscript.h3
-rw-r--r--modules/gdscript/gdscript_compiler.cpp18
-rw-r--r--modules/gdscript/gdscript_editor.cpp21
-rw-r--r--modules/gdscript/gdscript_functions.cpp2
-rw-r--r--modules/gdscript/gdscript_parser.cpp82
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp10
-rw-r--r--modules/gdscript/gdscript_tokenizer.h3
-rw-r--r--modules/gridmap/doc_classes/GridMap.xml2
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.cpp8
-rw-r--r--modules/mono/SCsub1
-rw-r--r--modules/mono/config.py26
-rw-r--r--modules/mono/csharp_script.cpp12
-rw-r--r--modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs105
-rw-r--r--modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj1
-rw-r--r--modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs14
-rw-r--r--modules/mono/editor/GodotSharpTools/Utils/OS.cs62
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp27
-rw-r--r--modules/mono/editor/godotsharp_builds.h5
-rw-r--r--modules/mono/editor/godotsharp_editor.cpp125
-rw-r--r--modules/mono/editor/godotsharp_editor.h19
-rw-r--r--modules/mono/editor/monodevelop_instance.cpp11
-rw-r--r--modules/mono/editor/monodevelop_instance.h7
-rw-r--r--modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs5
-rw-r--r--modules/mono/glue/Managed/Files/Basis.cs32
-rw-r--r--modules/mono/glue/Managed/Files/Transform.cs19
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h3
-rw-r--r--modules/mono/utils/osx_utils.cpp62
-rw-r--r--modules/mono/utils/osx_utils.h41
-rw-r--r--modules/opensimplex/SCsub4
-rw-r--r--modules/opensimplex/config.py14
-rw-r--r--modules/opensimplex/doc_classes/NoiseTexture.xml50
-rw-r--r--modules/opensimplex/doc_classes/SimplexNoise.xml131
-rw-r--r--modules/opensimplex/noise_texture.cpp244
-rw-r--r--modules/opensimplex/noise_texture.h104
-rw-r--r--modules/opensimplex/register_types.cpp (renamed from editor/editor_initialize_ssl.cpp)24
-rw-r--r--modules/opensimplex/register_types.h (renamed from editor/editor_initialize_ssl.h)10
-rw-r--r--modules/opensimplex/simplex_noise.cpp257
-rw-r--r--modules/opensimplex/simplex_noise.h93
-rw-r--r--modules/opus/audio_stream_opus.cpp4
-rw-r--r--modules/upnp/doc_classes/UPNP.xml2
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp7
-rw-r--r--modules/visual_script/visual_script_editor.cpp10
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp9
-rw-r--r--modules/websocket/doc_classes/WebSocketClient.xml2
-rw-r--r--platform/android/os_android.h2
-rw-r--r--platform/javascript/os_javascript.cpp54
-rw-r--r--platform/javascript/os_javascript.h1
-rw-r--r--platform/osx/os_osx.mm10
-rw-r--r--platform/uwp/os_uwp.cpp2
-rw-r--r--platform/uwp/os_uwp.h2
-rw-r--r--platform/windows/SCsub1
-rw-r--r--platform/windows/detect.py4
-rw-r--r--platform/windows/godot.natvis129
-rw-r--r--platform/windows/os_windows.cpp11
-rw-r--r--platform/windows/os_windows.h2
-rw-r--r--platform/x11/os_x11.cpp20
-rw-r--r--scene/2d/animated_sprite.cpp69
-rw-r--r--scene/2d/animated_sprite.h6
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/3d/light.cpp7
-rw-r--r--scene/3d/sprite_3d.cpp20
-rw-r--r--scene/3d/vehicle_body.cpp2
-rw-r--r--scene/animation/animation_node_state_machine.cpp2
-rw-r--r--scene/animation/animation_player.cpp2
-rw-r--r--scene/animation/animation_tree.cpp8
-rw-r--r--scene/animation/root_motion_view.cpp2
-rw-r--r--scene/animation/tween_interpolaters.cpp6
-rw-r--r--scene/gui/control.cpp2
-rw-r--r--scene/gui/control.h2
-rw-r--r--scene/gui/graph_edit.cpp2
-rw-r--r--scene/gui/label.cpp9
-rw-r--r--scene/gui/rich_text_label.cpp5
-rw-r--r--scene/gui/scroll_bar.cpp152
-rw-r--r--scene/gui/scroll_bar.h27
-rw-r--r--scene/gui/text_edit.cpp2
-rw-r--r--scene/gui/tree.cpp6
-rw-r--r--scene/main/http_request.cpp17
-rw-r--r--scene/main/node.cpp12
-rw-r--r--scene/main/viewport.cpp2
-rw-r--r--scene/resources/animation.cpp2
-rw-r--r--scene/resources/font.cpp1
-rw-r--r--scene/resources/material.cpp27
-rw-r--r--scene/resources/material.h2
-rw-r--r--scene/resources/scene_format_text.cpp10
-rw-r--r--scene/resources/shader.cpp11
-rw-r--r--scene/resources/shader.h2
-rw-r--r--scene/resources/texture.cpp11
-rw-r--r--scene/resources/texture.h3
-rw-r--r--scene/resources/visual_shader.cpp4
-rw-r--r--scene/resources/visual_shader.h2
-rw-r--r--servers/arvr_server.h2
-rw-r--r--servers/audio/audio_stream.cpp2
-rw-r--r--servers/physics/space_sw.cpp2
-rw-r--r--servers/physics_2d/space_2d_sw.cpp2
-rw-r--r--servers/visual/rasterizer.h1
-rw-r--r--servers/visual/shader_language.cpp87
-rw-r--r--servers/visual/shader_language.h1
-rw-r--r--servers/visual/visual_server_raster.h1
-rw-r--r--servers/visual/visual_server_viewport.cpp2
-rw-r--r--servers/visual/visual_server_wrap_mt.h1
-rw-r--r--servers/visual_server.cpp1
-rw-r--r--servers/visual_server.h1
-rw-r--r--thirdparty/README.md9
-rw-r--r--thirdparty/libwebsockets/plat/lws-plat-win.c20
-rw-r--r--thirdparty/libwebsockets/uwp_fixes.diff47
-rw-r--r--thirdparty/miniupnpc/minissdpc.c121
-rw-r--r--thirdparty/misc/open-simplex-noise-LICENSE25
-rw-r--r--thirdparty/misc/open-simplex-noise-no-allocate.patch133
-rw-r--r--thirdparty/misc/open-simplex-noise.c2254
-rw-r--r--thirdparty/misc/open-simplex-noise.h58
-rw-r--r--thirdparty/zstd/1314.diff13
-rw-r--r--thirdparty/zstd/common/cpu.h2
292 files changed, 7619 insertions, 3630 deletions
diff --git a/.gitattributes b/.gitattributes
index 03c6f96f80..47ba2b45bb 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -9,3 +9,4 @@ drivers/* linguist-vendored
*.py eol=lf
*.hpp eol=lf
*.xml eol=lf
+*.natvis eol=lf
diff --git a/.gitignore b/.gitignore
index 6db75f2324..52937b8679 100644
--- a/.gitignore
+++ b/.gitignore
@@ -91,6 +91,9 @@ bld/
*.debug
*.dSYM
+# Visual Studio cache/options directory
+.vs/
+
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
@@ -98,9 +101,6 @@ bld/
# Hints for improving IntelliSense, created together with VS project
cpp.hint
-# Visualizers for the VS debugger
-*.natvis
-
#NUNIT
*.VisualState.xml
TestResult.xml
diff --git a/.travis.yml b/.travis.yml
index ea182027ad..7161a3e029 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,7 +29,7 @@ matrix:
- clang-format-6.0
- libstdc++6 # >= 4.9 needed for clang-format-6.0
- - env: GODOT_TARGET=x11 TOOLS=yes CACHE_NAME=${GODOT_TARGET}-tools-mono-gcc EXTRA_ARGS="module_mono_enabled=yes mono_glue=no"
+ - env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc EXTRA_ARGS="module_mono_enabled=yes mono_glue=no"
os: linux
compiler: gcc
addons:
@@ -49,7 +49,7 @@ matrix:
build_command: "scons p=x11 -j2 $OPTIONS"
branch_pattern: coverity_scan
- - env: GODOT_TARGET=x11 TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
+ - env: PLATFORM=x11 TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang
os: linux
compiler: clang
addons:
@@ -57,19 +57,19 @@ matrix:
packages:
- *linux_deps
- - env: GODOT_TARGET=android TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
+ - env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang
os: linux
compiler: clang
- - env: GODOT_TARGET=osx TOOLS=yes CACHE_NAME=${GODOT_TARGET}-tools-clang
+ - env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang
os: osx
compiler: clang
- - env: GODOT_TARGET=iphone TOOLS=no CACHE_NAME=${GODOT_TARGET}-clang
+ - env: PLATFORM=iphone TOOLS=no TARGET=debug CACHE_NAME=${PLATFORM}-clang
os: osx
compiler: clang
- - env: GODOT_TARGET=server TOOLS=yes CACHE_NAME=${GODOT_TARGET}-tools-gcc
+ - env: PLATFORM=server TOOLS=yes TARGET=release_debug CACHE_NAME=${PLATFORM}-tools-gcc
os: linux
compiler: gcc
addons:
@@ -83,18 +83,18 @@ before_install:
fi
install:
- - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GODOT_TARGET" = "android" ]; then
+ - if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$PLATFORM" = "android" ]; then
misc/travis/android-tools-linux.sh;
fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
misc/travis/scons-local-osx.sh;
fi
- - if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$GODOT_TARGET" = "android" ]; then
+ - if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$PLATFORM" = "android" ]; then
misc/travis/android-tools-osx.sh;
fi
before_script:
- - if [ "$GODOT_TARGET" = "android" ]; then
+ - if [ "$PLATFORM" = "android" ]; then
export ANDROID_HOME=$TRAVIS_BUILD_DIR/godot-dev/build-tools/android-sdk;
export ANDROID_NDK_ROOT=$TRAVIS_BUILD_DIR/godot-dev/build-tools/android-ndk;
fi
@@ -103,5 +103,5 @@ script:
- if [ "$STATIC_CHECKS" = "yes" ]; then
sh ./misc/travis/clang-format.sh;
else
- scons -j2 CC=$CC CXX=$CXX platform=$GODOT_TARGET TOOLS=$TOOLS $EXTRA_ARGS $OPTIONS;
+ scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $EXTRA_ARGS $OPTIONS;
fi
diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt
index 49c602eb84..cf08225a40 100644
--- a/COPYRIGHT.txt
+++ b/COPYRIGHT.txt
@@ -96,6 +96,11 @@ Copyright: 1997-2017, Sam Lantinga
2014-2018, Godot Engine contributors.
License: Expat and Zlib
+Files: ./scene/animation/tween_interpolaters.cpp
+Comment: Penner Easing
+Copyright: 2001, Robert Penner
+License: BSD-3-clause
+
Files: ./servers/physics/gjk_epa.cpp
./servers/physics/joints/generic_6dof_joint_sw.cpp
./servers/physics/joints/generic_6dof_joint_sw.h
diff --git a/SConstruct b/SConstruct
index 3f3976555d..1c55e0be93 100644
--- a/SConstruct
+++ b/SConstruct
@@ -169,9 +169,11 @@ opts.Add(BoolVariable('progress', "Show a progress indicator during compilation"
opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
opts.Add(EnumVariable('macports_clang', "Build using Clang from MacPorts", 'no', ('no', '5.0', 'devel')))
opts.Add(BoolVariable('no_editor_splash', "Don't use the custom splash screen for the editor", False))
+opts.Add('system_certs_path', "Use this path as SSL certificates default for editor (for package maintainers)", '')
# Thirdparty libraries
opts.Add(BoolVariable('builtin_bullet', "Use the built-in Bullet library", True))
+opts.Add(BoolVariable('builtin_certs', "Bundle default SSL certificates to be used if you don't specify an override in the project settings", True))
opts.Add(BoolVariable('builtin_enet', "Use the built-in ENet library", True))
opts.Add(BoolVariable('builtin_freetype', "Use the built-in FreeType library", True))
opts.Add(BoolVariable('builtin_libogg', "Use the built-in libogg library", True))
diff --git a/core/SCsub b/core/SCsub
index a6365bf925..6746cc871a 100644
--- a/core/SCsub
+++ b/core/SCsub
@@ -93,6 +93,9 @@ if 'builtin_zstd' in env and env['builtin_zstd']:
# Godot's own sources
env.add_source_files(env.core_sources, "*.cpp")
+# Certificates
+env.Depends("#core/io/certs_compressed.gen.h", ["#thirdparty/certs/ca-certificates.crt", env.Value(env['builtin_certs']), env.Value(env['system_certs_path'])])
+env.CommandNoCache("#core/io/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", run_in_subprocess(core_builders.make_certs_header))
# Make binders
env.CommandNoCache(['method_bind.gen.inc', 'method_bind_ext.gen.inc'], 'make_binders.py', run_in_subprocess(make_binders.run))
diff --git a/core/core_builders.py b/core/core_builders.py
index 90e505aab9..f3a9e3b221 100644
--- a/core/core_builders.py
+++ b/core/core_builders.py
@@ -4,7 +4,40 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki
"""
from platform_methods import subprocess_main
-from compat import iteritems, itervalues, open_utf8, escape_string
+from compat import iteritems, itervalues, open_utf8, escape_string, byte_to_str
+
+
+def make_certs_header(target, source, env):
+
+ src = source[0]
+ dst = target[0]
+ f = open(src, "rb")
+ g = open_utf8(dst, "w")
+ buf = f.read()
+ decomp_size = len(buf)
+ import zlib
+ 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")
+
+ # System certs path. Editor will use them if defined. (for package maintainers)
+ path = env['system_certs_path']
+ g.write("#define _SYSTEM_CERTS_PATH \"%s\"\n" % str(path))
+ if env['builtin_certs']:
+ # Defined here and not in env so changing it does not trigger a full rebuild.
+ g.write("#define BUILTIN_CERTS_ENABLED\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("\t" + byte_to_str(buf[i]) + ",\n")
+ g.write("};\n")
+ g.write("#endif")
+
+ g.close()
+ f.close()
def make_authors_header(target, source, env):
diff --git a/core/input_map.cpp b/core/input_map.cpp
index 51e3f311a9..b88d99470a 100644
--- a/core/input_map.cpp
+++ b/core/input_map.cpp
@@ -199,6 +199,10 @@ bool InputMap::event_get_action_status(const Ref<InputEvent> &p_event, const Str
Ref<InputEventAction> input_event_action = p_event;
if (input_event_action.is_valid()) {
+ if (p_pressed != NULL)
+ *p_pressed = input_event_action->is_pressed();
+ if (p_strength != NULL)
+ *p_strength = (*p_pressed) ? 1.0f : 0.0f;
return input_event_action->get_action() == p_action;
}
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index 6290913503..645d97ae7e 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -293,7 +293,6 @@ uint8_t FileAccessCompressed::get_8() const {
} else {
read_block--;
at_end = true;
- ret = 0;
}
}
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index c47ae05dc2..80a281a21d 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -275,7 +275,7 @@ void HTTPClient::close() {
response_headers.clear();
response_str.clear();
- body_size = 0;
+ body_size = -1;
body_left = 0;
chunk_left = 0;
read_until_eof = false;
@@ -349,7 +349,7 @@ Error HTTPClient::poll() {
}
if (ssl->get_status() == StreamPeerSSL::STATUS_CONNECTED) {
- // Handshake has been successfull
+ // Handshake has been successful
handshaking = false;
status = STATUS_CONNECTED;
return OK;
@@ -404,7 +404,7 @@ Error HTTPClient::poll() {
String response;
response.parse_utf8((const char *)response_str.ptr());
Vector<String> responses = response.split("\n");
- body_size = 0;
+ body_size = -1;
chunked = false;
body_left = 0;
chunk_left = 0;
@@ -448,7 +448,7 @@ Error HTTPClient::poll() {
}
}
- if (body_size || chunked) {
+ if (body_size != -1 || chunked) {
status = STATUS_BODY;
} else if (!keep_alive) {
@@ -665,11 +665,24 @@ Error HTTPClient::_get_http_data(uint8_t *p_buffer, int p_bytes, int &r_received
if (blocking) {
- Error err = connection->get_data(p_buffer, p_bytes);
- if (err == OK)
- r_received = p_bytes;
- else
- r_received = 0;
+ // We can't use StreamPeer.get_data, since when reaching EOF we will get an
+ // error without knowing how many bytes we received.
+ Error err = ERR_FILE_EOF;
+ int read = 0;
+ int left = p_bytes;
+ r_received = 0;
+ while (left > 0) {
+ err = connection->get_partial_data(p_buffer + r_received, left, read);
+ if (err == OK) {
+ r_received += read;
+ } else if (err == ERR_FILE_EOF) {
+ r_received += read;
+ return err;
+ } else {
+ return err;
+ }
+ left -= read;
+ }
return err;
} else {
return connection->get_partial_data(p_buffer, p_bytes, r_received);
@@ -687,7 +700,7 @@ HTTPClient::HTTPClient() {
resolving = IP::RESOLVER_INVALID_ID;
status = STATUS_DISCONNECTED;
conn_port = -1;
- body_size = 0;
+ body_size = -1;
chunked = false;
body_left = 0;
read_until_eof = false;
diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp
index 1179b1bfd6..5503b8d59c 100644
--- a/core/io/multiplayer_api.cpp
+++ b/core/io/multiplayer_api.cpp
@@ -45,8 +45,7 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
} break;
case MultiplayerAPI::RPC_MODE_REMOTESYNC:
case MultiplayerAPI::RPC_MODE_MASTERSYNC:
- case MultiplayerAPI::RPC_MODE_SLAVESYNC:
- case MultiplayerAPI::RPC_MODE_SYNC: {
+ case MultiplayerAPI::RPC_MODE_PUPPETSYNC: {
//call it, sync always results in call
return true;
} break;
@@ -55,7 +54,7 @@ _FORCE_INLINE_ bool _should_call_local(MultiplayerAPI::RPCMode mode, bool is_mas
r_skip_rpc = true; //no other master so..
return is_master;
} break;
- case MultiplayerAPI::RPC_MODE_SLAVE: {
+ case MultiplayerAPI::RPC_MODE_PUPPET: {
return !is_master;
} break;
}
@@ -68,19 +67,16 @@ _FORCE_INLINE_ bool _can_call_mode(Node *p_node, MultiplayerAPI::RPCMode mode, i
case MultiplayerAPI::RPC_MODE_DISABLED: {
return false;
} break;
- case MultiplayerAPI::RPC_MODE_REMOTE: {
- return true;
- } break;
- case MultiplayerAPI::RPC_MODE_REMOTESYNC:
- case MultiplayerAPI::RPC_MODE_SYNC: {
+ case MultiplayerAPI::RPC_MODE_REMOTE:
+ case MultiplayerAPI::RPC_MODE_REMOTESYNC: {
return true;
} break;
case MultiplayerAPI::RPC_MODE_MASTERSYNC:
case MultiplayerAPI::RPC_MODE_MASTER: {
return p_node->is_network_master();
} break;
- case MultiplayerAPI::RPC_MODE_SLAVESYNC:
- case MultiplayerAPI::RPC_MODE_SLAVE: {
+ case MultiplayerAPI::RPC_MODE_PUPPETSYNC:
+ case MultiplayerAPI::RPC_MODE_PUPPET: {
return !p_node->is_network_master() && p_remote_id == p_node->get_network_master();
} break;
}
@@ -804,12 +800,13 @@ void MultiplayerAPI::_bind_methods() {
BIND_ENUM_CONSTANT(RPC_MODE_DISABLED);
BIND_ENUM_CONSTANT(RPC_MODE_REMOTE);
- BIND_ENUM_CONSTANT(RPC_MODE_SYNC);
BIND_ENUM_CONSTANT(RPC_MODE_MASTER);
- BIND_ENUM_CONSTANT(RPC_MODE_SLAVE);
+ BIND_ENUM_CONSTANT(RPC_MODE_PUPPET);
+ BIND_ENUM_CONSTANT(RPC_MODE_SLAVE); // deprecated
BIND_ENUM_CONSTANT(RPC_MODE_REMOTESYNC);
+ BIND_ENUM_CONSTANT(RPC_MODE_SYNC); // deprecated
BIND_ENUM_CONSTANT(RPC_MODE_MASTERSYNC);
- BIND_ENUM_CONSTANT(RPC_MODE_SLAVESYNC);
+ BIND_ENUM_CONSTANT(RPC_MODE_PUPPETSYNC);
}
MultiplayerAPI::MultiplayerAPI() {
diff --git a/core/io/multiplayer_api.h b/core/io/multiplayer_api.h
index e47b1830e8..c86e76e91a 100644
--- a/core/io/multiplayer_api.h
+++ b/core/io/multiplayer_api.h
@@ -91,12 +91,13 @@ public:
RPC_MODE_DISABLED, // No rpc for this method, calls to this will be blocked (default)
RPC_MODE_REMOTE, // Using rpc() on it will call method / set property in all remote peers
- RPC_MODE_SYNC, // Using rpc() on it will call method / set property in all remote peers and locally
RPC_MODE_MASTER, // Using rpc() on it will call method on wherever the master is, be it local or remote
- RPC_MODE_SLAVE, // Using rpc() on it will call method for all slaves
- RPC_MODE_REMOTESYNC, // Same as RPC_MODE_SYNC, compatibility
+ RPC_MODE_PUPPET, // Using rpc() on it will call method for all puppets
+ RPC_MODE_SLAVE = RPC_MODE_PUPPET, // Deprecated, same as puppet
+ RPC_MODE_REMOTESYNC, // Using rpc() on it will call method / set property in all remote peers and locally
+ RPC_MODE_SYNC = RPC_MODE_REMOTESYNC, // Deprecated. Same as RPC_MODE_REMOTESYNC
RPC_MODE_MASTERSYNC, // Using rpc() on it will call method / set property in the master peer and locally
- RPC_MODE_SLAVESYNC, // Using rpc() on it will call method / set property in all slave peers and locally
+ RPC_MODE_PUPPETSYNC, // Using rpc() on it will call method / set property in all puppets peers and locally
};
void poll();
diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp
index 1f59021938..8d8682686a 100644
--- a/core/io/stream_peer_ssl.cpp
+++ b/core/io/stream_peer_ssl.cpp
@@ -30,6 +30,8 @@
#include "stream_peer_ssl.h"
+#include "core/io/certs_compressed.gen.h"
+#include "core/io/compression.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
@@ -42,13 +44,20 @@ StreamPeerSSL *StreamPeerSSL::create() {
StreamPeerSSL::LoadCertsFromMemory StreamPeerSSL::load_certs_func = NULL;
bool StreamPeerSSL::available = false;
-bool StreamPeerSSL::initialize_certs = true;
void StreamPeerSSL::load_certs_from_memory(const PoolByteArray &p_memory) {
if (load_certs_func)
load_certs_func(p_memory);
}
+void StreamPeerSSL::load_certs_from_file(String p_path) {
+ if (p_path != "") {
+ PoolByteArray certs = get_cert_file_as_array(p_path);
+ if (certs.size() > 0)
+ load_certs_func(certs);
+ }
+}
+
bool StreamPeerSSL::is_available() {
return available;
}
@@ -61,6 +70,25 @@ bool StreamPeerSSL::is_blocking_handshake_enabled() const {
return blocking_handshake;
}
+PoolByteArray StreamPeerSSL::get_cert_file_as_array(String p_path) {
+
+ PoolByteArray out;
+ FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
+ if (f) {
+ int flen = f->get_len();
+ out.resize(flen + 1);
+ PoolByteArray::Write w = out.write();
+ f->get_buffer(w.ptr(), flen);
+ w[flen] = 0; // Make sure it ends with string terminator
+ memdelete(f);
+#ifdef DEBUG_ENABLED
+ print_verbose(vformat("Loaded certs from '%s'.", p_path));
+#endif
+ }
+
+ return out;
+}
+
PoolByteArray StreamPeerSSL::get_project_cert_array() {
PoolByteArray out;
@@ -68,24 +96,21 @@ PoolByteArray StreamPeerSSL::get_project_cert_array() {
ProjectSettings::get_singleton()->set_custom_property_info("network/ssl/certificates", PropertyInfo(Variant::STRING, "network/ssl/certificates", PROPERTY_HINT_FILE, "*.crt"));
if (certs_path != "") {
-
- FileAccess *f = FileAccess::open(certs_path, FileAccess::READ);
- if (f) {
- int flen = f->get_len();
- out.resize(flen + 1);
- {
- PoolByteArray::Write w = out.write();
- f->get_buffer(w.ptr(), flen);
- w[flen] = 0; //end f string
- }
-
- memdelete(f);
-
+ // Use certs defined in project settings.
+ return get_cert_file_as_array(certs_path);
+ }
+#ifdef BUILTIN_CERTS_ENABLED
+ else {
+ // Use builtin certs only if user did not override it in project settings.
+ out.resize(_certs_uncompressed_size + 1);
+ PoolByteArray::Write w = out.write();
+ Compression::decompress(w.ptr(), _certs_uncompressed_size, _certs_compressed, _certs_compressed_size, Compression::MODE_DEFLATE);
+ w[_certs_uncompressed_size] = 0; // Make sure it ends with string terminator
#ifdef DEBUG_ENABLED
- print_verbose(vformat("Loaded certs from '%s'.", certs_path));
+ print_verbose("Loaded builtin certs");
#endif
- }
}
+#endif
return out;
}
diff --git a/core/io/stream_peer_ssl.h b/core/io/stream_peer_ssl.h
index f66c1c7de9..8ce36d7e7d 100644
--- a/core/io/stream_peer_ssl.h
+++ b/core/io/stream_peer_ssl.h
@@ -46,9 +46,6 @@ protected:
static LoadCertsFromMemory load_certs_func;
static bool available;
- friend class Main;
- static bool initialize_certs;
-
bool blocking_handshake;
public:
@@ -72,7 +69,9 @@ public:
static StreamPeerSSL *create();
+ static PoolByteArray get_cert_file_as_array(String p_path);
static PoolByteArray get_project_cert_array();
+ static void load_certs_from_file(String p_path);
static void load_certs_from_memory(const PoolByteArray &p_memory);
static bool is_available();
diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp
index 484e160f0e..f4bf8a13ae 100644
--- a/core/io/stream_peer_tcp.cpp
+++ b/core/io/stream_peer_tcp.cpp
@@ -44,6 +44,7 @@ Error StreamPeerTCP::_poll_connection() {
return OK;
}
+ disconnect_from_host();
status = STATUS_ERROR;
return ERR_CONNECTION_ERROR;
}
@@ -75,17 +76,16 @@ Error StreamPeerTCP::connect_to_host(const IP_Address &p_host, uint16_t p_port)
err = _sock->connect_to_host(p_host, p_port);
- if (err != OK) {
- if (err == ERR_BUSY) {
- status = STATUS_CONNECTING;
- } else {
- ERR_PRINT("Connection to remote host failed!");
- disconnect_from_host();
- return FAILED;
- }
+ if (err == OK) {
+ status = STATUS_CONNECTED;
+ } else if (err == ERR_BUSY) {
+ status = STATUS_CONNECTING;
+ } else {
+ ERR_PRINT("Connection to remote host failed!");
+ disconnect_from_host();
+ return FAILED;
}
- status = STATUS_CONNECTED;
peer_host = p_host;
peer_port = p_port;
@@ -163,20 +163,20 @@ Error StreamPeerTCP::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool
if (!is_connected_to_host()) {
return FAILED;
- };
+ }
if (status == STATUS_CONNECTING) {
if (_poll_connection() != OK) {
return FAILED;
- };
+ }
if (status != STATUS_CONNECTED) {
r_received = 0;
return OK;
- };
- };
+ }
+ }
Error err;
int to_read = p_bytes;
@@ -209,10 +209,7 @@ Error StreamPeerTCP::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool
} else if (read == 0) {
- _sock->close();
- status = STATUS_NONE;
- peer_port = 0;
- peer_host = IP_Address();
+ disconnect_from_host();
r_received = total_read;
return ERR_FILE_EOF;
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp
index 5c8512d8bd..0c06d2a2b5 100644
--- a/core/math/math_funcs.cpp
+++ b/core/math/math_funcs.cpp
@@ -57,7 +57,7 @@ uint32_t Math::rand() {
}
int Math::step_decimals(double p_step) {
- static const int maxn = 9;
+ static const int maxn = 10;
static const double sd[maxn] = {
0.9999, // somehow compensate for floating point error
0.09999,
@@ -67,17 +67,19 @@ int Math::step_decimals(double p_step) {
0.000009999,
0.0000009999,
0.00000009999,
- 0.000000009999
+ 0.000000009999,
+ 0.0000000009999
};
- double as = Math::abs(p_step);
+ double abs = Math::abs(p_step);
+ double decs = abs - (int)abs; // Strip away integer part
for (int i = 0; i < maxn; i++) {
- if (as >= sd[i]) {
+ if (decs >= sd[i]) {
return i;
}
}
- return maxn;
+ return 0;
}
double Math::dectime(double p_value, double p_amount, double p_step) {
diff --git a/core/math/octree.h b/core/math/octree.h
index b57fb84e8f..cd89743a5a 100644
--- a/core/math/octree.h
+++ b/core/math/octree.h
@@ -478,7 +478,7 @@ void Octree<T, use_pairs, AL>::_insert_element(Element *p_element, Octant *p_oct
splits++;
}
} else {
- /* check againt AABB where child should be */
+ /* check against AABB where child should be */
AABB aabb = p_octant->aabb;
aabb.size *= 0.5;
diff --git a/core/math/triangulate.cpp b/core/math/triangulate.cpp
index 0edc0ea039..69ffc95946 100644
--- a/core/math/triangulate.cpp
+++ b/core/math/triangulate.cpp
@@ -186,7 +186,7 @@ bool Triangulate::triangulate(const Vector<Vector2> &contour, Vector<int> &resul
nv--;
- /* resest error detection counter */
+ /* reset error detection counter */
count = 2 * nv;
}
}
diff --git a/core/os/dir_access.h b/core/os/dir_access.h
index 6b391a87fa..773f0bcd41 100644
--- a/core/os/dir_access.h
+++ b/core/os/dir_access.h
@@ -38,7 +38,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-//@ TOOD, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies
+//@ TODO, excellent candidate for THREAD_SAFE MACRO, should go through all these and add THREAD_SAFE where it applies
class DirAccess {
public:
enum AccessType {
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index cc359ef2ac..5bbdd7efb2 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -962,6 +962,22 @@ bool InputEventAction::is_action(const StringName &p_action) const {
return action == p_action;
}
+bool InputEventAction::action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const {
+
+ Ref<InputEventAction> act = p_event;
+ if (act.is_null())
+ return false;
+
+ bool match = action == act->action;
+ if (match) {
+ if (p_pressed != NULL)
+ *p_pressed = act->pressed;
+ if (p_strength != NULL)
+ *p_strength = (*p_pressed) ? 1.0f : 0.0f;
+ }
+ return match;
+}
+
String InputEventAction::as_text() const {
return "InputEventAction : action=" + action + ", pressed=(" + (pressed ? "true" : "false");
diff --git a/core/os/input_event.h b/core/os/input_event.h
index cb61e61e7c..789d19c5b2 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -481,6 +481,8 @@ public:
virtual bool is_action(const StringName &p_action) const;
+ virtual bool action_match(const Ref<InputEvent> &p_event, bool *p_pressed, float *p_strength, float p_deadzone) const;
+
virtual bool shortcut_match(const Ref<InputEvent> &p_event) const;
virtual bool is_action_type() const { return true; }
virtual String as_text() const;
diff --git a/core/os/os.h b/core/os/os.h
index 8fb5b45f67..7786ffb26e 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -129,7 +129,7 @@ protected:
RenderThreadMode _render_thread_mode;
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
void add_logger(Logger *p_logger);
virtual void initialize_core() = 0;
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 04e09fb12e..99a23bbee1 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -60,7 +60,7 @@ String ProjectSettings::get_resource_path() const {
String ProjectSettings::localize_path(const String &p_path) const {
if (resource_path == "")
- return p_path; //not initialied yet
+ return p_path; //not initialized yet
if (p_path.begins_with("res://") || p_path.begins_with("user://") ||
(p_path.is_abs_path() && !p_path.begins_with(resource_path)))
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 0519807e63..fe1dc2cdd1 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -77,18 +77,19 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por
for (int i = 0; i < tries; i++) {
if (tcp_client->get_status() == StreamPeerTCP::STATUS_CONNECTED) {
+ print_verbose("Remote Debugger: Connected!");
break;
} else {
const int ms = waits[i];
OS::get_singleton()->delay_usec(ms * 1000);
- ERR_PRINTS("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
+ print_verbose("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec.");
};
};
if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
- ERR_PRINTS("Remote Debugger: Unable to connect.");
+ ERR_PRINTS("Remote Debugger: Unable to connect. Status: " + String::num(tcp_client->get_status()));
return FAILED;
};
@@ -661,11 +662,14 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
prop.push_back(Variant());
} else {
prop.push_back(pi.hint);
- if (res.is_null() || res->get_path().empty())
- prop.push_back(pi.hint_string);
- else
- prop.push_back(String("RES:") + res->get_path());
+ prop.push_back(pi.hint_string);
prop.push_back(pi.usage);
+ if (!res.is_null()) {
+ var = String("PATH") + res->get_path();
+ } else if (var.get_type() == Variant::STRING) {
+ var = String("DATA") + var;
+ }
+
prop.push_back(var);
}
send_props.push_back(prop);
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index 2edf33ec1c..9afc31a772 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -1656,13 +1656,13 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const {
} else if (p_index == CoreStringNames::singleton->a) {
return v->a;
} else if (p_index == CoreStringNames::singleton->r8) {
- return int(v->r * 255.0);
+ return int(Math::round(v->r * 255.0));
} else if (p_index == CoreStringNames::singleton->g8) {
- return int(v->g * 255.0);
+ return int(Math::round(v->g * 255.0));
} else if (p_index == CoreStringNames::singleton->b8) {
- return int(v->b * 255.0);
+ return int(Math::round(v->b * 255.0));
} else if (p_index == CoreStringNames::singleton->a8) {
- return int(v->a * 255.0);
+ return int(Math::round(v->a * 255.0));
} else if (p_index == CoreStringNames::singleton->h) {
return v->get_h();
} else if (p_index == CoreStringNames::singleton->s) {
diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp
index 2c45c6b3ed..3d5ae74e92 100644
--- a/core/variant_parser.cpp
+++ b/core/variant_parser.cpp
@@ -1429,10 +1429,10 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
break;
if (parsing_tag && token.type == TK_PERIOD) {
- r_tag.name += "."; //support tags such as [someprop.Anroid] for specific platforms
+ r_tag.name += "."; //support tags such as [someprop.Android] for specific platforms
get_token(p_stream, token, line, r_err_str);
} else if (parsing_tag && token.type == TK_COLON) {
- r_tag.name += ":"; //support tags such as [someprop.Anroid] for specific platforms
+ r_tag.name += ":"; //support tags such as [someprop.Android] for specific platforms
get_token(p_stream, token, line, r_err_str);
} else {
parsing_tag = false;
diff --git a/doc/classes/AnimatedTexture.xml b/doc/classes/AnimatedTexture.xml
index f874c43ef1..9dc58ed195 100644
--- a/doc/classes/AnimatedTexture.xml
+++ b/doc/classes/AnimatedTexture.xml
@@ -9,1034 +9,46 @@
<demos>
</demos>
<methods>
+ <method name="get_frame_delay" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="frame" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="get_frame_texture" qualifiers="const">
+ <return type="Texture">
+ </return>
+ <argument index="0" name="frame" type="int">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_frame_delay">
+ <return type="void">
+ </return>
+ <argument index="0" name="frame" type="int">
+ </argument>
+ <argument index="1" name="delay" type="float">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="set_frame_texture">
+ <return type="void">
+ </return>
+ <argument index="0" name="frame" type="int">
+ </argument>
+ <argument index="1" name="texture" type="Texture">
+ </argument>
+ <description>
+ </description>
+ </method>
</methods>
<members>
<member name="fps" type="float" setter="set_fps" getter="get_fps">
</member>
- <member name="frame_0/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_0/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_1/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_1/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_10/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_10/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_100/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_100/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_101/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_101/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_102/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_102/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_103/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_103/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_104/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_104/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_105/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_105/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_106/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_106/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_107/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_107/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_108/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_108/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_109/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_109/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_11/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_11/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_110/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_110/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_111/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_111/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_112/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_112/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_113/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_113/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_114/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_114/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_115/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_115/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_116/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_116/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_117/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_117/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_118/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_118/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_119/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_119/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_12/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_12/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_120/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_120/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_121/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_121/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_122/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_122/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_123/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_123/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_124/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_124/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_125/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_125/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_126/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_126/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_127/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_127/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_128/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_128/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_129/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_129/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_13/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_13/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_130/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_130/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_131/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_131/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_132/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_132/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_133/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_133/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_134/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_134/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_135/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_135/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_136/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_136/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_137/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_137/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_138/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_138/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_139/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_139/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_14/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_14/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_140/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_140/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_141/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_141/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_142/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_142/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_143/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_143/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_144/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_144/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_145/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_145/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_146/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_146/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_147/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_147/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_148/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_148/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_149/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_149/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_15/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_15/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_150/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_150/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_151/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_151/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_152/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_152/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_153/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_153/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_154/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_154/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_155/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_155/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_156/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_156/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_157/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_157/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_158/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_158/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_159/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_159/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_16/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_16/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_160/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_160/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_161/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_161/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_162/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_162/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_163/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_163/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_164/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_164/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_165/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_165/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_166/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_166/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_167/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_167/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_168/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_168/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_169/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_169/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_17/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_17/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_170/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_170/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_171/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_171/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_172/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_172/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_173/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_173/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_174/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_174/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_175/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_175/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_176/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_176/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_177/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_177/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_178/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_178/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_179/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_179/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_18/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_18/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_180/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_180/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_181/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_181/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_182/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_182/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_183/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_183/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_184/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_184/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_185/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_185/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_186/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_186/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_187/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_187/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_188/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_188/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_189/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_189/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_19/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_19/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_190/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_190/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_191/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_191/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_192/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_192/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_193/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_193/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_194/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_194/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_195/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_195/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_196/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_196/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_197/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_197/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_198/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_198/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_199/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_199/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_2/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_2/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_20/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_20/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_200/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_200/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_201/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_201/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_202/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_202/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_203/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_203/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_204/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_204/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_205/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_205/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_206/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_206/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_207/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_207/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_208/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_208/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_209/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_209/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_21/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_21/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_210/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_210/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_211/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_211/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_212/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_212/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_213/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_213/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_214/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_214/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_215/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_215/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_216/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_216/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_217/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_217/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_218/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_218/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_219/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_219/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_22/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_22/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_220/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_220/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_221/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_221/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_222/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_222/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_223/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_223/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_224/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_224/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_225/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_225/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_226/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_226/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_227/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_227/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_228/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_228/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_229/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_229/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_23/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_23/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_230/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_230/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_231/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_231/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_232/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_232/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_233/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_233/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_234/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_234/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_235/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_235/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_236/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_236/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_237/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_237/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_238/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_238/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_239/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_239/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_24/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_24/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_240/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_240/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_241/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_241/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_242/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_242/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_243/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_243/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_244/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_244/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_245/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_245/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_246/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_246/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_247/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_247/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_248/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_248/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_249/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_249/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_25/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_25/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_250/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_250/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_251/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_251/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_252/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_252/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_253/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_253/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_254/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_254/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_255/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_255/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_26/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_26/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_27/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_27/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_28/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_28/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_29/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_29/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_3/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_3/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_30/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_30/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_31/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_31/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_32/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_32/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_33/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_33/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_34/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_34/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_35/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_35/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_36/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_36/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_37/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_37/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_38/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_38/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_39/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_39/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_4/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_4/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_40/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_40/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_41/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_41/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_42/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_42/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_43/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_43/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_44/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_44/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_45/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_45/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_46/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_46/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_47/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_47/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_48/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_48/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_49/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_49/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_5/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_5/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_50/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_50/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_51/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_51/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_52/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_52/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_53/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_53/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_54/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_54/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_55/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_55/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_56/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_56/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_57/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_57/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_58/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_58/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_59/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_59/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_6/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_6/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_60/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_60/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_61/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_61/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_62/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_62/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_63/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_63/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_64/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_64/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_65/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_65/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_66/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_66/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_67/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_67/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_68/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_68/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_69/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_69/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_7/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_7/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_70/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_70/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_71/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_71/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_72/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_72/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_73/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_73/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_74/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_74/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_75/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_75/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_76/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_76/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_77/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_77/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_78/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_78/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_79/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_79/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_8/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_8/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_80/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_80/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_81/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_81/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_82/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_82/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_83/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_83/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_84/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_84/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_85/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_85/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_86/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_86/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_87/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_87/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_88/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_88/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_89/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_89/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_9/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_9/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_90/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_90/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_91/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_91/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_92/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_92/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_93/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_93/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_94/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_94/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_95/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_95/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_96/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_96/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_97/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_97/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_98/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_98/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
- <member name="frame_99/delay_sec" type="float" setter="set_frame_delay" getter="get_frame_delay">
- </member>
- <member name="frame_99/texture" type="Texture" setter="set_frame_texture" getter="get_frame_texture">
- </member>
<member name="frames" type="int" setter="set_frames" getter="get_frames">
</member>
</members>
diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml
index 98404478f4..60f097f3f9 100644
--- a/doc/classes/CanvasItem.xml
+++ b/doc/classes/CanvasItem.xml
@@ -576,7 +576,7 @@
Disable blending mode. Colors including alpha are written as is. Only applicable for render targets with a transparent background. No lighting will be applied.
</constant>
<constant name="NOTIFICATION_TRANSFORM_CHANGED" value="29">
- Canvas item transform has changed. Only received if requested.
+ Canvas item transform has changed. Notification is only received if enabled by [method set_notify_transform] or [method set_notify_local_transform].
</constant>
<constant name="NOTIFICATION_DRAW" value="30">
CanvasItem is requested to draw.
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index 4d52eacba8..554e6b5632 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -26,7 +26,7 @@
The currently selected color.
</member>
<member name="deferred_mode" type="bool" setter="set_deferred_mode" getter="is_deferred_mode">
- If [code]true[/code] the color will apply only after the user releases the mouse button, otherwise it will apply immediatly even in mouse motion event (which can cause performance issues).
+ If [code]true[/code] the color will apply only after the user releases the mouse button, otherwise it will apply immediately even in mouse motion event (which can cause performance issues).
</member>
<member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha">
If [code]true[/code] shows an alpha channel slider (transparency).
diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml
index 6ac2911c11..8bc6d05bd4 100644
--- a/doc/classes/ColorPickerButton.xml
+++ b/doc/classes/ColorPickerButton.xml
@@ -4,7 +4,7 @@
Button that pops out a [ColorPicker].
</brief_description>
<description>
- Encapsulates a [ColorPicker] making it accesible by pressing a button. Pressing the button will toggle the [ColorPicker] visibility.
+ Encapsulates a [ColorPicker] making it accessible by pressing a button. Pressing the button will toggle the [ColorPicker] visibility.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml
index ec0381bda5..a4709c1c86 100644
--- a/doc/classes/ConfigFile.xml
+++ b/doc/classes/ConfigFile.xml
@@ -18,7 +18,7 @@
var err = config.load("user://settings.cfg")
if err == OK: # if not, something went wrong with the file loading
# Look for the display/width pair, and default to 1024 if missing
- var screen_width = get_value("display", "width", 1024)
+ var screen_width = config.get_value("display", "width", 1024)
# Store a variable if and only if it hasn't been defined yet
if not config.has_section_key("audio", "mute"):
config.set_value("audio", "mute", false)
diff --git a/doc/classes/EditorFileSystemDirectory.xml b/doc/classes/EditorFileSystemDirectory.xml
index bb3ff91639..9dd28d2400 100644
--- a/doc/classes/EditorFileSystemDirectory.xml
+++ b/doc/classes/EditorFileSystemDirectory.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="EditorFileSystemDirectory" inherits="Object" category="Core" version="3.1">
<brief_description>
- A diretory for the resource filesystem.
+ A directory for the resource filesystem.
</brief_description>
<description>
A more generalized, low-level variation of the directory concept.
diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml
index 19bd7e6d52..d85d021a68 100644
--- a/doc/classes/EditorInterface.xml
+++ b/doc/classes/EditorInterface.xml
@@ -24,7 +24,7 @@
<return type="Control">
</return>
<description>
- Returns the base [Control].
+ Returns the main container of Godot's editor window. You can use it, for example, to retrieve the size of the container and place your controls accordingly.
</description>
</method>
<method name="get_edited_scene_root">
diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml
index bd85075b7e..9d48669a6b 100644
--- a/doc/classes/EditorSettings.xml
+++ b/doc/classes/EditorSettings.xml
@@ -48,11 +48,11 @@
Erase a given setting (pass full property path).
</description>
</method>
- <method name="get_favorite_dirs" qualifiers="const">
+ <method name="get_favorites" qualifiers="const">
<return type="PoolStringArray">
</return>
<description>
- Get the list of favorite directories for this project.
+ Get the list of favorite files and directories for this project.
</description>
</method>
<method name="get_project_metadata" qualifiers="const">
@@ -122,13 +122,13 @@
<description>
</description>
</method>
- <method name="set_favorite_dirs">
+ <method name="set_favorites">
<return type="void">
</return>
<argument index="0" name="dirs" type="PoolStringArray">
</argument>
<description>
- Set the list of favorite directories for this project.
+ Set the list of favorite files and directories for this project.
</description>
</method>
<method name="set_initial_value">
diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml
index a0bb585583..d9929b3d31 100644
--- a/doc/classes/Input.xml
+++ b/doc/classes/Input.xml
@@ -293,7 +293,7 @@
<argument index="2" name="hotspot" type="Vector2" default="Vector2( 0, 0 )">
</argument>
<description>
- Set a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing [code]null[/code] to the image parameter resets to the system cursor. See enum [code]CURSOR_*[/code] for the list of shapes.
+ Sets a custom mouse cursor image, which is only visible inside the game window. The hotspot can also be specified. Passing [code]null[/code] to the image parameter resets to the system cursor. See enum [code]CURSOR_*[/code] for the list of shapes.
[code]image[/code]'s size must be lower than 256x256.
[code]hotspot[/code] must be within [code]image[/code]'s size.
</description>
@@ -304,6 +304,8 @@
<argument index="0" name="shape" type="int" enum="Input.CursorShape" default="0">
</argument>
<description>
+ Sets the default cursor shape to be used in the viewport instead of [code]CURSOR_ARROW[/code].
+ Note that if you want to change the default cursor shape for [Control]'s nodes, use [member Control.mouse_default_cursor_shape] instead.
</description>
</method>
<method name="set_mouse_mode">
diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml
index 10e7f1b172..d8d7d9acfc 100644
--- a/doc/classes/MultiplayerAPI.xml
+++ b/doc/classes/MultiplayerAPI.xml
@@ -90,7 +90,7 @@
</methods>
<members>
<member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer">
- The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals.
+ The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the MultiplayerAPI will become a network server (check with [method is_network_server]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to puppet. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to MultiplayerAPI's signals.
</member>
<member name="refuse_new_network_connections" type="bool" setter="set_refuse_new_network_connections" getter="is_refusing_new_network_connections">
If [code]true[/code] the MultiplayerAPI's [member network_peer] refuses new incoming connections.
@@ -141,25 +141,28 @@
Used with [method Node.rpc_config] or [method Node.rset_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
</constant>
<constant name="RPC_MODE_REMOTE" value="1" enum="RPCMode">
- Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the [code]remote[/code] keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or slaves.
+ Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the [code]remote[/code] keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or puppets.
</constant>
- <constant name="RPC_MODE_SYNC" value="2" enum="RPCMode">
- Behave like [code]RPC_MODE_REMOTE[/code] but also make the call or property change locally. Analogous to the [code]sync[/code] keyword.
+ <constant name="RPC_MODE_MASTER" value="2" enum="RPCMode">
+ Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on the network master for this node. Analogous to the [code]master[/code] keyword. Only accepts calls or property changes from the node's network puppets, see [method Node.set_network_master].
</constant>
- <constant name="RPC_MODE_MASTER" value="3" enum="RPCMode">
- Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on the network master for this node. Analogous to the [code]master[/code] keyword. Only accepts calls or property changes from the node's network slaves, see [method Node.set_network_master].
+ <constant name="RPC_MODE_PUPPET" value="3" enum="RPCMode">
+ Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on puppets for this node. Analogous to the [code]puppet[/code] keyword. Only accepts calls or property changes from the node's network master, see [method Node.set_network_master].
</constant>
- <constant name="RPC_MODE_SLAVE" value="4" enum="RPCMode">
- Used with [method Node.rpc_config] or [method Node.rset_config] to set a method to be called or a property to be changed only on slaves for this node. Analogous to the [code]slave[/code] keyword. Only accepts calls or property changes from the node's network master, see [method Node.set_network_master].
+ <constant name="RPC_MODE_SLAVE" value="3" enum="RPCMode">
+ Deprecated. Use [code]RPC_MODE_PUPPET[/code] instead. Analogous to the [code]slave[/code] keyword.
</constant>
- <constant name="RPC_MODE_REMOTESYNC" value="5" enum="RPCMode">
- Behave like [code]RPC_MODE_REMOTE[/code] but also make the call or property change locally. Same as [code]RPC_MODE_SYNC[/code] which is only kept for compatibility. Analogous to the [code]remotesync[/code] keyword.
+ <constant name="RPC_MODE_REMOTESYNC" value="4" enum="RPCMode">
+ Behave like [code]RPC_MODE_REMOTE[/code] but also make the call or property change locally. Analogous to the [code]remotesync[/code] keyword.
</constant>
- <constant name="RPC_MODE_MASTERSYNC" value="6" enum="RPCMode">
+ <constant name="RPC_MODE_SYNC" value="4" enum="RPCMode">
+ Deprecated. Use [code]RPC_MODE_REMOTESYNC[/code] instead. Analogous to the [code]sync[/code] keyword.
+ </constant>
+ <constant name="RPC_MODE_MASTERSYNC" value="5" enum="RPCMode">
Behave like [code]RPC_MODE_MASTER[/code] but also make the call or property change locally. Analogous to the [code]mastersync[/code] keyword.
</constant>
- <constant name="RPC_MODE_SLAVESYNC" value="7" enum="RPCMode">
- Behave like [code]RPC_MODE_SLAVE[/code] but also make the call or property change locally. Analogous to the [code]slavesync[/code] keyword.
+ <constant name="RPC_MODE_PUPPETSYNC" value="6" enum="RPCMode">
+ Behave like [code]RPC_MODE_PUPPET[/code] but also make the call or property change locally. Analogous to the [code]puppetsync[/code] keyword.
</constant>
</constants>
</class>
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index dd496e79dd..d00652d40c 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -185,6 +185,7 @@
</argument>
<description>
Returns a child node by its index (see [method get_child_count]). This method is often used for iterating all children of a node.
+ To access a child node via its name, use [method get_node].
</description>
</method>
<method name="get_child_count" qualifiers="const">
@@ -581,7 +582,7 @@
<argument index="1" name="mode" type="int" enum="MultiplayerAPI.RPCMode">
</argument>
<description>
- Changes the RPC mode for the given [code]method[/code] to the given [code]mode[/code]. See [enum MultiplayerAPI.RPCMode]. An alternative is annotating methods and properties with the corresponding keywords ([code]remote[/code], [code]sync[/code], [code]master[/code], [code]slave[/code]). By default, methods are not exposed to networking (and RPCs). Also see [method rset] and [method rset_config] for properties.
+ Changes the RPC mode for the given [code]method[/code] to the given [code]mode[/code]. See [enum MultiplayerAPI.RPCMode]. An alternative is annotating methods and properties with the corresponding keywords ([code]remote[/code], [code]master[/code], [code]puppet[/code], [code]remotesync[/code], [code]mastersync[/code], [code]puppetsync[/code]). By default, methods are not exposed to networking (and RPCs). Also see [method rset] and [method rset_config] for properties.
</description>
</method>
<method name="rpc_id" qualifiers="vararg">
@@ -634,7 +635,7 @@
<argument index="1" name="mode" type="int" enum="MultiplayerAPI.RPCMode">
</argument>
<description>
- Changes the RPC mode for the given [code]property[/code] to the given [code]mode[/code]. See [enum MultiplayerAPI.RPCMode]. An alternative is annotating methods and properties with the corresponding keywords ([code]remote[/code], [code]sync[/code], [code]master[/code], [code]slave[/code]). By default, properties are not exposed to networking (and RPCs). Also see [method rpc] and [method rpc_config] for methods.
+ Changes the RPC mode for the given [code]property[/code] to the given [code]mode[/code]. See [enum MultiplayerAPI.RPCMode]. An alternative is annotating methods and properties with the corresponding keywords ([code]remote[/code], [code]master[/code], [code]puppet[/code], [code]remotesync[/code], [code]mastersync[/code], [code]puppetsync[/code]). By default, properties are not exposed to networking (and RPCs). Also see [method rpc] and [method rpc_config] for methods.
</description>
</method>
<method name="rset_id">
@@ -691,7 +692,7 @@
<argument index="1" name="recursive" type="bool" default="true">
</argument>
<description>
- Sets the node's network master to the peer with the given peer ID. The network master is the peer that has authority over the node on the network. Useful in conjunction with the [code]master[/code] and [code]slave[/code] keywords. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). If [code]recursive[/code], the given peer is recursively set as the master for all children of this node.
+ Sets the node's network master to the peer with the given peer ID. The network master is the peer that has authority over the node on the network. Useful in conjunction with the [code]master[/code] and [code]puppet[/code] keywords. Inherited from the parent node by default, which ultimately defaults to peer ID 1 (the server). If [code]recursive[/code], the given peer is recursively set as the master for all children of this node.
</description>
</method>
<method name="set_physics_process">
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index f4ad196ad2..fcd105d66b 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -185,7 +185,7 @@
</argument>
<description>
Get indexed object property by String.
- Property indices get accessed with colon seperation, for example: [code]position:x[/code]
+ Property indices get accessed with colon separation, for example: [code]position:x[/code]
</description>
</method>
<method name="get_instance_id" qualifiers="const">
diff --git a/doc/classes/PhysicsBody.xml b/doc/classes/PhysicsBody.xml
index 14053c6a35..af00027ed3 100644
--- a/doc/classes/PhysicsBody.xml
+++ b/doc/classes/PhysicsBody.xml
@@ -27,6 +27,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -35,6 +36,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="remove_collision_exception_with">
@@ -54,6 +56,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
+ Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -64,6 +67,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
+ Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
</description>
</method>
</methods>
@@ -74,7 +78,7 @@
A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
- The physics layers this area can scan for collisions.
+ The physics layers this area scans for collisions.
</member>
</members>
<constants>
diff --git a/doc/classes/PhysicsBody2D.xml b/doc/classes/PhysicsBody2D.xml
index ccc704c7ec..4278979049 100644
--- a/doc/classes/PhysicsBody2D.xml
+++ b/doc/classes/PhysicsBody2D.xml
@@ -27,7 +27,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Return an individual bit on the collision mask.
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -36,7 +36,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
- Return an individual bit on the collision mask.
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="remove_collision_exception_with">
@@ -56,7 +56,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Set/clear individual bits on the layer mask. This makes getting a body in/out of only one layer easier.
+ Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -67,7 +67,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
- Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier.
+ Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
</description>
</method>
</methods>
@@ -78,10 +78,10 @@
A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
- The physics layers this area can scan for collisions.
+ The physics layers this area scans for collisions.
</member>
<member name="layers" type="int" setter="_set_layers" getter="_get_layers">
- Both collision_layer and collision_mask. Returns collision_layer when accessed. Updates collision_layers and collision_mask when modified.
+ Both [member collision_layer] and [member collision_mask]. Returns [member collision_layer] when accessed. Updates [member collision_layer] and [member collision_mask] when modified.
</member>
</members>
<constants>
diff --git a/doc/classes/ProceduralSky.xml b/doc/classes/ProceduralSky.xml
index df0519b2ad..090b626433 100644
--- a/doc/classes/ProceduralSky.xml
+++ b/doc/classes/ProceduralSky.xml
@@ -5,7 +5,7 @@
</brief_description>
<description>
ProceduralSky provides a way to create an effective background quickly by defining procedural parameters for the sun, the sky and the ground. The sky and ground are very similar, they are defined by a color at the horizon, another color, and finally an easing curve to interpolate between these two colors. Similarly the sun is described by a position in the sky, a color, and an easing curve. However, the sun also defines a minimum and maximum angle, these two values define at what distance the easing curve begins and ends from the sun, and thus end up defining the size of the sun in the sky.
- The ProceduralSky is updated on the CPU after the parameters change and stored in a texture and then displayed as a background in the scene. This makes it relatively unsuitable for realtime updates during gameplay. But with a small texture size it is still feasible to update relatively frequently becuase it is updated on a background thread when multi-threading is available.
+ The ProceduralSky is updated on the CPU after the parameters change and stored in a texture and then displayed as a background in the scene. This makes it relatively unsuitable for realtime updates during gameplay. But with a small texture size it is still feasible to update relatively frequently because it is updated on a background thread when multi-threading is available.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index ad8c5f68da..548d60fe35 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -157,6 +157,8 @@
</method>
</methods>
<members>
+ <member name="application/boot_splash/bg_color" type="Color" setter="" getter="">
+ </member>
<member name="application/boot_splash/fullsize" type="bool" setter="" getter="">
Scale the boot splash image to the full window length when engine starts (will leave it as default pixel size otherwise).
</member>
@@ -208,7 +210,7 @@
<member name="audio/output_latency" type="int" setter="" getter="">
</member>
<member name="audio/video_delay_compensation_ms" type="int" setter="" getter="">
- Setting to harcode audio delay when playing video. Best to leave this untouched unless you know what you are doing.
+ Setting to hardcode audio delay when playing video. Best to leave this untouched unless you know what you are doing.
</member>
<member name="compression/formats/gzip/compression_level" type="int" setter="" getter="">
Default compression level for gzip. Affects compressed scenes and resources.
@@ -226,6 +228,8 @@
</member>
<member name="debug/gdscript/warnings/constant_used_as_function" type="bool" setter="" getter="">
</member>
+ <member name="debug/gdscript/warnings/deprecated_keyword" type="bool" setter="" getter="">
+ </member>
<member name="debug/gdscript/warnings/enable" type="bool" setter="" getter="">
</member>
<member name="debug/gdscript/warnings/function_conflicts_constant" type="bool" setter="" getter="">
@@ -630,7 +634,7 @@
Fix to improve physics jitter, specially on monitors where refresh rate is different than physics FPS.
</member>
<member name="rendering/environment/default_clear_color" type="Color" setter="" getter="">
- Default background clear color.
+ Default background clear color. Overridable per [Viewport] using its [Environment]. See [member Environment.background_mode] and [member Environment.background_color] in particular. To change this default color programmatically, use [method VisualServer.set_default_clear_color].
</member>
<member name="rendering/limits/buffers/blend_shape_max_buffer_size_kb" type="int" setter="" getter="">
Max buffer size for blend shapes. Any blend shape bigger than this will not work.
diff --git a/doc/classes/SceneState.xml b/doc/classes/SceneState.xml
index 36cddf08df..bd2f883cae 100644
--- a/doc/classes/SceneState.xml
+++ b/doc/classes/SceneState.xml
@@ -4,7 +4,7 @@
A script interface to a scene file's data.
</brief_description>
<description>
- Maintains a list of resources, nodes, exported and overridden properties, and built-in scripts associated with a scene.
+ Maintains a list of resources, nodes, exported, and overridden properties, and built-in scripts associated with a scene.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml
index 11362ee680..1985845552 100644
--- a/doc/classes/SceneTree.xml
+++ b/doc/classes/SceneTree.xml
@@ -271,10 +271,10 @@
</member>
<member name="multiplayer_poll" type="bool" setter="set_multiplayer_poll_enabled" getter="is_multiplayer_poll_enabled">
If [code]true[/code] (default) enable the automatic polling of the [MultiplayerAPI] for this SceneTree during [signal idle_frame].
- When [code]false[/code] you need to manually call [method MultiplayerAPI.poll] for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual [Mutex] protecion when accessing the [MultiplayerAPI] from threads.
+ When [code]false[/code] you need to manually call [method MultiplayerAPI.poll] for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual [Mutex] protection when accessing the [MultiplayerAPI] from threads.
</member>
<member name="network_peer" type="NetworkedMultiplayerPeer" setter="set_network_peer" getter="get_network_peer">
- The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to slave. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
+ The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with [method is_network_server()]) and will set root node's network mode to master (see NETWORK_MODE_* constants in [Node]), or it will become a regular peer with root node set to puppet. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.
</member>
<member name="paused" type="bool" setter="set_pause" getter="is_paused">
If [code]true[/code] the SceneTree is paused.
diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml
index 76049d8947..7f9a124683 100644
--- a/doc/classes/Shader.xml
+++ b/doc/classes/Shader.xml
@@ -24,7 +24,7 @@
<return type="int" enum="Shader.Mode">
</return>
<description>
- Returns the shader mode for the shader, eiter [code]MODE_CANVAS_ITEM[/code], [code]MODE_SPATIAL[/code] or [code]MODE_PARTICLES[/code]
+ Returns the shader mode for the shader, either [code]MODE_CANVAS_ITEM[/code], [code]MODE_SPATIAL[/code] or [code]MODE_PARTICLES[/code]
</description>
</method>
<method name="has_param" qualifiers="const">
diff --git a/doc/classes/ShaderMaterial.xml b/doc/classes/ShaderMaterial.xml
index 5abba9fba9..7491d22479 100644
--- a/doc/classes/ShaderMaterial.xml
+++ b/doc/classes/ShaderMaterial.xml
@@ -20,6 +20,22 @@
Returns the current value set for this material of a uniform in the shader.
</description>
</method>
+ <method name="property_can_revert">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
+ <method name="property_get_revert">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="set_shader_param">
<return type="void">
</return>
diff --git a/doc/classes/Shape2D.xml b/doc/classes/Shape2D.xml
index 6c13496fc4..2772538cec 100644
--- a/doc/classes/Shape2D.xml
+++ b/doc/classes/Shape2D.xml
@@ -22,7 +22,7 @@
<argument index="2" name="shape_xform" type="Transform2D">
</argument>
<description>
- Return whether this shape is colliding with another.
+ Returns [code]true[/code] if this shape is colliding with another.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the shape to check collisions with ([code]with_shape[/code]), and the transformation matrix of that shape ([code]shape_xform[/code]).
</description>
</method>
@@ -36,7 +36,7 @@
<argument index="2" name="shape_xform" type="Transform2D">
</argument>
<description>
- Return a list of the points where this shape touches another. If there are no collisions, the list is empty.
+ Returns a list of the points where this shape touches another. If there are no collisions the list is empty.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the shape to check collisions with ([code]with_shape[/code]), and the transformation matrix of that shape ([code]shape_xform[/code]).
</description>
</method>
@@ -72,7 +72,7 @@
<argument index="4" name="shape_motion" type="Vector2">
</argument>
<description>
- Return a list of the points where this shape would touch another, if a given movement was applied. If there are no collisions, the list is empty.
+ Returns a list of the points where this shape would touch another, if a given movement was applied. If there are no collisions the list is empty.
This method needs the transformation matrix for this shape ([code]local_xform[/code]), the movement to test on this shape ([code]local_motion[/code]), the shape to check collisions with ([code]with_shape[/code]), the transformation matrix of that shape ([code]shape_xform[/code]), and the movement to test onto the other object ([code]shape_motion[/code]).
</description>
</method>
diff --git a/doc/classes/ShortCut.xml b/doc/classes/ShortCut.xml
index 6da9d7c59d..1b5fc035c2 100644
--- a/doc/classes/ShortCut.xml
+++ b/doc/classes/ShortCut.xml
@@ -16,7 +16,7 @@
<return type="String">
</return>
<description>
- Returns the Shortcut's [InputEvent] as a [String].
+ Returns the shortcut's [InputEvent] as a [String].
</description>
</method>
<method name="is_shortcut" qualifiers="const">
@@ -25,20 +25,20 @@
<argument index="0" name="event" type="InputEvent">
</argument>
<description>
- Returns [code]true[/code] if the Shortcut's [InputEvent] equals [code]event[/code].
+ Returns [code]true[/code] if the shortcut's [InputEvent] equals [code]event[/code].
</description>
</method>
<method name="is_valid" qualifiers="const">
<return type="bool">
</return>
<description>
- If [code]true[/code] this Shortcut is valid.
+ If [code]true[/code] this shortcut is valid.
</description>
</method>
</methods>
<members>
<member name="shortcut" type="InputEvent" setter="set_shortcut" getter="get_shortcut">
- The Shortcut's [InputEvent].
+ The shortcut's [InputEvent].
Generally the [InputEvent] is a keyboard key, though it can be any [InputEvent].
</member>
</members>
diff --git a/doc/classes/SoftBody.xml b/doc/classes/SoftBody.xml
index c3c789a6de..196d29fc60 100644
--- a/doc/classes/SoftBody.xml
+++ b/doc/classes/SoftBody.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="SoftBody" inherits="MeshInstance" category="Core" version="3.1">
<brief_description>
+ A soft mesh physics body.
</brief_description>
<description>
+ A deformable physics body. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials.
</description>
<tutorials>
</tutorials>
@@ -15,6 +17,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
+ Adds a body to the list of bodies that this body can't collide with.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
@@ -23,6 +26,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="get_collision_mask_bit" qualifiers="const">
@@ -31,6 +35,7 @@
<argument index="0" name="bit" type="int">
</argument>
<description>
+ Returns an individual bit on the collision mask.
</description>
</method>
<method name="is_ray_pickable" qualifiers="const">
@@ -45,6 +50,7 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
+ Removes a body from the list of bodies that this body can't collide with.
</description>
</method>
<method name="set_collision_layer_bit">
@@ -55,6 +61,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
+ Sets individual bits on the layer mask. Use this if you only need to change one layer's value.
</description>
</method>
<method name="set_collision_mask_bit">
@@ -65,6 +72,7 @@
<argument index="1" name="value" type="bool">
</argument>
<description>
+ Sets individual bits on the collision mask. Use this if you only need to change one layer's value.
</description>
</method>
<method name="set_ray_pickable">
@@ -80,8 +88,12 @@
<member name="areaAngular_stiffness" type="float" setter="set_areaAngular_stiffness" getter="get_areaAngular_stiffness">
</member>
<member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
+ The physics layers this area is in.
+ Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property.
+ A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A.
</member>
<member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
+ The physics layers this area scans for collisions.
</member>
<member name="damping_coefficient" type="float" setter="set_damping_coefficient" getter="get_damping_coefficient">
</member>
@@ -96,6 +108,7 @@
<member name="pressure_coefficient" type="float" setter="set_pressure_coefficient" getter="get_pressure_coefficient">
</member>
<member name="simulation_precision" type="int" setter="set_simulation_precision" getter="get_simulation_precision">
+ Increasing this value will improve the resulting simulation, but can affect performance. Use with care.
</member>
<member name="total_mass" type="float" setter="set_total_mass" getter="get_total_mass">
</member>
diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml
index 4ad575b67f..0e11d797e4 100644
--- a/doc/classes/SpriteFrames.xml
+++ b/doc/classes/SpriteFrames.xml
@@ -171,6 +171,8 @@
</method>
</methods>
<members>
+ <member name="frames" type="Array" setter="_set_frames" getter="_get_frames">
+ </member>
</members>
<constants>
</constants>
diff --git a/doc/classes/StreamPeerTCP.xml b/doc/classes/StreamPeerTCP.xml
index 5fc8e99ced..664ffc60c3 100644
--- a/doc/classes/StreamPeerTCP.xml
+++ b/doc/classes/StreamPeerTCP.xml
@@ -43,7 +43,7 @@
Return the port of this peer.
</description>
</method>
- <method name="get_status" qualifiers="const">
+ <method name="get_status">
<return type="int" enum="StreamPeerTCP.Status">
</return>
<description>
@@ -78,7 +78,7 @@
A status representing a [code]StreamPeerTCP[/code] that is connected to a host.
</constant>
<constant name="STATUS_ERROR" value="3" enum="Status">
- A staus representing a [code]StreamPeerTCP[/code] in error state.
+ A status representing a [code]StreamPeerTCP[/code] in error state.
</constant>
</constants>
</class>
diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml
index d1c8722901..65d638c4c0 100644
--- a/doc/classes/Timer.xml
+++ b/doc/classes/Timer.xml
@@ -32,25 +32,26 @@
<return type="void">
</return>
<description>
- Stop (cancel) the Timer.
+ Stops the timer.
</description>
</method>
</methods>
<members>
<member name="autostart" type="bool" setter="set_autostart" getter="has_autostart">
- If [code]true[/code], Timer will automatically start when entering the scene tree. Default value: [code]false[/code].
+ If [code]true[/code] the timer will automatically start when entering the scene tree. Default value: [code]false[/code].
</member>
<member name="one_shot" type="bool" setter="set_one_shot" getter="is_one_shot">
- If [code]true[/code], Timer will stop when reaching 0. If [code]false[/code], it will restart. Default value: [code]false[/code].
+ If [code]true[/code] the timer will stop when reaching 0. If [code]false[/code] it will restart. Default value: [code]false[/code].
</member>
<member name="paused" type="bool" setter="set_paused" getter="is_paused">
- If [code]true[/code], the timer is paused and will not process until it is unpaused again, even if [method start] is called.
+ If [code]true[/code] the timer is paused and will not process until it is unpaused again, even if [method start] is called.
</member>
<member name="process_mode" type="int" setter="set_timer_process_mode" getter="get_timer_process_mode" enum="Timer.TimerProcessMode">
- Processing mode. Uses TIMER_PROCESS_* constants as value.
+ Processing mode. See [enum TimerProcessMode].
</member>
<member name="time_left" type="float" setter="" getter="get_time_left">
The timer's remaining time in seconds. Returns 0 if the timer is inactive.
+ Note: You cannot set this value. To change the timer's remaining time, use [member wait_time].
</member>
<member name="wait_time" type="float" setter="set_wait_time" getter="get_wait_time">
Wait time in seconds.
@@ -59,16 +60,16 @@
<signals>
<signal name="timeout">
<description>
- Emitted when the Timer reaches 0.
+ Emitted when the timer reaches 0.
</description>
</signal>
</signals>
<constants>
<constant name="TIMER_PROCESS_PHYSICS" value="0" enum="TimerProcessMode">
- Update the Timer during the physics step at each frame (fixed framerate processing).
+ Update the timer during the physics step at each frame (fixed framerate processing).
</constant>
<constant name="TIMER_PROCESS_IDLE" value="1" enum="TimerProcessMode">
- Update the Timer during the idle time at each frame.
+ Update the timer during the idle time at each frame.
</constant>
</constants>
</class>
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 2f5710da51..9cd501630e 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -46,6 +46,13 @@
Returns the total transform of the viewport.
</description>
</method>
+ <method name="get_modal_stack_top" qualifiers="const">
+ <return type="Control">
+ </return>
+ <description>
+ Returns the topmost modal in the stack.
+ </description>
+ </method>
<method name="get_mouse_position" qualifiers="const">
<return type="Vector2">
</return>
diff --git a/doc/classes/VisualServer.xml b/doc/classes/VisualServer.xml
index afada05bf7..58b3d33cdb 100644
--- a/doc/classes/VisualServer.xml
+++ b/doc/classes/VisualServer.xml
@@ -2185,6 +2185,16 @@
Returns the value of a certain material's parameter.
</description>
</method>
+ <method name="material_get_param_default" qualifiers="const">
+ <return type="Variant">
+ </return>
+ <argument index="0" name="material" type="RID">
+ </argument>
+ <argument index="1" name="parameter" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="material_get_shader" qualifiers="const">
<return type="RID">
</return>
diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py
index 93ad823d42..ad6601b18b 100755
--- a/doc/tools/makerst.py
+++ b/doc/tools/makerst.py
@@ -309,10 +309,41 @@ def rstize_text(text, cclass):
return text
+def format_table(f, pp):
+ longest_t = 0
+ longest_s = 0
+ for s in pp:
+ sl = len(s[0])
+ if (sl > longest_s):
+ longest_s = sl
+ tl = len(s[1])
+ if (tl > longest_t):
+ longest_t = tl
+
+ sep = "+"
+ for i in range(longest_s + 2):
+ sep += "-"
+ sep += "+"
+ for i in range(longest_t + 2):
+ sep += "-"
+ sep += "+\n"
+ f.write(sep)
+ for s in pp:
+ rt = s[0]
+ while (len(rt) < longest_s):
+ rt += " "
+ st = s[1]
+ while (len(st) < longest_t):
+ st += " "
+ f.write("| " + rt + " | " + st + " |\n")
+ f.write(sep)
+ f.write('\n')
+
+
def make_type(t):
global class_names
if t in class_names:
- return ':ref:`' + t + '<class_' + t.lower() + '>`'
+ return ':ref:`' + t + '<class_' + t + '>`'
return t
@@ -332,16 +363,15 @@ def make_enum(t):
c = "@GlobalScope"
e = t
if c in class_names:
- return ':ref:`' + e + '<enum_' + c.lower() + '_' + e.lower() + '>`'
+ return ':ref:`' + e + '<enum_' + c + '_' + e + '>`'
return t
def make_method(
f,
- name,
- m,
- declare,
cname,
+ method_data,
+ declare,
event=False,
pp=None
):
@@ -351,7 +381,7 @@ def make_method(
t = ""
ret_type = 'void'
- args = list(m)
+ args = list(method_data)
mdata = {}
mdata['argidx'] = []
for a in args:
@@ -377,9 +407,9 @@ def make_method(
if declare or pp == None:
- s = '**' + m.attrib['name'] + '** '
+ s = '**' + method_data.attrib['name'] + '** '
else:
- s = ':ref:`' + m.attrib['name'] + '<class_' + cname + "_" + m.attrib['name'] + '>` '
+ s = ':ref:`' + method_data.attrib['name'] + '<class_' + cname + "_" + method_data.attrib['name'] + '>` '
s += '**(**'
argfound = False
@@ -406,8 +436,8 @@ def make_method(
s += ' **)**'
- if 'qualifiers' in m.attrib:
- s += ' ' + m.attrib['qualifiers']
+ if 'qualifiers' in method_data.attrib:
+ s += ' ' + method_data.attrib['qualifiers']
if (not declare):
if (pp != None):
@@ -418,6 +448,37 @@ def make_method(
f.write(t + s + "\n")
+def make_properties(
+ f,
+ cname,
+ prop_data,
+ description=False,
+ pp=None
+):
+ t = ""
+ if 'enum' in prop_data.attrib:
+ t += make_enum(prop_data.attrib['enum'])
+ else:
+ t += make_type(prop_data.attrib['type'])
+
+ if description:
+ s = '**' + prop_data.attrib['name'] + '**'
+ setget = []
+ if 'setter' in prop_data.attrib and prop_data.attrib['setter'] != '' and not prop_data.attrib['setter'].startswith('_'):
+ setget.append(("*Setter*", prop_data.attrib['setter'] + '(value)'))
+ if 'getter' in prop_data.attrib and prop_data.attrib['getter'] != '' and not prop_data.attrib['getter'].startswith('_'):
+ setget.append(('*Getter*', prop_data.attrib['getter'] + '()'))
+ else:
+ s = ':ref:`' + prop_data.attrib['name'] + '<class_' + cname + "_" + prop_data.attrib['name'] + '>`'
+
+ if (pp != None):
+ pp.append((t, s))
+ elif description:
+ f.write('- ' + t + ' ' + s + '\n\n')
+ if len(setget) > 0:
+ format_table(f, setget)
+
+
def make_heading(title, underline):
return title + '\n' + underline * len(title) + "\n\n"
@@ -435,6 +496,8 @@ def make_rst_class(node):
f.write(".. _class_" + name + ":\n\n")
f.write(make_heading(name, '='))
+ # Inheritance tree
+ # Ascendents
if 'inherits' in node.attrib:
inh = node.attrib['inherits'].strip()
f.write('**Inherits:** ')
@@ -451,16 +514,15 @@ def make_rst_class(node):
inh = inode.attrib['inherits'].strip()
else:
inh = None
-
f.write("\n\n")
+ # Descendents
inherited = []
for cn in classes:
c = classes[cn]
if 'inherits' in c.attrib:
if (c.attrib['inherits'].strip() == name):
inherited.append(c.attrib['name'])
-
if (len(inherited)):
f.write('**Inherited By:** ')
for i in range(len(inherited)):
@@ -468,56 +530,51 @@ def make_rst_class(node):
f.write(", ")
f.write(make_type(inherited[i]))
f.write("\n\n")
+
+ # Category
if 'category' in node.attrib:
f.write('**Category:** ' + node.attrib['category'].strip() + "\n\n")
+ # Brief description
f.write(make_heading('Brief Description', '-'))
briefd = node.find('brief_description')
if briefd != None:
f.write(rstize_text(briefd.text.strip(), name) + "\n\n")
- methods = node.find('methods')
+ # Properties overview
+ members = node.find('members')
+ if members != None and len(list(members)) > 0:
+ f.write(make_heading('Properties', '-'))
+ ml = []
+ for m in list(members):
+ make_properties(f, name, m, False, ml)
+ format_table(f, ml)
+ # Methods overview
+ methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
- f.write(make_heading('Member Functions', '-'))
+ f.write(make_heading('Methods', '-'))
ml = []
for m in list(methods):
- make_method(f, node.attrib['name'], m, False, name, False, ml)
- longest_t = 0
- longest_s = 0
- for s in ml:
- sl = len(s[0])
- if (sl > longest_s):
- longest_s = sl
- tl = len(s[1])
- if (tl > longest_t):
- longest_t = tl
-
- sep = "+"
- for i in range(longest_s + 2):
- sep += "-"
- sep += "+"
- for i in range(longest_t + 2):
- sep += "-"
- sep += "+\n"
- f.write(sep)
- for s in ml:
- rt = s[0]
- while (len(rt) < longest_s):
- rt += " "
- st = s[1]
- while (len(st) < longest_t):
- st += " "
- f.write("| " + rt + " | " + st + " |\n")
- f.write(sep)
- f.write('\n')
+ make_method(f, name, m, False, False, ml)
+ format_table(f, ml)
+ # Theme properties
+ theme_items = node.find('theme_items')
+ if theme_items != None and len(list(theme_items)) > 0:
+ f.write(make_heading('Theme Properties', '-'))
+ ml = []
+ for m in list(theme_items):
+ make_properties(f, name, m, False, ml)
+ format_table(f, ml)
+
+ # Signals
events = node.find('signals')
if events != None and len(list(events)) > 0:
f.write(make_heading('Signals', '-'))
for m in list(events):
- f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
- make_method(f, node.attrib['name'], m, True, name, True)
+ f.write(" .. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
+ make_method(f, name, m, True, True)
f.write('\n')
d = m.find('description')
if d == None or d.text.strip() == '':
@@ -525,26 +582,7 @@ def make_rst_class(node):
f.write(rstize_text(d.text.strip(), name))
f.write("\n\n")
- f.write('\n')
-
- members = node.find('members')
- if members != None and len(list(members)) > 0:
- f.write(make_heading('Member Variables', '-'))
-
- for c in list(members):
- # Leading two spaces necessary to prevent breaking the <ul>
- f.write(" .. _class_" + name + "_" + c.attrib['name'] + ":\n\n")
- s = '- '
- if 'enum' in c.attrib:
- s += make_enum(c.attrib['enum']) + ' '
- else:
- s += make_type(c.attrib['type']) + ' '
- s += '**' + c.attrib['name'] + '**'
- if c.text.strip() != '':
- s += ' - ' + rstize_text(c.text.strip(), name)
- f.write(s + '\n\n')
- f.write('\n')
-
+ # Constants and enums
constants = node.find('constants')
consts = []
enum_names = set()
@@ -557,23 +595,12 @@ def make_rst_class(node):
else:
consts.append(c)
- if len(consts) > 0:
- f.write(make_heading('Numeric Constants', '-'))
- for c in list(consts):
- s = '- '
- s += '**' + c.attrib['name'] + '**'
- if 'value' in c.attrib:
- s += ' = **' + c.attrib['value'] + '**'
- if c.text.strip() != '':
- s += ' --- ' + rstize_text(c.text.strip(), name)
- f.write(s + '\n')
- f.write('\n')
-
+ # Enums
if len(enum_names) > 0:
- f.write(make_heading('Enums', '-'))
+ f.write(make_heading('Enumerations', '-'))
for e in enum_names:
f.write(" .. _enum_" + name + "_" + e + ":\n\n")
- f.write("enum **" + e + "**\n\n")
+ f.write("enum **" + e + "**:\n\n")
for c in enums:
if c.attrib['enum'] != e:
continue
@@ -585,13 +612,26 @@ def make_rst_class(node):
s += ' --- ' + rstize_text(c.text.strip(), name)
f.write(s + '\n')
f.write('\n')
- f.write('\n')
+ # Constants
+ if len(consts) > 0:
+ f.write(make_heading('Constants', '-'))
+ for c in list(consts):
+ s = '- '
+ s += '**' + c.attrib['name'] + '**'
+ if 'value' in c.attrib:
+ s += ' = **' + c.attrib['value'] + '**'
+ if c.text.strip() != '':
+ s += ' --- ' + rstize_text(c.text.strip(), name)
+ f.write(s + '\n')
+
+ # Class description
descr = node.find('description')
if descr != None and descr.text.strip() != '':
f.write(make_heading('Description', '-'))
f.write(rstize_text(descr.text.strip(), name) + "\n\n")
+ # Online tutorials
global godot_docs_pattern
tutorials = node.find('tutorials')
if tutorials != None and len(tutorials) > 0:
@@ -616,23 +656,31 @@ def make_rst_class(node):
# External link, for example:
# `http://enet.bespin.org/usergroup0.html`
f.write("- `" + link + " <" + link + ">`_\n")
- f.write("\n")
+ # Property descriptions
+ members = node.find('members')
+ if members != None and len(list(members)) > 0:
+ f.write(make_heading('Property Descriptions', '-'))
+ for m in list(members):
+ f.write(" .. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
+ make_properties(f, name, m, True)
+ if m.text.strip() != '':
+ f.write(rstize_text(m.text.strip(), name))
+ f.write('\n\n')
+
+ # Method descriptions
methods = node.find('methods')
if methods != None and len(list(methods)) > 0:
- f.write(make_heading('Member Function Description', '-'))
+ f.write(make_heading('Method Descriptions', '-'))
for m in list(methods):
- f.write(".. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
- make_method(f, node.attrib['name'], m, True, name)
+ f.write(" .. _class_" + name + "_" + m.attrib['name'] + ":\n\n")
+ make_method(f, name, m, True)
f.write('\n')
d = m.find('description')
if d == None or d.text.strip() == '':
continue
f.write(rstize_text(d.text.strip(), name))
f.write("\n\n")
- f.write('\n')
-
- f.close()
file_list = []
diff --git a/drivers/dummy/rasterizer_dummy.h b/drivers/dummy/rasterizer_dummy.h
index bb4511ecc3..126f23feeb 100644
--- a/drivers/dummy/rasterizer_dummy.h
+++ b/drivers/dummy/rasterizer_dummy.h
@@ -267,6 +267,7 @@ public:
void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) {}
Variant material_get_param(RID p_material, const StringName &p_param) const { return Variant(); }
+ Variant material_get_param_default(RID p_material, const StringName &p_param) const { return Variant(); }
void material_set_line_width(RID p_material, float p_width) {}
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp
index f28fd59a0c..4ae4441462 100644
--- a/drivers/gles2/rasterizer_canvas_gles2.cpp
+++ b/drivers/gles2/rasterizer_canvas_gles2.cpp
@@ -565,7 +565,7 @@ void RasterizerCanvasGLES2::_canvas_item_render_commands(Item *p_item, Item *cur
buffer[(1 * 4 * 4) + 14] = (source.position.x + source.size.x) * texpixel_size.x;
buffer[(1 * 4 * 4) + 15] = (source.position.y + np->margin[MARGIN_TOP]) * texpixel_size.y;
- // thrid row
+ // third row
buffer[(2 * 4 * 4) + 0] = np->rect.position.x;
buffer[(2 * 4 * 4) + 1] = np->rect.position.y + np->rect.size.y - np->margin[MARGIN_BOTTOM];
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 090882a723..d945132dc2 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -1419,6 +1419,19 @@ Variant RasterizerStorageGLES2::material_get_param(RID p_material, const StringN
return material->params[p_param];
}
+ return material_get_param_default(p_material, p_param);
+}
+
+Variant RasterizerStorageGLES2::material_get_param_default(RID p_material, const StringName &p_param) const {
+ const Material *material = material_owner.get(p_material);
+ ERR_FAIL_COND_V(!material, Variant());
+
+ if (material->shader) {
+ if (material->shader->uniforms.has(p_param)) {
+ Vector<ShaderLanguage::ConstantNode::Value> default_value = material->shader->uniforms[p_param].default_value;
+ return ShaderLanguage::constant_value_to_variant(default_value, material->shader->uniforms[p_param].type);
+ }
+ }
return Variant();
}
@@ -1551,7 +1564,7 @@ void RasterizerStorageGLES2::_update_material(Material *p_material) {
}
}
- // uniforms and other thigns will be set in the use_material method in ShaderGLES2
+ // uniforms and other things will be set in the use_material method in ShaderGLES2
if (p_material->shader && p_material->shader->texture_count > 0) {
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index e42eb67d3d..d9bf6b3ccb 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -563,6 +563,7 @@ public:
virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value);
virtual Variant material_get_param(RID p_material, const StringName &p_param) const;
+ virtual Variant material_get_param_default(RID p_material, const StringName &p_param) const;
virtual void material_set_line_width(RID p_material, float p_width);
virtual void material_set_next_pass(RID p_material, RID p_next_material);
diff --git a/drivers/gles2/shader_gles2.cpp b/drivers/gles2/shader_gles2.cpp
index 5a50ce8ae5..445428acc5 100644
--- a/drivers/gles2/shader_gles2.cpp
+++ b/drivers/gles2/shader_gles2.cpp
@@ -293,7 +293,7 @@ ShaderGLES2::Version *ShaderGLES2::get_current_version() {
}
}
- // keep them around during the functino
+ // keep them around during the function
CharString code_string;
CharString code_string2;
CharString code_globals;
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 947729f6f6..1e43651d54 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3098,40 +3098,6 @@ void RasterizerSceneGLES3::_copy_screen(bool p_invalidate_color, bool p_invalida
glBindVertexArray(0);
}
-void RasterizerSceneGLES3::_copy_to_front_buffer(Environment *env) {
-
- //copy to front buffer
- glBindFramebuffer(GL_FRAMEBUFFER, storage->frame.current_rt->fbo);
-
- glDepthMask(GL_FALSE);
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- glDisable(GL_BLEND);
- glDepthFunc(GL_LEQUAL);
- glColorMask(1, 1, 1, 1);
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, storage->frame.current_rt->buffers.diffuse);
-
- storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, true);
-
- if (!env) {
- //no environment, simply convert from linear to srgb
- storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, true);
- } else {
- /* FIXME: Why are both statements equal? */
- storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, true);
- }
-
- storage->shaders.copy.bind();
-
- _copy_screen();
-
- //turn off everything used
- storage->shaders.copy.set_conditional(CopyShaderGLES3::LINEAR_TO_SRGB, false);
- storage->shaders.copy.set_conditional(CopyShaderGLES3::DISABLE_ALPHA, false);
-}
-
void RasterizerSceneGLES3::_copy_texture_to_front_buffer(GLuint p_texture) {
//copy to front buffer
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index cf387a69bc..b4c4a0558f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -837,7 +837,6 @@ public:
void _setup_reflections(RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, const Transform &p_camera_inverse_transform, const CameraMatrix &p_camera_projection, RID p_reflection_atlas, Environment *p_env);
void _copy_screen(bool p_invalidate_color = false, bool p_invalidate_depth = false);
- void _copy_to_front_buffer(Environment *env);
void _copy_texture_to_front_buffer(GLuint p_texture); //used for debug
void _fill_render_list(InstanceBase **p_cull_result, int p_cull_count, bool p_depth_pass, bool p_shadow_pass);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index c05f4cfbe3..25e7bd0424 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -29,7 +29,6 @@
/*************************************************************************/
#include "rasterizer_storage_gles3.h"
-
#include "core/engine.h"
#include "core/project_settings.h"
#include "rasterizer_canvas_gles3.h"
@@ -2140,6 +2139,19 @@ Variant RasterizerStorageGLES3::material_get_param(RID p_material, const StringN
if (material->params.has(p_param))
return material->params[p_param];
+ return material_get_param_default(p_material, p_param);
+}
+
+Variant RasterizerStorageGLES3::material_get_param_default(RID p_material, const StringName &p_param) const {
+ const Material *material = material_owner.get(p_material);
+ ERR_FAIL_COND_V(!material, Variant());
+
+ if (material->shader) {
+ if (material->shader->uniforms.has(p_param)) {
+ Vector<ShaderLanguage::ConstantNode::Value> default_value = material->shader->uniforms[p_param].default_value;
+ return ShaderLanguage::constant_value_to_variant(default_value, material->shader->uniforms[p_param].type);
+ }
+ }
return Variant();
}
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 33f0853d60..0bd9c22be5 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -583,6 +583,7 @@ public:
virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value);
virtual Variant material_get_param(RID p_material, const StringName &p_param) const;
+ virtual Variant material_get_param_default(RID p_material, const StringName &p_param) const;
virtual void material_set_line_width(RID p_material, float p_width);
virtual void material_set_next_pass(RID p_material, RID p_next_material);
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl
index 53f563303a..5203f53fa2 100644
--- a/drivers/gles3/shaders/canvas.glsl
+++ b/drivers/gles3/shaders/canvas.glsl
@@ -120,12 +120,12 @@ void main() {
vec4 color = color_attrib;
#ifdef USE_INSTANCING
- mat4 extra_matrix2 = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0)));
+ mat4 extra_matrix_instance = extra_matrix * transpose(mat4(instance_xform0, instance_xform1, instance_xform2, vec4(0.0, 0.0, 0.0, 1.0)));
color *= instance_color;
vec4 instance_custom = instance_custom_data;
#else
- mat4 extra_matrix2 = extra_matrix;
+ mat4 extra_matrix_instance = extra_matrix;
vec4 instance_custom = vec4(0.0);
#endif
@@ -157,7 +157,7 @@ void main() {
#endif
-#define extra_matrix extra_matrix2
+#define extra_matrix extra_matrix_instance
{
/* clang-format off */
@@ -246,8 +246,8 @@ VERTEX_SHADER_CODE
pos = outvec.xy;
#endif
- local_rot.xy = normalize((modelview_matrix * (extra_matrix * vec4(1.0, 0.0, 0.0, 0.0))).xy);
- local_rot.zw = normalize((modelview_matrix * (extra_matrix * vec4(0.0, 1.0, 0.0, 0.0))).xy);
+ local_rot.xy = normalize((modelview_matrix * (extra_matrix_instance * vec4(1.0, 0.0, 0.0, 0.0))).xy);
+ local_rot.zw = normalize((modelview_matrix * (extra_matrix_instance * vec4(0.0, 1.0, 0.0, 0.0))).xy);
#ifdef USE_TEXTURE_RECT
local_rot.xy *= sign(src_rect.z);
local_rot.zw *= sign(src_rect.w);
diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl
index e4aa8d5730..dd6d78849b 100644
--- a/drivers/gles3/shaders/tonemap.glsl
+++ b/drivers/gles3/shaders/tonemap.glsl
@@ -173,7 +173,7 @@ vec3 apply_tonemapping(vec3 color, float white) { // inputs are LINEAR, always o
return tonemap_aces(color, white);
#endif
- return clamp(color, vec3(0.0f), vec3(1.0f)); // no other seleced -> linear
+ return clamp(color, vec3(0.0f), vec3(1.0f)); // no other selected -> linear
}
vec3 gather_glow(sampler2D tex, vec2 uv) { // sample all selected glow levels
diff --git a/drivers/unix/dir_access_unix.cpp b/drivers/unix/dir_access_unix.cpp
index 81861f8c7b..a5a9258c4a 100644
--- a/drivers/unix/dir_access_unix.cpp
+++ b/drivers/unix/dir_access_unix.cpp
@@ -60,7 +60,7 @@ Error DirAccessUnix::list_dir_begin() {
//char real_current_dir_name[2048]; //is this enough?!
//getcwd(real_current_dir_name,2048);
- //chdir(curent_path.utf8().get_data());
+ //chdir(current_path.utf8().get_data());
dir_stream = opendir(current_dir.utf8().get_data());
//chdir(real_current_dir_name);
if (!dir_stream)
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index ea19b6a700..9dcc6038ab 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -150,9 +150,24 @@ NetSocket *NetSocketPosix::_create_func() {
}
void NetSocketPosix::make_default() {
+#if defined(WINDOWS_ENABLED)
+ if (_create == NULL) {
+ WSADATA data;
+ WSAStartup(MAKEWORD(2, 2), &data);
+ }
+#endif
_create = _create_func;
}
+void NetSocketPosix::cleanup() {
+#if defined(WINDOWS_ENABLED)
+ if (_create != NULL) {
+ WSACleanup();
+ }
+ _create = NULL;
+#endif
+}
+
NetSocketPosix::NetSocketPosix() {
_sock = SOCK_EMPTY;
_ip_type = IP::TYPE_NONE;
@@ -169,10 +184,11 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
if (err == WSAEISCONN)
return ERR_NET_IS_CONNECTED;
- if (err == WSAEINPROGRESS || errno == WSAEALREADY)
+ if (err == WSAEINPROGRESS || err == WSAEALREADY)
return ERR_NET_IN_PROGRESS;
if (err == WSAEWOULDBLOCK)
return ERR_NET_WOULD_BLOCK;
+ ERR_PRINTS("Socket error: " + itos(err));
return ERR_NET_OTHER;
#else
if (errno == EISCONN)
@@ -181,6 +197,7 @@ NetSocketPosix::NetError NetSocketPosix::_get_socket_error() {
return ERR_NET_IN_PROGRESS;
if (errno == EAGAIN || errno == EWOULDBLOCK)
return ERR_NET_WOULD_BLOCK;
+ ERR_PRINTS("Socket error: " + itos(errno));
return ERR_NET_OTHER;
#endif
}
diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h
index ee178136f3..8177e01987 100644
--- a/drivers/unix/net_socket_posix.h
+++ b/drivers/unix/net_socket_posix.h
@@ -67,6 +67,7 @@ protected:
public:
static void make_default();
+ static void cleanup();
virtual Error open(Type p_sock_type, IP::Type &ip_type);
virtual void close();
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 1225d00aad..9936c95cf9 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -139,6 +139,8 @@ void OS_Unix::initialize_core() {
}
void OS_Unix::finalize_core() {
+
+ NetSocketPosix::cleanup();
}
void OS_Unix::alert(const String &p_alert, const String &p_title) {
diff --git a/editor/SCsub b/editor/SCsub
index 6a4b06a97a..82b982eef2 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -61,10 +61,6 @@ if env['tools']:
env.Depends("#editor/doc_data_compressed.gen.h", docs)
env.CommandNoCache("#editor/doc_data_compressed.gen.h", docs, run_in_subprocess(editor_builders.make_doc_header))
- # Certificates
- env.Depends("#editor/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt")
- env.CommandNoCache("#editor/certs_compressed.gen.h", "#thirdparty/certs/ca-certificates.crt", run_in_subprocess(editor_builders.make_certs_header))
-
import glob
path = env.Dir('.').abspath
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp
index 04977dbb47..f0dc3ce305 100644
--- a/editor/animation_bezier_editor.cpp
+++ b/editor/animation_bezier_editor.cpp
@@ -30,6 +30,8 @@
#include "animation_bezier_editor.h"
+#include "editor/editor_node.h"
+
float AnimationBezierTrackEdit::_bezier_h_to_pixel(float p_h) {
float h = p_h;
h = (h - v_scroll) / v_zoom;
@@ -288,12 +290,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
int h = font->get_height();
if (node) {
- Ref<Texture> icon;
- if (has_icon(node->get_class(), "EditorIcons")) {
- icon = get_icon(node->get_class(), "EditorIcons");
- } else {
- icon = get_icon("Node", "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(node, "Node");
h = MAX(h, icon->get_height());
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 80bc73bc12..33d36e5e9c 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -374,7 +374,7 @@ void FindReplaceBar::_hide_bar() {
void FindReplaceBar::_show_search() {
show();
- search_text->grab_focus();
+ search_text->call_deferred("grab_focus");
if (text_edit->is_selection_active() && !selection_only->is_pressed()) {
search_text->set_text(text_edit->get_selection_text());
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 18c4dd85a1..a1337268ba 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -432,6 +432,9 @@ void ConnectionsDock::_make_or_edit_connection() {
if (add_script_function) {
// pick up args here before "it" is deleted by update_tree
script_function_args = it->get_metadata(0).operator Dictionary()["args"];
+ for (int i = 0; i < cToMake.binds.size(); i++) {
+ script_function_args.append("extra_arg_" + itos(i));
+ }
}
if (connect_dialog->is_editing()) {
@@ -497,7 +500,7 @@ void ConnectionsDock::_disconnect(TreeItem &item) {
}
/*
-Break all conections of currently selected signal.
+Break all connections of currently selected signal.
Can undo-redo as a single action.
*/
void ConnectionsDock::_disconnect_all() {
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 8bef94d8a8..eb11aea9cc 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -55,12 +55,12 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode) {
while (!f->eof_reached()) {
String l = f->get_line().strip_edges();
+ String name = l.split(" ")[0];
- if (l != String()) {
-
+ if (ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) {
TreeItem *ti = recent->create_item(root);
ti->set_text(0, l);
- ti->set_icon(0, _get_editor_icon(l));
+ ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
}
}
@@ -151,41 +151,6 @@ void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
}
}
-Ref<Texture> CreateDialog::_get_editor_icon(const String &p_type) const {
-
- if (has_icon(p_type, "EditorIcons")) {
- return get_icon(p_type, "EditorIcons");
- }
-
- if (ScriptServer::is_global_class(p_type)) {
- String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(p_type);
- RES icon;
- if (FileAccess::exists(icon_path)) {
- icon = ResourceLoader::load(icon_path);
- }
- if (!icon.is_valid()) {
- icon = get_icon(ScriptServer::get_global_class_base(p_type), "EditorIcons");
- }
- return icon;
- }
-
- const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();
- for (const Map<String, Vector<EditorData::CustomType> >::Element *E = p_map.front(); E; E = E->next()) {
- const Vector<EditorData::CustomType> &ct = E->value();
- for (int i = 0; i < ct.size(); ++i) {
- if (ct[i].name == p_type) {
- if (ct[i].icon.is_valid()) {
- return ct[i].icon;
- } else {
- return get_icon("Object", "EditorIcons");
- }
- }
- }
- }
-
- return get_icon("Object", "EditorIcons");
-}
-
void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p_types, TreeItem *p_root, TreeItem **to_select) {
if (p_types.has(p_type))
@@ -246,7 +211,10 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
to_select_type = to_select_type.split(" ")[0];
bool current_item_is_preferred;
if (cpp_type) {
- current_item_is_preferred = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type) && search_box->get_text() != to_select_type;
+ String cpp_to_select_type = to_select_type;
+ if (ScriptServer::is_global_class(to_select_type))
+ cpp_to_select_type = ScriptServer::get_global_class_base(to_select_type);
+ current_item_is_preferred = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(cpp_to_select_type, preferred_search_result_type);
} else {
current_item_is_preferred = ed.script_class_is_parent(p_type, preferred_search_result_type) && !ed.script_class_is_parent(to_select_type, preferred_search_result_type) && search_box->get_text() != to_select_type;
}
@@ -274,7 +242,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
const String &description = EditorHelp::get_doc_data()->class_list[p_type].brief_description;
item->set_tooltip(0, description);
- item->set_icon(0, _get_editor_icon(p_type));
+ item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, base_type));
p_types[p_type] = item;
}
@@ -578,7 +546,7 @@ void CreateDialog::_update_favorite_list() {
continue;
TreeItem *ti = favorites->create_item(root);
ti->set_text(0, l);
- ti->set_icon(0, _get_editor_icon(l));
+ ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
}
emit_signal("favorites_updated");
}
diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp
index 9f04d40763..d64b02a605 100644
--- a/editor/dependency_editor.cpp
+++ b/editor/dependency_editor.cpp
@@ -198,12 +198,7 @@ void DependencyEditor::_update_list() {
}
String name = path.get_file();
- Ref<Texture> icon;
- if (has_icon(type, "EditorIcons")) {
- icon = get_icon(type, "EditorIcons");
- } else {
- icon = get_icon("Object", "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(type);
item->set_text(0, name);
item->set_icon(0, icon);
item->set_metadata(0, type);
@@ -346,13 +341,7 @@ void DependencyEditorOwners::_fill_owners(EditorFileSystemDirectory *efsd) {
if (!found)
continue;
- Ref<Texture> icon;
- String type = efsd->get_file_type(i);
- if (!has_icon(type, "EditorIcons")) {
- icon = get_icon("Object", "EditorIcons");
- } else {
- icon = get_icon(type, "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(efsd->get_file_type(i));
owners->add_item(efsd->get_file_path(i), icon);
}
@@ -460,7 +449,7 @@ void DependencyRemoveDialog::_build_removed_dependency_tree(const Vector<Removed
}
//List this file under this dependency
- Ref<Texture> icon = has_icon(rd.file_type, "EditorIcons") ? get_icon(rd.file_type, "EditorIcons") : get_icon("Object", "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(rd.file_type);
TreeItem *file_item = owners->create_item(tree_items[rd.dependency]);
file_item->set_text(0, rd.file);
file_item->set_icon(0, icon);
@@ -515,7 +504,7 @@ void DependencyRemoveDialog::ok_pressed() {
}
if (dirs_to_delete.size() == 0) {
- //If we only deleted files we should only need to tell the file system about the files we touched.
+ // If we only deleted files we should only need to tell the file system about the files we touched.
for (int i = 0; i < files_to_delete.size(); ++i)
EditorFileSystem::get_singleton()->update_file(files_to_delete[i]);
} else {
@@ -529,21 +518,25 @@ void DependencyRemoveDialog::ok_pressed() {
}
}
- // if some dirs would be deleted, favorite dirs need to be updated
- Vector<String> previous_favorite_dirs = EditorSettings::get_singleton()->get_favorite_dirs();
- Vector<String> new_favorite_dirs;
+ EditorFileSystem::get_singleton()->scan_changes();
+ }
- for (int i = 0; i < previous_favorite_dirs.size(); ++i) {
- if (dirs_to_delete.find(previous_favorite_dirs[i] + "/") < 0) {
- new_favorite_dirs.push_back(previous_favorite_dirs[i]);
- }
- }
+ // If some files/dirs would be deleted, favorite dirs need to be updated
+ Vector<String> previous_favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> new_favorites;
- if (new_favorite_dirs.size() < previous_favorite_dirs.size()) {
- EditorSettings::get_singleton()->set_favorite_dirs(new_favorite_dirs);
+ for (int i = 0; i < previous_favorites.size(); ++i) {
+ if (previous_favorites[i].ends_with("/")) {
+ if (dirs_to_delete.find(previous_favorites[i]) < 0)
+ new_favorites.push_back(previous_favorites[i]);
+ } else {
+ if (files_to_delete.find(previous_favorites[i]) < 0)
+ new_favorites.push_back(previous_favorites[i]);
}
+ }
- EditorFileSystem::get_singleton()->scan_changes();
+ if (new_favorites.size() < previous_favorites.size()) {
+ EditorSettings::get_singleton()->set_favorites(new_favorites);
}
}
@@ -579,12 +572,7 @@ void DependencyErrorDialog::show(const String &p_for_file, const Vector<String>
if (report[i].get_slice_count("::") > 0)
type = report[i].get_slice("::", 1);
- Ref<Texture> icon;
- if (!has_icon(type, "EditorIcons")) {
- icon = get_icon("Object", "EditorIcons");
- } else {
- icon = get_icon(type, "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(type);
TreeItem *ti = files->create_item(root);
ti->set_text(0, dep);
@@ -687,12 +675,7 @@ bool OrphanResourcesDialog::_fill_owners(EditorFileSystemDirectory *efsd, HashMa
String type = efsd->get_file_type(i);
- Ref<Texture> icon;
- if (has_icon(type, "EditorIcons")) {
- icon = get_icon(type, "EditorIcons");
- } else {
- icon = get_icon("Object", "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(type);
ti->set_icon(0, icon);
int ds = efsd->get_file_deps(i).size();
ti->set_text(1, itos(ds));
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp
index e4602f0f94..cdf0e4b829 100644
--- a/editor/editor_about.cpp
+++ b/editor/editor_about.cpp
@@ -113,7 +113,6 @@ ScrollContainer *EditorAbout::_populate_list(const String &p_name, const List<St
EditorAbout::EditorAbout() {
set_title(TTR("Thanks from the Godot community!"));
- get_ok()->set_text(TTR("OK"));
set_hide_on_ok(true);
set_resizable(true);
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index 96110b61ab..6cd81626c7 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -765,10 +765,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
if (!ClassDB::can_instance(E->get()))
continue;
- Ref<Texture> icon;
- if (has_icon(E->get(), "EditorIcons")) {
- icon = get_icon(E->get(), "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(E->get());
String name = E->get().operator String().replace("AudioEffect", "");
effect_options->add_item(name);
effect_options->set_item_metadata(effect_options->get_item_count() - 1, E->get());
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index fa037980c2..9e9fe752b4 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -9,32 +9,6 @@ from platform_methods import subprocess_main
from compat import encode_utf8, byte_to_str, open_utf8, escape_string
-def make_certs_header(target, source, env):
-
- src = source[0]
- dst = target[0]
- f = open(src, "rb")
- g = open_utf8(dst, "w")
- buf = f.read()
- decomp_size = len(buf)
- import zlib
- 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")
- for i in range(len(buf)):
- g.write("\t" + byte_to_str(buf[i]) + ",\n")
- g.write("};\n")
- g.write("#endif")
-
- g.close()
- f.close()
-
-
def make_doc_header(target, source, env):
dst = target[0]
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index 6187c6b318..9420452da1 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -869,7 +869,7 @@ bool EditorData::script_class_is_parent(const String &p_class, const String &p_i
return true;
}
-StringName EditorData::script_class_get_base(const String &p_class) {
+StringName EditorData::script_class_get_base(const String &p_class) const {
if (!ScriptServer::is_global_class(p_class))
return StringName();
@@ -895,24 +895,48 @@ Object *EditorData::script_class_instance(const String &p_class) {
RES script = ResourceLoader::load(ScriptServer::get_global_class_path(p_class));
if (script.is_valid())
obj->set_script(script.get_ref_ptr());
-
- RES icon = ResourceLoader::load(script_class_get_icon_path(p_class));
- if (icon.is_valid())
- obj->set_meta("_editor_icon", icon);
-
return obj;
}
}
return NULL;
}
+void EditorData::script_class_set_icon_path(const String &p_class, const String &p_icon_path) {
+ _script_class_icon_paths[p_class] = p_icon_path;
+}
+
+String EditorData::script_class_get_icon_path(const String &p_class) const {
+ if (!ScriptServer::is_global_class(p_class))
+ return String();
+
+ String current = p_class;
+ String ret = _script_class_icon_paths[current];
+ while (ret.empty()) {
+ current = script_class_get_base(current);
+ if (!ScriptServer::is_global_class(current))
+ return String();
+ ret = _script_class_icon_paths.has(current) ? _script_class_icon_paths[current] : String();
+ }
+
+ return ret;
+}
+
+StringName EditorData::script_class_get_name(const String &p_path) const {
+ return _script_class_file_to_path.has(p_path) ? _script_class_file_to_path[p_path] : StringName();
+}
+
+void EditorData::script_class_set_name(const String &p_path, const StringName &p_class) {
+ _script_class_file_to_path[p_path] = p_class;
+}
+
void EditorData::script_class_save_icon_paths() {
List<StringName> keys;
_script_class_icon_paths.get_key_list(&keys);
Dictionary d;
for (List<StringName>::Element *E = keys.front(); E; E = E->next()) {
- d[E->get()] = _script_class_icon_paths[E->get()];
+ if (ScriptServer::is_global_class(E->get()))
+ d[E->get()] = _script_class_icon_paths[E->get()];
}
ProjectSettings::get_singleton()->set("_global_script_class_icons", d);
@@ -927,8 +951,11 @@ void EditorData::script_class_load_icon_paths() {
d.get_key_list(&keys);
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
- String key = E->get().operator String();
- _script_class_icon_paths[key] = d[key];
+ String name = E->get().operator String();
+ _script_class_icon_paths[name] = d[name];
+
+ String path = ScriptServer::get_global_class_path(name);
+ script_class_set_name(path, name);
}
}
diff --git a/editor/editor_data.h b/editor/editor_data.h
index 9f5d3e2a15..87a76ee5ba 100644
--- a/editor/editor_data.h
+++ b/editor/editor_data.h
@@ -147,6 +147,7 @@ private:
bool _find_updated_instances(Node *p_root, Node *p_node, Set<String> &checked_paths);
HashMap<StringName, String> _script_class_icon_paths;
+ HashMap<String, StringName> _script_class_file_to_path;
public:
EditorPlugin *get_editor(Object *p_object);
@@ -214,10 +215,14 @@ public:
void notify_resource_saved(const Ref<Resource> &p_resource);
bool script_class_is_parent(const String &p_class, const String &p_inherits);
- StringName script_class_get_base(const String &p_class);
+ StringName script_class_get_base(const String &p_class) const;
Object *script_class_instance(const String &p_class);
- String script_class_get_icon_path(const String &p_class) const { return _script_class_icon_paths.has(p_class) ? _script_class_icon_paths[p_class] : String(); }
- void script_class_set_icon_path(const String &p_class, const String &p_icon_path) { _script_class_icon_paths[p_class] = p_icon_path; }
+
+ StringName script_class_get_name(const String &p_path) const;
+ void script_class_set_name(const String &p_path, const StringName &p_class);
+
+ String script_class_get_icon_path(const String &p_class) const;
+ void script_class_set_icon_path(const String &p_class, const String &p_icon_path);
void script_class_clear_icon_paths() { _script_class_icon_paths.clear(); }
void script_class_save_icon_paths();
void script_class_load_icon_paths();
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 3659a06bb7..f11a30bb86 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -269,7 +269,7 @@ void EditorFileDialog::_post_popup() {
set_process_unhandled_input(true);
}
-void EditorFileDialog::_thumbnail_result(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata) {
+void EditorFileDialog::_thumbnail_result(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
if (display_mode == DISPLAY_LIST || p_preview.is_null())
return;
@@ -284,7 +284,7 @@ void EditorFileDialog::_thumbnail_result(const String &p_path, const Ref<Texture
}
}
-void EditorFileDialog::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata) {
+void EditorFileDialog::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
set_process(false);
preview_waiting = false;
@@ -1115,7 +1115,7 @@ void EditorFileDialog::_update_drives() {
void EditorFileDialog::_favorite_selected(int p_idx) {
- Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
ERR_FAIL_INDEX(p_idx, favorited.size());
dir_access->change_dir(favorited[p_idx]);
@@ -1130,7 +1130,7 @@ void EditorFileDialog::_favorite_move_up() {
int current = favorites->get_current();
if (current > 0 && current < favorites->get_item_count()) {
- Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
int a_idx = favorited.find(String(favorites->get_item_metadata(current - 1)));
int b_idx = favorited.find(String(favorites->get_item_metadata(current)));
@@ -1139,7 +1139,7 @@ void EditorFileDialog::_favorite_move_up() {
return;
SWAP(favorited.write[a_idx], favorited.write[b_idx]);
- EditorSettings::get_singleton()->set_favorite_dirs(favorited);
+ EditorSettings::get_singleton()->set_favorites(favorited);
_update_favorites();
update_file_list();
@@ -1150,7 +1150,7 @@ void EditorFileDialog::_favorite_move_down() {
int current = favorites->get_current();
if (current >= 0 && current < favorites->get_item_count() - 1) {
- Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
int a_idx = favorited.find(String(favorites->get_item_metadata(current + 1)));
int b_idx = favorited.find(String(favorites->get_item_metadata(current)));
@@ -1159,7 +1159,7 @@ void EditorFileDialog::_favorite_move_down() {
return;
SWAP(favorited.write[a_idx], favorited.write[b_idx]);
- EditorSettings::get_singleton()->set_favorite_dirs(favorited);
+ EditorSettings::get_singleton()->set_favorites(favorited);
_update_favorites();
update_file_list();
@@ -1176,7 +1176,7 @@ void EditorFileDialog::_update_favorites() {
favorite->set_pressed(false);
- Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < favorited.size(); i++) {
bool cres = favorited[i].begins_with("res://");
if (cres != res)
@@ -1206,7 +1206,7 @@ void EditorFileDialog::_favorite_toggled(bool p_toggle) {
String cd = get_current_dir();
- Vector<String> favorited = EditorSettings::get_singleton()->get_favorite_dirs();
+ Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
bool found = false;
for (int i = 0; i < favorited.size(); i++) {
@@ -1228,7 +1228,7 @@ void EditorFileDialog::_favorite_toggled(bool p_toggle) {
favorite->set_pressed(true);
}
- EditorSettings::get_singleton()->set_favorite_dirs(favorited);
+ EditorSettings::get_singleton()->set_favorites(favorited);
_update_favorites();
}
diff --git a/editor/editor_file_dialog.h b/editor/editor_file_dialog.h
index 61eeff9162..56cefb9a47 100644
--- a/editor/editor_file_dialog.h
+++ b/editor/editor_file_dialog.h
@@ -190,8 +190,8 @@ private:
void _save_to_recent();
//callback function is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load
- void _thumbnail_result(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
- void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
+ void _thumbnail_result(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata);
+ void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata);
void _request_single_thumbnail(const String &p_path);
void _unhandled_input(const Ref<InputEvent> &p_event);
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 351ca6f435..ee20d95f25 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -389,7 +389,7 @@ bool EditorFileSystem::_test_for_reimport(const String &p_path, bool p_only_impo
memdelete(f);
- // Read the md5's from a separate file (so the import parameters aren't dependant on the file version
+ // Read the md5's from a separate file (so the import parameters aren't dependent on the file version
String base_path = ResourceFormatImporter::get_singleton()->get_import_base_path(p_path);
FileAccess *md5s = FileAccess::open(base_path + ".md5", FileAccess::READ, &err);
if (!md5s) { // No md5's stored for this resource
@@ -1358,6 +1358,7 @@ void EditorFileSystem::_scan_script_classes(EditorFileSystemDirectory *p_dir) {
}
ScriptServer::add_global_class(files[i]->script_class_name, files[i]->script_class_extends, lang, p_dir->get_file_path(i));
EditorNode::get_editor_data().script_class_set_icon_path(files[i]->script_class_name, files[i]->script_class_icon_path);
+ EditorNode::get_editor_data().script_class_set_name(files[i]->file, files[i]->script_class_name);
}
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
_scan_script_classes(p_dir->get_subdir(i));
@@ -1377,7 +1378,6 @@ void EditorFileSystem::update_script_classes() {
ScriptServer::save_global_classes();
EditorNode::get_editor_data().script_class_save_icon_paths();
- emit_signal("script_classes_updated");
}
void EditorFileSystem::_queue_update_script_classes() {
@@ -1479,12 +1479,16 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
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());
+ if (cf->has_section("params")) {
+ 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());
+ }
+ }
+ if (cf->has_section("remap")) {
+ importer_name = cf->get_value("remap", "importer");
}
- importer_name = cf->get_value("remap", "importer");
}
} else {
@@ -1716,7 +1720,6 @@ void EditorFileSystem::_bind_methods() {
ADD_SIGNAL(MethodInfo("filesystem_changed"));
ADD_SIGNAL(MethodInfo("sources_changed", PropertyInfo(Variant::BOOL, "exist")));
ADD_SIGNAL(MethodInfo("resources_reimported", PropertyInfo(Variant::POOL_STRING_ARRAY, "resources")));
- ADD_SIGNAL(MethodInfo("script_classes_updated"));
}
void EditorFileSystem::_update_extensions() {
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 8d371714cf..60040f641b 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -88,10 +88,8 @@ void EditorHelpSearch::IncrementalSearch::phase1(Map<String, DocData::ClassDoc>:
TreeItem *item = search_options->create_item(root);
item->set_metadata(0, "class_name:" + E->key());
item->set_text(0, E->key() + " (Class)");
- if (search->has_icon(E->key(), "EditorIcons"))
- item->set_icon(0, search->get_icon(E->key(), "EditorIcons"));
- else
- item->set_icon(0, def_icon);
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(E->key(), "Node");
+ item->set_icon(0, icon);
}
}
@@ -99,11 +97,7 @@ void EditorHelpSearch::IncrementalSearch::phase2(Map<String, DocData::ClassDoc>:
DocData::ClassDoc &c = E->get();
- Ref<Texture> cicon;
- if (search->has_icon(E->key(), "EditorIcons"))
- cicon = search->get_icon(E->key(), "EditorIcons");
- else
- cicon = def_icon;
+ Ref<Texture> cicon = EditorNode::get_singleton()->get_class_icon(E->key(), "Node");
for (int i = 0; i < c.methods.size(); i++) {
if ((term.begins_with(".") && c.methods[i].name.begins_with(term.right(1))) || (term.ends_with("(") && c.methods[i].name.ends_with(term.left(term.length() - 1).strip_edges())) || (term.begins_with(".") && term.ends_with("(") && c.methods[i].name == term.substr(1, term.length() - 2).strip_edges()) || c.methods[i].name.findn(term) != -1) {
@@ -343,10 +337,8 @@ void EditorHelpIndex::add_type(const String &p_type, HashMap<String, TreeItem *>
item->set_tooltip(0, EditorHelp::get_doc_data()->class_list[p_type].brief_description);
item->set_text(0, p_type);
- if (has_icon(p_type, "EditorIcons")) {
-
- item->set_icon(0, get_icon(p_type, "EditorIcons"));
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(p_type);
+ item->set_icon(0, icon);
p_types[p_type] = item;
}
@@ -760,6 +752,8 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) {
}
void EditorHelp::_update_doc() {
+ if (!doc->class_list.has(edited_class))
+ return;
scroll_locked = true;
@@ -776,6 +770,7 @@ void EditorHelp::_update_doc() {
Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
String link_color_text = title_color.to_html(false);
+ // Class name
section_line.push_back(Pair<String, int>(TTR("Top"), 0));
class_desc->push_font(doc_title_font);
class_desc->push_color(title_color);
@@ -787,18 +782,18 @@ void EditorHelp::_update_doc() {
class_desc->pop();
class_desc->add_newline();
+ // Inheritance tree
+
+ // Ascendents
if (cd.inherits != "") {
class_desc->push_color(title_color);
- class_desc->push_font(doc_title_font);
+ class_desc->push_font(doc_font);
class_desc->add_text(TTR("Inherits:") + " ");
class_desc->pop();
- class_desc->pop();
String inherits = cd.inherits;
- class_desc->push_font(doc_font);
-
while (inherits != "") {
_add_type(inherits);
@@ -813,6 +808,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Descendents
if (ClassDB::class_exists(cd.name)) {
bool found = false;
@@ -824,13 +820,10 @@ void EditorHelp::_update_doc() {
if (!found) {
class_desc->push_color(title_color);
- class_desc->push_font(doc_title_font);
+ class_desc->push_font(doc_font);
class_desc->add_text(TTR("Inherited by:") + " ");
class_desc->pop();
- class_desc->pop();
-
found = true;
- class_desc->push_font(doc_font);
}
if (prev) {
@@ -853,6 +846,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
class_desc->add_newline();
+ // Brief description
if (cd.brief_description != "") {
class_desc->push_color(title_color);
@@ -874,15 +868,16 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Properties overview
Set<String> skip_methods;
bool property_descr = false;
if (cd.properties.size()) {
- section_line.push_back(Pair<String, int>(TTR("Members"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Members:"));
+ class_desc->add_text(TTR("Properties:"));
class_desc->pop();
class_desc->pop();
@@ -940,6 +935,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Methods overview
bool method_descr = false;
bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically");
@@ -956,10 +952,10 @@ void EditorHelp::_update_doc() {
if (sort_methods)
methods.sort();
- section_line.push_back(Pair<String, int>(TTR("Public Methods"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Public Methods:"));
+ class_desc->add_text(TTR("Methods:"));
class_desc->pop();
class_desc->pop();
@@ -1024,22 +1020,20 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Theme properties
if (cd.theme_properties.size()) {
- section_line.push_back(Pair<String, int>(TTR("GUI Theme Items"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Theme Properties"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("GUI Theme Items:"));
+ class_desc->add_text(TTR("Theme Properties:"));
class_desc->pop();
class_desc->pop();
- // class_desc->add_newline();
class_desc->push_indent(1);
class_desc->push_table(2);
class_desc->set_table_column_expand(1, 1);
- //class_desc->add_newline();
-
for (int i = 0; i < cd.theme_properties.size(); i++) {
theme_property_line[cd.theme_properties[i].name] = class_desc->get_line_count() - 2; //gets overridden if description
@@ -1076,6 +1070,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Signals
if (cd.signals.size()) {
if (sort_methods) {
@@ -1144,6 +1139,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Constants and enums
if (cd.constants.size()) {
Map<String, Vector<DocData::ConstantDoc> > enums;
@@ -1163,6 +1159,7 @@ void EditorHelp::_update_doc() {
}
}
+ // Enums
if (enums.size()) {
section_line.push_back(Pair<String, int>(TTR("Enumerations"), class_desc->get_line_count() - 2));
@@ -1245,6 +1242,7 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Constants
if (constants.size()) {
section_line.push_back(Pair<String, int>(TTR("Constants"), class_desc->get_line_count() - 2));
@@ -1303,13 +1301,14 @@ void EditorHelp::_update_doc() {
}
}
+ // Class description
if (cd.description != "") {
- section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Class Description"), class_desc->get_line_count() - 2));
description_line = class_desc->get_line_count() - 2;
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Description:"));
+ class_desc->add_text(TTR("Class Description:"));
class_desc->pop();
class_desc->pop();
@@ -1326,8 +1325,8 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
}
+ // Online tutorials
{
-
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
class_desc->add_text(TTR("Online Tutorials:"));
@@ -1365,12 +1364,14 @@ void EditorHelp::_update_doc() {
class_desc->add_newline();
class_desc->add_newline();
}
+
+ // Property descriptions
if (property_descr) {
- section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Property Descriptions"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Property Description:"));
+ class_desc->add_text(TTR("Property Descriptions:"));
class_desc->pop();
class_desc->pop();
@@ -1458,12 +1459,13 @@ void EditorHelp::_update_doc() {
}
}
+ // Method descriptions
if (method_descr) {
- section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_line_count() - 2));
+ section_line.push_back(Pair<String, int>(TTR("Method Descriptions"), class_desc->get_line_count() - 2));
class_desc->push_color(title_color);
class_desc->push_font(doc_title_font);
- class_desc->add_text(TTR("Method Description:"));
+ class_desc->add_text(TTR("Method Descriptions:"));
class_desc->pop();
class_desc->pop();
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 929028c499..36c3102840 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -1423,10 +1423,7 @@ void EditorInspector::update_tree() {
category_vbox = NULL; //reset
String type = p.name;
- if (has_icon(type, "EditorIcons"))
- category->icon = get_icon(type, "EditorIcons");
- else
- category->icon = get_icon("Object", "EditorIcons");
+ category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object");
category->label = type;
category->bg_color = get_color("prop_category", "Editor");
@@ -1742,7 +1739,7 @@ void EditorInspector::edit(Object *p_object) {
if (object) {
update_scroll_request = 0; //reset
if (scroll_cache.has(object->get_instance_id())) { //if exists, set something else
- update_scroll_request = scroll_cache[object->get_instance_id()]; //done this way because wait until full size is accomodated
+ update_scroll_request = scroll_cache[object->get_instance_id()]; //done this way because wait until full size is accommodated
}
object->add_change_receptor(this);
update_tree();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 7359cf598a..03746fb8b7 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -54,7 +54,6 @@
#include "editor/editor_audio_buses.h"
#include "editor/editor_file_system.h"
#include "editor/editor_help.h"
-#include "editor/editor_initialize_ssl.h"
#include "editor/editor_properties.h"
#include "editor/editor_settings.h"
#include "editor/editor_themes.h"
@@ -141,12 +140,7 @@ void EditorNode::_update_scene_tabs() {
String type = editor_data.get_scene_type(i);
Ref<Texture> icon;
if (type != String()) {
-
- if (!gui_base->has_icon(type, "EditorIcons")) {
- type = "Node";
- }
-
- icon = gui_base->get_icon(type, "EditorIcons");
+ icon = get_class_icon(type, "Node");
}
int current = editor_data.get_edited_scene();
@@ -2045,6 +2039,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
emit_signal("stop_pressed");
} break;
+
+ case FILE_SHOW_IN_FILESYSTEM: {
+ String path = editor_data.get_scene_path(editor_data.get_edited_scene());
+ if (path != String()) {
+ filesystem_dock->navigate_to_path(path);
+ }
+ } break;
+
case RUN_PLAY_SCENE: {
_save_default_environment();
@@ -3126,6 +3128,86 @@ void EditorNode::stop_child_process() {
_menu_option_confirm(RUN_STOP, false);
}
+Ref<Texture> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const {
+ ERR_FAIL_COND_V(!p_object || !gui_base, NULL);
+
+ Ref<Script> script = p_object->get_script();
+ if (script.is_null() && p_object->is_class("Script")) {
+ script = p_object;
+ }
+
+ StringName name;
+ String icon_path;
+ if (script.is_valid()) {
+ name = EditorNode::get_editor_data().script_class_get_name(script->get_path());
+ icon_path = EditorNode::get_editor_data().script_class_get_icon_path(name);
+ name = script->get_instance_base_type();
+ }
+
+ if (gui_base->has_icon(p_object->get_class(), "EditorIcons"))
+ return gui_base->get_icon(p_object->get_class(), "EditorIcons");
+
+ if (icon_path.length())
+ return ResourceLoader::load(icon_path);
+
+ if (p_object->has_meta("_editor_icon"))
+ return p_object->get_meta("_editor_icon");
+
+ if (name != StringName()) {
+ const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();
+ for (const Map<String, Vector<EditorData::CustomType> >::Element *E = p_map.front(); E; E = E->next()) {
+ const Vector<EditorData::CustomType> &ct = E->value();
+ for (int i = 0; i < ct.size(); ++i) {
+ if (ct[i].name == name && ct[i].icon.is_valid()) {
+ return ct[i].icon;
+ }
+ }
+ }
+ }
+
+ if (p_fallback.length())
+ return gui_base->get_icon(p_fallback, "EditorIcons");
+
+ return NULL;
+}
+
+Ref<Texture> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) const {
+ ERR_FAIL_COND_V(p_class.empty(), NULL);
+
+ if (gui_base->has_icon(p_class, "EditorIcons")) {
+ return gui_base->get_icon(p_class, "EditorIcons");
+ }
+
+ if (ScriptServer::is_global_class(p_class)) {
+ String icon_path = EditorNode::get_editor_data().script_class_get_icon_path(p_class);
+ RES icon;
+ if (FileAccess::exists(icon_path)) {
+ icon = ResourceLoader::load(icon_path);
+ }
+ if (!icon.is_valid()) {
+ icon = gui_base->get_icon(ScriptServer::get_global_class_base(p_class), "EditorIcons");
+ }
+ return icon;
+ }
+
+ const Map<String, Vector<EditorData::CustomType> > &p_map = EditorNode::get_editor_data().get_custom_types();
+ for (const Map<String, Vector<EditorData::CustomType> >::Element *E = p_map.front(); E; E = E->next()) {
+ const Vector<EditorData::CustomType> &ct = E->value();
+ for (int i = 0; i < ct.size(); ++i) {
+ if (ct[i].name == p_class) {
+ if (ct[i].icon.is_valid()) {
+ return ct[i].icon;
+ }
+ }
+ }
+ }
+
+ if (p_fallback.length())
+ return gui_base->get_icon(p_fallback, "EditorIcons");
+
+ return NULL;
+}
+
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
@@ -3283,19 +3365,12 @@ void EditorNode::_dock_select_input(const Ref<InputEvent> &p_input) {
dock_slot[nrect]->show();
dock_select->update();
- VSplitContainer *splits[DOCK_SLOT_MAX / 2] = {
- left_l_vsplit,
- left_r_vsplit,
- right_l_vsplit,
- right_r_vsplit,
- };
-
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < vsplits.size(); i++) {
bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
if (in_use)
- splits[i]->show();
+ vsplits[i]->show();
else
- splits[i]->hide();
+ vsplits[i]->hide();
}
if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible())
@@ -3467,30 +3542,16 @@ 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,
- right_l_vsplit,
- right_r_vsplit,
- };
+ for (int i = 0; i < vsplits.size(); i++) {
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
-
- if (splits[i]->is_visible_in_tree()) {
- p_layout->set_value(p_section, "dock_split_" + itos(i + 1), splits[i]->get_split_offset());
+ if (vsplits[i]->is_visible_in_tree()) {
+ p_layout->set_value(p_section, "dock_split_" + itos(i + 1), vsplits[i]->get_split_offset());
}
}
- HSplitContainer *h_splits[4] = {
- left_l_hsplit,
- left_r_hsplit,
- main_hsplit,
- right_hsplit,
- };
-
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < hsplits.size(); i++) {
- p_layout->set_value(p_section, "dock_hsplit_" + itos(i + 1), h_splits[i]->get_split_offset());
+ p_layout->set_value(p_section, "dock_hsplit_" + itos(i + 1), hsplits[i]->get_split_offset());
}
}
@@ -3536,21 +3597,14 @@ void EditorNode::_load_docks() {
void EditorNode::_update_dock_slots_visibility() {
- VSplitContainer *splits[DOCK_SLOT_MAX / 2] = {
- left_l_vsplit,
- left_r_vsplit,
- right_l_vsplit,
- right_r_vsplit,
- };
-
if (!docks_visible) {
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
dock_slot[i]->hide();
}
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
- splits[i]->hide();
+ for (int i = 0; i < vsplits.size(); i++) {
+ vsplits[i]->hide();
}
right_hsplit->hide();
@@ -3564,12 +3618,12 @@ void EditorNode::_update_dock_slots_visibility() {
dock_slot[i]->hide();
}
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
+ for (int i = 0; i < vsplits.size(); i++) {
bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
if (in_use)
- splits[i]->show();
+ vsplits[i]->show();
else
- splits[i]->hide();
+ vsplits[i]->hide();
}
for (int i = 0; i < DOCK_SLOT_MAX; i++) {
@@ -3589,13 +3643,7 @@ void EditorNode::_update_dock_slots_visibility() {
void EditorNode::_dock_tab_changed(int p_tab) {
- // update visibility but dont set current tab
- VSplitContainer *splits[DOCK_SLOT_MAX / 2] = {
- left_l_vsplit,
- left_r_vsplit,
- right_l_vsplit,
- right_r_vsplit,
- };
+ // update visibility but don't set current tab
if (!docks_visible) {
@@ -3603,8 +3651,8 @@ void EditorNode::_dock_tab_changed(int p_tab) {
dock_slot[i]->hide();
}
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
- splits[i]->hide();
+ for (int i = 0; i < vsplits.size(); i++) {
+ vsplits[i]->hide();
}
right_hsplit->hide();
@@ -3618,12 +3666,12 @@ void EditorNode::_dock_tab_changed(int p_tab) {
dock_slot[i]->hide();
}
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
+ for (int i = 0; i < vsplits.size(); i++) {
bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
if (in_use)
- splits[i]->show();
+ vsplits[i]->show();
else
- splits[i]->hide();
+ vsplits[i]->hide();
}
bottom_panel->show();
@@ -3682,42 +3730,28 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String
}
filesystem_dock->set_split_offset(fs_split_ofs);
- VSplitContainer *splits[DOCK_SLOT_MAX / 2] = {
- left_l_vsplit,
- left_r_vsplit,
- right_l_vsplit,
- right_r_vsplit,
- };
-
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
+ for (int i = 0; i < vsplits.size(); i++) {
if (!p_layout->has_section_key(p_section, "dock_split_" + itos(i + 1)))
continue;
int ofs = p_layout->get_value(p_section, "dock_split_" + itos(i + 1));
- splits[i]->set_split_offset(ofs);
+ vsplits[i]->set_split_offset(ofs);
}
- HSplitContainer *h_splits[4] = {
- left_l_hsplit,
- left_r_hsplit,
- main_hsplit,
- right_hsplit,
- };
-
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < hsplits.size(); i++) {
if (!p_layout->has_section_key(p_section, "dock_hsplit_" + itos(i + 1)))
continue;
int ofs = p_layout->get_value(p_section, "dock_hsplit_" + itos(i + 1));
- h_splits[i]->set_split_offset(ofs);
+ hsplits[i]->set_split_offset(ofs);
}
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++) {
+ for (int i = 0; i < vsplits.size(); i++) {
bool in_use = dock_slot[i * 2 + 0]->get_tab_count() || dock_slot[i * 2 + 1]->get_tab_count();
if (in_use)
- splits[i]->show();
+ vsplits[i]->show();
else
- splits[i]->hide();
+ vsplits[i]->hide();
}
if (right_l_vsplit->is_visible() || right_r_vsplit->is_visible())
@@ -3901,6 +3935,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_all_scenes"), FILE_SAVE_ALL_SCENES);
if (scene_tabs->get_hovered_tab() >= 0) {
scene_tabs_context_menu->add_separator();
+ scene_tabs_context_menu->add_item(TTR("Show in filesystem"), FILE_SHOW_IN_FILESYSTEM);
scene_tabs_context_menu->add_item(TTR("Play This Scene"), RUN_PLAY_SCENE);
scene_tabs_context_menu->add_item(TTR("Close Tab"), FILE_CLOSE);
}
@@ -3915,7 +3950,7 @@ void EditorNode::_reposition_active_tab(int idx_to) {
_update_scene_tabs();
}
-void EditorNode::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata) {
+void EditorNode::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
int p_tab = p_udata.operator signed int();
if (p_preview.is_valid()) {
Rect2 rect = scene_tabs->get_tab_rect(p_tab);
@@ -4607,11 +4642,10 @@ EditorNode::EditorNode() {
Physics2DServer::get_singleton()->set_active(false); // no physics by default if editor
ScriptServer::set_scripting_enabled(false); // no scripting by default if editor
- EditorHelp::generate_doc(); //before any editor classes are crated
+ EditorHelp::generate_doc(); //before any editor classes are created
SceneState::set_disable_placeholders(true);
ResourceLoader::clear_translation_remaps(); //no remaps using during editor
ResourceLoader::clear_path_remaps();
- editor_initialize_certificates(); //for asset sharing
InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
@@ -4852,9 +4886,6 @@ EditorNode::EditorNode() {
left_l_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_UL]);
dock_slot[DOCK_SLOT_LEFT_BL] = memnew(TabContainer);
left_l_vsplit->add_child(dock_slot[DOCK_SLOT_LEFT_BL]);
- left_l_vsplit->hide();
- dock_slot[DOCK_SLOT_LEFT_UL]->hide();
- dock_slot[DOCK_SLOT_LEFT_BL]->hide();
left_r_hsplit = memnew(HSplitContainer);
left_l_hsplit->add_child(left_r_hsplit);
@@ -4892,19 +4923,22 @@ EditorNode::EditorNode() {
right_r_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_UR]);
dock_slot[DOCK_SLOT_RIGHT_BR] = memnew(TabContainer);
right_r_vsplit->add_child(dock_slot[DOCK_SLOT_RIGHT_BR]);
- right_r_vsplit->hide();
- dock_slot[DOCK_SLOT_RIGHT_UR]->hide();
- dock_slot[DOCK_SLOT_RIGHT_BR]->hide();
- left_l_vsplit->connect("dragged", this, "_dock_split_dragged");
- left_r_vsplit->connect("dragged", this, "_dock_split_dragged");
- right_l_vsplit->connect("dragged", this, "_dock_split_dragged");
- right_r_vsplit->connect("dragged", this, "_dock_split_dragged");
+ // Store them for easier access
+ vsplits.push_back(left_l_vsplit);
+ vsplits.push_back(left_r_vsplit);
+ vsplits.push_back(right_l_vsplit);
+ vsplits.push_back(right_r_vsplit);
+
+ hsplits.push_back(left_l_hsplit);
+ hsplits.push_back(left_r_hsplit);
+ hsplits.push_back(main_hsplit);
+ hsplits.push_back(right_hsplit);
- left_l_hsplit->connect("dragged", this, "_dock_split_dragged");
- left_r_hsplit->connect("dragged", this, "_dock_split_dragged");
- main_hsplit->connect("dragged", this, "_dock_split_dragged");
- right_hsplit->connect("dragged", this, "_dock_split_dragged");
+ for (int i = 0; i < vsplits.size(); i++) {
+ vsplits[i]->connect("dragged", this, "_dock_split_dragged");
+ hsplits[i]->connect("dragged", this, "_dock_split_dragged");
+ }
dock_select_popup = memnew(PopupPanel);
gui_base->add_child(dock_select_popup);
@@ -5358,22 +5392,20 @@ EditorNode::EditorNode() {
play_custom_scene_button->set_shortcut(ED_SHORTCUT("editor/play_custom_scene", TTR("Play Custom Scene"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_F5));
#endif
+ // Toggle for video driver
video_driver = memnew(OptionButton);
video_driver->set_flat(true);
video_driver->set_focus_mode(Control::FOCUS_NONE);
video_driver->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
+ video_driver->connect("item_selected", this, "_video_driver_selected");
+ menu_hb->add_child(video_driver);
+
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
String current_video_driver = OS::get_singleton()->get_video_driver_name(OS::get_singleton()->get_current_video_driver());
- menu_hb->add_child(video_driver);
video_driver_current = 0;
for (int i = 0; i < video_drivers.get_slice_count(","); i++) {
String driver = video_drivers.get_slice(",", i);
- if (gui_base->has_icon(driver, "EditorIcons")) {
- video_driver->add_icon_item(gui_base->get_icon(driver, "EditorIcons"), "");
- } else {
- video_driver->add_item(driver);
- }
-
+ video_driver->add_item(driver);
video_driver->set_item_metadata(i, driver);
if (current_video_driver == driver) {
@@ -5382,7 +5414,6 @@ EditorNode::EditorNode() {
}
}
- video_driver->connect("item_selected", this, "_video_driver_selected");
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok()->set_text(TTR("Save & Restart"));
@@ -5417,63 +5448,72 @@ EditorNode::EditorNode() {
_menu_option(SETTINGS_UPDATE_SPINNER_HIDE);
}
- scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data));
- dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(scene_tree_dock);
- dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(scene_tree_dock->get_index(), TTR("Scene"));
- dock_slot[DOCK_SLOT_LEFT_BR]->hide();
+ // Instantiate and place editor docks
+ scene_tree_dock = memnew(SceneTreeDock(this, scene_root, editor_selection, editor_data));
inspector_dock = memnew(InspectorDock(this, editor_data));
- dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(inspector_dock);
- dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(inspector_dock->get_index(), TTR("Inspector"));
-
- Button *property_editable_warning;
-
import_dock = memnew(ImportDock);
- dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(import_dock);
- dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(import_dock->get_index(), TTR("Import"));
-
- bool use_single_dock_column = (OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x < 1200);
-
node_dock = memnew(NodeDock);
- if (use_single_dock_column) {
- dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(node_dock);
- dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(node_dock->get_index(), TTR("Node"));
- } else {
- dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock);
- dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(node_dock->get_index(), TTR("Node"));
- }
filesystem_dock = memnew(FileSystemDock(this));
- filesystem_dock->set_file_list_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode")));
-
- if (use_single_dock_column) {
- dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(filesystem_dock);
- dock_slot[DOCK_SLOT_RIGHT_BL]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
- left_r_vsplit->hide();
- dock_slot[DOCK_SLOT_LEFT_UR]->hide();
- dock_slot[DOCK_SLOT_LEFT_BR]->hide();
- } else {
- dock_slot[DOCK_SLOT_LEFT_UR]->add_child(filesystem_dock);
- dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
- }
+ filesystem_dock->set_file_list_display_mode(int(EditorSettings::get_singleton()->get("docks/filesystem/files_display_mode")));
filesystem_dock->connect("open", this, "open_request");
filesystem_dock->connect("instance", this, "_instance_request");
- const String docks_section = "docks";
+ // Scene: Top left
+ dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scene_tree_dock);
+ dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(scene_tree_dock->get_index(), TTR("Scene"));
+
+ // Import: Top left, behind Scene
+ dock_slot[DOCK_SLOT_LEFT_UR]->add_child(import_dock);
+ dock_slot[DOCK_SLOT_LEFT_UR]->set_tab_title(import_dock->get_index(), TTR("Import"));
+ // FileSystem: Bottom left
+ dock_slot[DOCK_SLOT_LEFT_BR]->add_child(filesystem_dock);
+ dock_slot[DOCK_SLOT_LEFT_BR]->set_tab_title(filesystem_dock->get_index(), TTR("FileSystem"));
+
+ // Inspector: Full height right
+ dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(inspector_dock);
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(inspector_dock->get_index(), TTR("Inspector"));
+
+ // Node: Full height right, behind Inspector
+ dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(node_dock);
+ dock_slot[DOCK_SLOT_RIGHT_UL]->set_tab_title(node_dock->get_index(), TTR("Node"));
+
+ // Hide unused dock slots and vsplits
+ dock_slot[DOCK_SLOT_LEFT_UL]->hide();
+ dock_slot[DOCK_SLOT_LEFT_BL]->hide();
+ dock_slot[DOCK_SLOT_RIGHT_BL]->hide();
+ dock_slot[DOCK_SLOT_RIGHT_UR]->hide();
+ dock_slot[DOCK_SLOT_RIGHT_BR]->hide();
+ left_l_vsplit->hide();
+ right_r_vsplit->hide();
+
+ // Add some offsets to left_r and main hsplits to make LEFT_R and RIGHT_L docks wider than minsize
+ left_r_hsplit->set_split_offset(40 * EDSCALE);
+ main_hsplit->set_split_offset(-40 * EDSCALE);
+
+ // Define corresponding default layout
+
+ const String docks_section = "docks";
overridden_default_layout = -1;
default_layout.instance();
- default_layout->set_value(docks_section, "dock_3", "FileSystem");
- default_layout->set_value(docks_section, "dock_5", "Scene,Import");
- default_layout->set_value(docks_section, "dock_6", "Inspector,Node");
+ // Dock numbers are based on DockSlot enum value + 1
+ default_layout->set_value(docks_section, "dock_3", "Scene,Import");
+ default_layout->set_value(docks_section, "dock_4", "FileSystem");
+ default_layout->set_value(docks_section, "dock_5", "Inspector,Node");
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++)
- default_layout->set_value(docks_section, "dock_hsplit_" + itos(i + 1), 0);
- for (int i = 0; i < DOCK_SLOT_MAX / 2; i++)
+ for (int i = 0; i < vsplits.size(); i++)
default_layout->set_value(docks_section, "dock_split_" + itos(i + 1), 0);
+ default_layout->set_value(docks_section, "dock_hsplit_1", 0);
+ default_layout->set_value(docks_section, "dock_hsplit_2", 40 * EDSCALE);
+ default_layout->set_value(docks_section, "dock_hsplit_3", -40 * EDSCALE);
+ default_layout->set_value(docks_section, "dock_hsplit_4", 0);
_update_layouts_menu();
+ // Bottom panels
+
bottom_panel = memnew(PanelContainer);
bottom_panel->add_style_override("panel", gui_base->get_stylebox("panel", "TabContainer"));
center_split->add_child(bottom_panel);
@@ -5788,7 +5828,7 @@ EditorNode::EditorNode() {
#else
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_F1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_F2);
- ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack neded for script editor F3 search to work :) Assign like this or don't use F3
+ ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_F3); //hack needed for script editor F3 search to work :) Assign like this or don't use F3
ED_SHORTCUT("editor/editor_help", TTR("Search Help"), KEY_F4);
#endif
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"));
@@ -5858,17 +5898,31 @@ bool EditorPluginList::forward_spatial_gui_input(Camera *p_camera, const Ref<Inp
return discard;
}
-void EditorPluginList::forward_draw_over_viewport(Control *p_overlay) {
+void EditorPluginList::forward_canvas_draw_over_viewport(Control *p_overlay) {
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->forward_canvas_draw_over_viewport(p_overlay);
+ }
+}
+
+void EditorPluginList::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->forward_canvas_force_draw_over_viewport(p_overlay);
+ }
+}
+
+void EditorPluginList::forward_spatial_draw_over_viewport(Control *p_overlay) {
for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->forward_draw_over_viewport(p_overlay);
+ plugins_list[i]->forward_spatial_draw_over_viewport(p_overlay);
}
}
-void EditorPluginList::forward_force_draw_over_viewport(Control *p_overlay) {
+void EditorPluginList::forward_spatial_force_draw_over_viewport(Control *p_overlay) {
for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->forward_force_draw_over_viewport(p_overlay);
+ plugins_list[i]->forward_spatial_force_draw_over_viewport(p_overlay);
}
}
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 5a17ab6ca0..bdbe0a245b 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -125,6 +125,7 @@ private:
FILE_SAVE_ALL_SCENES,
FILE_SAVE_BEFORE_RUN,
FILE_SAVE_AND_RUN,
+ FILE_SHOW_IN_FILESYSTEM,
FILE_IMPORT_SUBSCENE,
FILE_EXPORT_PROJECT,
FILE_EXPORT_MESH_LIBRARY,
@@ -208,7 +209,7 @@ private:
String video_driver_request;
void _video_driver_selected(int);
- //split
+ // Split containers
HSplitContainer *left_l_hsplit;
VSplitContainer *left_l_vsplit;
@@ -221,7 +222,11 @@ private:
VSplitContainer *center_split;
- //main tabs
+ // To access those easily by index
+ Vector<VSplitContainer *> vsplits;
+ Vector<HSplitContainer *> hsplits;
+
+ // Main tabs
Tabs *scene_tabs;
PopupMenu *scene_tabs_context_menu;
@@ -535,7 +540,7 @@ private:
void _scene_tab_exit();
void _scene_tab_input(const Ref<InputEvent> &p_input);
void _reposition_active_tab(int idx_to);
- void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
+ void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata);
void _scene_tab_script_edited(int p_tab);
Dictionary _get_main_scene_state();
@@ -706,6 +711,8 @@ public:
void stop_child_process();
Ref<Theme> get_editor_theme() const { return theme; }
+ Ref<Texture> get_object_icon(const Object *p_object, const String &p_fallback = "Object") const;
+ Ref<Texture> get_class_icon(const String &p_class, const String &p_fallback = "Object") const;
void show_accept(const String &p_text, const String &p_title);
void show_warning(const String &p_text, const String &p_title = "Warning!");
@@ -810,9 +817,11 @@ public:
void make_visible(bool p_visible);
void edit(Object *p_object);
bool forward_gui_input(const Ref<InputEvent> &p_event);
+ void forward_canvas_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_force_draw_over_viewport(Control *p_overlay);
bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event, bool serve_when_force_input_enabled);
- void forward_draw_over_viewport(Control *p_overlay);
- void forward_force_draw_over_viewport(Control *p_overlay);
+ void forward_spatial_draw_over_viewport(Control *p_overlay);
+ void forward_spatial_force_draw_over_viewport(Control *p_overlay);
void add_plugin(EditorPlugin *p_plugin);
void clear();
bool empty();
diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp
index 9506a0e951..0eff1fd7dd 100644
--- a/editor/editor_path.cpp
+++ b/editor/editor_path.cpp
@@ -54,12 +54,7 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {
if (!obj)
continue;
- Ref<Texture> icon;
-
- if (has_icon(obj->get_class(), "EditorIcons"))
- icon = get_icon(obj->get_class(), "EditorIcons");
- else
- icon = get_icon("Object", "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);
int index = popup->get_item_count();
popup->add_icon_item(icon, E->get().name.capitalize(), objects.size());
@@ -122,12 +117,7 @@ void EditorPath::_notification(int p_what) {
String type = obj->get_class();
- Ref<Texture> icon;
-
- if (has_icon(obj->get_class(), "EditorIcons"))
- icon = get_icon(obj->get_class(), "EditorIcons");
- else
- icon = get_icon("Object", "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);
icon->draw(ci, Point2i(ofs, (size.height - icon->get_height()) / 2));
diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp
index 1f2e73654c..1ad23963a9 100644
--- a/editor/editor_plugin.cpp
+++ b/editor/editor_plugin.cpp
@@ -503,17 +503,17 @@ bool EditorPlugin::forward_canvas_gui_input(const Ref<InputEvent> &p_event) {
return false;
}
-void EditorPlugin::forward_draw_over_viewport(Control *p_overlay) {
+void EditorPlugin::forward_canvas_draw_over_viewport(Control *p_overlay) {
- if (get_script_instance() && get_script_instance()->has_method("forward_draw_over_viewport")) {
- get_script_instance()->call("forward_draw_over_viewport", p_overlay);
+ if (get_script_instance() && get_script_instance()->has_method("forward_canvas_draw_over_viewport")) {
+ get_script_instance()->call("forward_canvas_draw_over_viewport", p_overlay);
}
}
-void EditorPlugin::forward_force_draw_over_viewport(Control *p_overlay) {
+void EditorPlugin::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
- if (get_script_instance() && get_script_instance()->has_method("forward_force_draw_over_viewport")) {
- get_script_instance()->call("forward_force_draw_over_viewport", p_overlay);
+ if (get_script_instance() && get_script_instance()->has_method("forward_canvas_force_draw_over_viewport")) {
+ get_script_instance()->call("forward_canvas_force_draw_over_viewport", p_overlay);
}
}
@@ -545,6 +545,20 @@ bool EditorPlugin::forward_spatial_gui_input(Camera *p_camera, const Ref<InputEv
return false;
}
+
+void EditorPlugin::forward_spatial_draw_over_viewport(Control *p_overlay) {
+
+ if (get_script_instance() && get_script_instance()->has_method("forward_spatial_draw_over_viewport")) {
+ get_script_instance()->call("forward_spatial_draw_over_viewport", p_overlay);
+ }
+}
+
+void EditorPlugin::forward_spatial_force_draw_over_viewport(Control *p_overlay) {
+
+ if (get_script_instance() && get_script_instance()->has_method("forward_spatial_force_draw_over_viewport")) {
+ get_script_instance()->call("forward_spatial_force_draw_over_viewport", p_overlay);
+ }
+}
String EditorPlugin::get_name() const {
if (get_script_instance() && get_script_instance()->has_method("get_plugin_name")) {
@@ -769,8 +783,8 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_script_create_dialog"), &EditorPlugin::get_script_create_dialog);
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_canvas_gui_input", PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo("forward_canvas_force_draw_over_viewport", PropertyInfo(Variant::OBJECT, "overlay", PROPERTY_HINT_RESOURCE_TYPE, "Control")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "forward_spatial_gui_input", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent")));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::STRING, "get_plugin_name"));
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::OBJECT, "get_plugin_icon"));
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index 6c385abf9b..e03aeb5d30 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -174,9 +174,13 @@ public:
void notify_resource_saved(const Ref<Resource> &p_resource);
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
- virtual void forward_draw_over_viewport(Control *p_overlay);
- virtual void forward_force_draw_over_viewport(Control *p_overlay);
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay);
+ virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay);
+
virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref<InputEvent> &p_event);
+ virtual void forward_spatial_draw_over_viewport(Control *p_overlay);
+ virtual void forward_spatial_force_draw_over_viewport(Control *p_overlay);
+
virtual String get_name() const;
virtual const Ref<Texture> get_icon() const;
virtual bool has_main_screen() const;
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp
index ef0b61e882..30027c0c34 100644
--- a/editor/editor_plugin_settings.cpp
+++ b/editor/editor_plugin_settings.cpp
@@ -117,7 +117,7 @@ void EditorPluginSettings::update_plugins() {
TreeItem *item = plugin_list->create_item(root);
item->set_text(0, name);
- item->set_tooltip(0, "Name: " + name + "\nPath: " + path + "\nMain Script: " + script);
+ item->set_tooltip(0, "Name: " + name + "\nPath: " + path + "\nMain Script: " + script + "\nDescription: " + description);
item->set_metadata(0, d);
item->set_text(1, version);
item->set_metadata(1, script);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 069b9147ce..3439133809 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -846,18 +846,11 @@ void EditorPropertyObjectID::update_property() {
if (type == "")
type = "Object";
- String icon_type = type;
- if (has_icon(icon_type, "EditorIcons")) {
- type = icon_type;
- } else {
- type = "Object";
- }
-
ObjectID id = get_edited_object()->get(get_edited_property());
if (id != 0) {
edit->set_text(type + " ID: " + itos(id));
edit->set_disabled(false);
- edit->set_icon(get_icon(icon_type, "EditorIcons"));
+ edit->set_icon(EditorNode::get_singleton()->get_class_icon(type));
} else {
edit->set_text(TTR("[Empty]"));
edit->set_disabled(true);
@@ -1858,14 +1851,7 @@ void EditorPropertyNodePath::update_property() {
ERR_FAIL_COND(!target_node);
assign->set_text(target_node->get_name());
-
- Ref<Texture> icon;
- if (has_icon(target_node->get_class(), "EditorIcons"))
- icon = get_icon(target_node->get_class(), "EditorIcons");
- else
- icon = get_icon("Node", "EditorIcons");
-
- assign->set_icon(icon);
+ assign->set_icon(EditorNode::get_singleton()->get_object_icon(target_node, "Node"));
}
void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types) {
@@ -1905,7 +1891,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() {
clear->connect("pressed", this, "_node_clear");
hbc->add_child(clear);
- scene_tree = NULL; //do not allocate unnecesarily
+ scene_tree = NULL; //do not allocate unnecessarily
}
////////////// RESOURCE //////////////////////
@@ -2363,13 +2349,7 @@ void EditorPropertyResource::update_property() {
assign->set_text(TTR("[empty]"));
} else {
- Ref<Texture> icon;
- if (has_icon(res->get_class(), "EditorIcons"))
- icon = get_icon(res->get_class(), "EditorIcons");
- else
- icon = get_icon("Node", "EditorIcons");
-
- assign->set_icon(icon);
+ assign->set_icon(EditorNode::get_singleton()->get_object_icon(res.operator->(), "Node"));
if (res->get_name() != String()) {
assign->set_text(res->get_name());
@@ -2670,7 +2650,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
case PROPERTY_HINT_LAYERS_3D_PHYSICS:
lt = EditorPropertyLayers::LAYER_PHYSICS_3D;
break;
- default: {} //compiler could be smarter here and realize this cant happen
+ default: {} //compiler could be smarter here and realize this can't happen
}
EditorPropertyLayers *editor = memnew(EditorPropertyLayers);
editor->setup(lt);
@@ -2687,7 +2667,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
bool greater = true, lesser = true;
if (p_hint == PROPERTY_HINT_RANGE && p_hint_text.get_slice_count(",") >= 2) {
- greater = false; //if using ranged, asume false by default
+ greater = false; //if using ranged, assume false by default
lesser = false;
min = p_hint_text.get_slice(",", 0).to_int();
max = p_hint_text.get_slice(",", 1).to_int();
@@ -2735,7 +2715,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
bool greater = true, lesser = true;
if ((p_hint == PROPERTY_HINT_RANGE || p_hint == PROPERTY_HINT_EXP_RANGE) && p_hint_text.get_slice_count(",") >= 2) {
- greater = false; //if using ranged, asume false by default
+ greater = false; //if using ranged, assume false by default
lesser = false;
min = p_hint_text.get_slice(",", 0).to_double();
max = p_hint_text.get_slice(",", 1).to_double();
@@ -3068,7 +3048,7 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
default: {}
}
- return false; //can be overriden, although it will most likely be last anyway
+ return false; //can be overridden, although it will most likely be last anyway
}
void EditorInspectorDefaultPlugin::parse_end() {
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 9982a31b7b..808a8ac2f8 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -336,16 +336,16 @@ void EditorPropertyArray::update_property() {
} break;
case Variant::INT: {
- EditorPropertyInteger *ed = memnew(EditorPropertyInteger);
- ed->setup(-100000, 100000, true, true);
- prop = ed;
+ EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
+ editor->setup(-100000, 100000, true, true);
+ prop = editor;
} break;
case Variant::REAL: {
- EditorPropertyFloat *ed = memnew(EditorPropertyFloat);
- ed->setup(-100000, 100000, 0.001, true, false, true, true);
- prop = ed;
+ EditorPropertyFloat *editor = memnew(EditorPropertyFloat);
+ editor->setup(-100000, 100000, 0.001, true, false, true, true);
+ prop = editor;
} break;
case Variant::STRING: {
@@ -357,63 +357,63 @@ void EditorPropertyArray::update_property() {
case Variant::VECTOR2: {
- EditorPropertyVector2 *ed = memnew(EditorPropertyVector2);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyVector2 *editor = memnew(EditorPropertyVector2);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::RECT2: {
- EditorPropertyRect2 *ed = memnew(EditorPropertyRect2);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyRect2 *editor = memnew(EditorPropertyRect2);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::VECTOR3: {
- EditorPropertyVector3 *ed = memnew(EditorPropertyVector3);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyVector3 *editor = memnew(EditorPropertyVector3);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::TRANSFORM2D: {
- EditorPropertyTransform2D *ed = memnew(EditorPropertyTransform2D);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::PLANE: {
- EditorPropertyPlane *ed = memnew(EditorPropertyPlane);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyPlane *editor = memnew(EditorPropertyPlane);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::QUAT: {
- EditorPropertyQuat *ed = memnew(EditorPropertyQuat);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyQuat *editor = memnew(EditorPropertyQuat);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::AABB: {
- EditorPropertyAABB *ed = memnew(EditorPropertyAABB);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyAABB *editor = memnew(EditorPropertyAABB);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::BASIS: {
- EditorPropertyBasis *ed = memnew(EditorPropertyBasis);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyBasis *editor = memnew(EditorPropertyBasis);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::TRANSFORM: {
- EditorPropertyTransform *ed = memnew(EditorPropertyTransform);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyTransform *editor = memnew(EditorPropertyTransform);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
@@ -431,8 +431,9 @@ void EditorPropertyArray::update_property() {
} break;
case Variant::OBJECT: {
-
- prop = memnew(EditorPropertyResource);
+ EditorPropertyResource *editor = memnew(EditorPropertyResource);
+ editor->setup("Resource");
+ prop = editor;
} break;
case Variant::DICTIONARY: {
@@ -798,16 +799,16 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::INT: {
- EditorPropertyInteger *ed = memnew(EditorPropertyInteger);
- ed->setup(-100000, 100000, true, true);
- prop = ed;
+ EditorPropertyInteger *editor = memnew(EditorPropertyInteger);
+ editor->setup(-100000, 100000, true, true);
+ prop = editor;
} break;
case Variant::REAL: {
- EditorPropertyFloat *ed = memnew(EditorPropertyFloat);
- ed->setup(-100000, 100000, 0.001, true, false, true, true);
- prop = ed;
+ EditorPropertyFloat *editor = memnew(EditorPropertyFloat);
+ editor->setup(-100000, 100000, 0.001, true, false, true, true);
+ prop = editor;
} break;
case Variant::STRING: {
@@ -815,67 +816,66 @@ void EditorPropertyDictionary::update_property() {
} break;
- // math types
-
+ // math types
case Variant::VECTOR2: {
- EditorPropertyVector2 *ed = memnew(EditorPropertyVector2);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyVector2 *editor = memnew(EditorPropertyVector2);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::RECT2: {
- EditorPropertyRect2 *ed = memnew(EditorPropertyRect2);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyRect2 *editor = memnew(EditorPropertyRect2);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::VECTOR3: {
- EditorPropertyVector3 *ed = memnew(EditorPropertyVector3);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyVector3 *editor = memnew(EditorPropertyVector3);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::TRANSFORM2D: {
- EditorPropertyTransform2D *ed = memnew(EditorPropertyTransform2D);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyTransform2D *editor = memnew(EditorPropertyTransform2D);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::PLANE: {
- EditorPropertyPlane *ed = memnew(EditorPropertyPlane);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyPlane *editor = memnew(EditorPropertyPlane);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::QUAT: {
- EditorPropertyQuat *ed = memnew(EditorPropertyQuat);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyQuat *editor = memnew(EditorPropertyQuat);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::AABB: {
- EditorPropertyAABB *ed = memnew(EditorPropertyAABB);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyAABB *editor = memnew(EditorPropertyAABB);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::BASIS: {
- EditorPropertyBasis *ed = memnew(EditorPropertyBasis);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyBasis *editor = memnew(EditorPropertyBasis);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
case Variant::TRANSFORM: {
- EditorPropertyTransform *ed = memnew(EditorPropertyTransform);
- ed->setup(-100000, 100000, 0.001, true);
- prop = ed;
+ EditorPropertyTransform *editor = memnew(EditorPropertyTransform);
+ editor->setup(-100000, 100000, 0.001, true);
+ prop = editor;
} break;
@@ -893,8 +893,9 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::OBJECT: {
-
- prop = memnew(EditorPropertyResource);
+ EditorPropertyResource *editor = memnew(EditorPropertyResource);
+ editor->setup("Resource");
+ prop = editor;
} break;
case Variant::DICTIONARY: {
@@ -902,39 +903,53 @@ void EditorPropertyDictionary::update_property() {
} break;
case Variant::ARRAY: {
-
- prop = memnew(EditorPropertyArray);
-
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::ARRAY);
+ prop = editor;
} break;
// arrays
case Variant::POOL_BYTE_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_BYTE_ARRAY);
+ prop = editor;
} break;
case Variant::POOL_INT_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_INT_ARRAY);
+ prop = editor;
} break;
case Variant::POOL_REAL_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_REAL_ARRAY);
+ prop = editor;
} break;
case Variant::POOL_STRING_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_STRING_ARRAY);
+ prop = editor;
} break;
case Variant::POOL_VECTOR2_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR2_ARRAY);
+ prop = editor;
} break;
case Variant::POOL_VECTOR3_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_VECTOR3_ARRAY);
+ prop = editor;
} break;
case Variant::POOL_COLOR_ARRAY: {
- prop = memnew(EditorPropertyArray);
+ EditorPropertyArray *editor = memnew(EditorPropertyArray);
+ editor->setup(Variant::POOL_COLOR_ARRAY);
+ prop = editor;
} break;
default: {}
}
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index edfee595ea..310c3b3a52 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -30,11 +30,14 @@
#include "editor_resource_preview.h"
+#include "core/method_bind_ext.gen.inc"
+
#include "core/io/resource_loader.h"
#include "core/io/resource_saver.h"
#include "core/message_queue.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
+#include "editor_node.h"
#include "editor_scale.h"
#include "editor_settings.h"
@@ -46,32 +49,37 @@ bool EditorResourcePreviewGenerator::handles(const String &p_type) const {
ERR_EXPLAIN("EditorResourcePreviewGenerator::handles needs to be overridden");
ERR_FAIL_V(false);
}
-Ref<Texture> EditorResourcePreviewGenerator::generate(const RES &p_from) const {
+
+Ref<Texture> EditorResourcePreviewGenerator::generate(const RES &p_from, const Size2 p_size) const {
if (get_script_instance() && get_script_instance()->has_method("generate")) {
- return get_script_instance()->call("generate", p_from);
+ return get_script_instance()->call("generate", p_from, p_size);
}
ERR_EXPLAIN("EditorResourcePreviewGenerator::generate needs to be overridden");
ERR_FAIL_V(Ref<Texture>());
}
-Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String &p_path) const {
+Ref<Texture> EditorResourcePreviewGenerator::generate_from_path(const String &p_path, const Size2 p_size) const {
if (get_script_instance() && get_script_instance()->has_method("generate_from_path")) {
- return get_script_instance()->call("generate_from_path", p_path);
+ return get_script_instance()->call("generate_from_path", p_path, p_size);
}
RES res = ResourceLoader::load(p_path);
if (!res.is_valid())
return res;
- return generate(res);
+ return generate(res, p_size);
+}
+
+bool EditorResourcePreviewGenerator::should_generate_small_preview() const {
+ return false;
}
void EditorResourcePreviewGenerator::_bind_methods() {
ClassDB::add_virtual_method(get_class_static(), MethodInfo(Variant::BOOL, "handles", PropertyInfo(Variant::STRING, "type")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource")));
- ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE)));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate", PropertyInfo(Variant::OBJECT, "from", PROPERTY_HINT_RESOURCE_TYPE, "Resource"), PropertyInfo(Variant::VECTOR2, "size")));
+ ClassDB::add_virtual_method(get_class_static(), MethodInfo(CLASS_INFO(Texture), "generate_from_path", PropertyInfo(Variant::STRING, "path", PROPERTY_HINT_FILE), PropertyInfo(Variant::VECTOR2, "size")));
}
EditorResourcePreviewGenerator::EditorResourcePreviewGenerator() {
@@ -85,7 +93,7 @@ void EditorResourcePreview::_thread_func(void *ud) {
erp->_thread();
}
-void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Texture> &p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud) {
+void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Texture> &p_texture, const Ref<Texture> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud) {
preview_mutex->lock();
@@ -103,6 +111,7 @@ void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Textur
Item item;
item.order = order++;
item.preview = p_texture;
+ item.small_preview = p_small_texture;
item.last_hash = hash;
item.modified_time = modified_time;
@@ -110,11 +119,10 @@ void EditorResourcePreview::_preview_ready(const String &p_str, const Ref<Textur
preview_mutex->unlock();
- MessageQueue::get_singleton()->push_call(id, p_func, path, p_texture, p_ud);
+ MessageQueue::get_singleton()->push_call(id, p_func, path, p_texture, p_small_texture, p_ud);
}
-Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, const String &cache_base) {
-
+void EditorResourcePreview::_generate_preview(Ref<ImageTexture> &r_texture, Ref<ImageTexture> &r_small_texture, const QueueItem &p_item, const String &cache_base) {
String type;
if (p_item.resource.is_valid())
@@ -122,40 +130,59 @@ Ref<Texture> EditorResourcePreview::_generate_preview(const QueueItem &p_item, c
else
type = ResourceLoader::get_resource_type(p_item.path);
- if (type == "")
- return Ref<Texture>(); //could not guess type
+ if (type == "") {
+ r_texture = Ref<ImageTexture>();
+ r_small_texture = Ref<ImageTexture>();
+ return; //could not guess type
+ }
- Ref<Texture> generated;
+ int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
+ thumbnail_size *= EDSCALE;
- for (int i = 0; i < preview_generators.size(); i++) {
+ r_texture = Ref<ImageTexture>();
+ r_small_texture = Ref<ImageTexture>();
+ for (int i = 0; i < preview_generators.size(); i++) {
if (!preview_generators[i]->handles(type))
continue;
+
+ Ref<Texture> generated;
if (p_item.resource.is_valid()) {
- generated = preview_generators[i]->generate(p_item.resource);
+ generated = preview_generators[i]->generate(p_item.resource, Vector2(thumbnail_size, thumbnail_size));
} else {
- generated = preview_generators[i]->generate_from_path(p_item.path);
+ generated = preview_generators[i]->generate_from_path(p_item.path, Vector2(thumbnail_size, thumbnail_size));
}
+ r_texture = generated;
+ if (r_texture.is_valid() && preview_generators[i]->should_generate_small_preview()) {
+ int small_thumbnail_size = EditorNode::get_singleton()->get_theme_base()->get_icon("Object", "EditorIcons")->get_width(); // Kind of a workaround to retreive the default icon size
+ small_thumbnail_size *= EDSCALE;
+
+ Ref<Image> small_image = r_texture->get_data();
+ small_image->resize(small_thumbnail_size, small_thumbnail_size, Image::INTERPOLATE_CUBIC);
+ r_small_texture.instance();
+ r_small_texture->create_from_image(small_image);
+ }
break;
}
if (!p_item.resource.is_valid()) {
// cache the preview in case it's a resource on disk
- if (generated.is_valid()) {
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
+ if (r_texture.is_valid()) {
//wow it generated a preview... save cache
- ResourceSaver::save(cache_base + ".png", generated);
+ bool has_small_texture = r_small_texture.is_valid();
+ ResourceSaver::save(cache_base + ".png", r_texture);
+ if (has_small_texture) {
+ ResourceSaver::save(cache_base + "_small.png", r_small_texture);
+ }
FileAccess *f = FileAccess::open(cache_base + ".txt", FileAccess::WRITE);
f->store_line(itos(thumbnail_size));
+ f->store_line(itos(has_small_texture));
f->store_line(itos(FileAccess::get_modified_time(p_item.path)));
f->store_line(FileAccess::get_md5(p_item.path));
memdelete(f);
}
}
-
- return generated;
}
void EditorResourcePreview::_thread() {
@@ -177,7 +204,7 @@ void EditorResourcePreview::_thread() {
path += ":" + itos(cache[item.path].last_hash); //keep last hash (see description of what this is in condition below)
}
- _preview_ready(path, cache[item.path].preview, item.id, item.function, item.userdata);
+ _preview_ready(path, cache[item.path].preview, cache[item.path].small_preview, item.id, item.function, item.userdata);
preview_mutex->unlock();
} else {
@@ -185,15 +212,17 @@ void EditorResourcePreview::_thread() {
preview_mutex->unlock();
Ref<ImageTexture> texture;
+ Ref<ImageTexture> small_texture;
int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
thumbnail_size *= EDSCALE;
if (item.resource.is_valid()) {
- texture = _generate_preview(item, String());
+ _generate_preview(texture, small_texture, item, String());
+
//adding hash to the end of path (should be ID:<objid>:<hash>) because of 5 argument limit to call_deferred
- _preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, item.id, item.function, item.userdata);
+ _preview_ready(item.path + ":" + itos(item.resource->hash_edited_version()), texture, small_texture, item.id, item.function, item.userdata);
} else {
@@ -207,12 +236,13 @@ void EditorResourcePreview::_thread() {
FileAccess *f = FileAccess::open(file, FileAccess::READ);
if (!f) {
- //generate
- texture = _generate_preview(item, cache_base);
+ // No cache found, generate
+ _generate_preview(texture, small_texture, item, cache_base);
} else {
uint64_t modtime = FileAccess::get_modified_time(item.path);
int tsize = f->get_line().to_int64();
+ bool has_small_texture = f->get_line().to_int();
uint64_t last_modtime = f->get_line().to_int64();
bool cache_valid = true;
@@ -236,6 +266,7 @@ void EditorResourcePreview::_thread() {
f = FileAccess::open(file, FileAccess::WRITE);
f->store_line(itos(modtime));
+ f->store_line(itos(has_small_texture));
f->store_line(md5);
memdelete(f);
}
@@ -243,12 +274,12 @@ void EditorResourcePreview::_thread() {
memdelete(f);
}
- //cache_valid = false;
-
if (cache_valid) {
Ref<Image> img;
img.instance();
+ Ref<Image> small_img;
+ small_img.instance();
if (img->load(cache_base + ".png") != OK) {
cache_valid = false;
@@ -256,16 +287,24 @@ void EditorResourcePreview::_thread() {
texture.instance();
texture->create_from_image(img, Texture::FLAG_FILTER);
+
+ if (has_small_texture) {
+ if (small_img->load(cache_base + "_small.png") != OK) {
+ cache_valid = false;
+ } else {
+ small_texture.instance();
+ small_texture->create_from_image(small_img, Texture::FLAG_FILTER);
+ }
+ }
}
}
if (!cache_valid) {
- texture = _generate_preview(item, cache_base);
+ _generate_preview(texture, small_texture, item, cache_base);
}
}
-
- _preview_ready(item.path, texture, item.id, item.function, item.userdata);
+ _preview_ready(item.path, texture, small_texture, item.id, item.function, item.userdata);
}
}
@@ -287,7 +326,7 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource> &p
if (cache.has(path_id) && cache[path_id].last_hash == p_res->hash_edited_version()) {
cache[path_id].order = order++;
- p_receiver->call_deferred(p_receiver_func, path_id, cache[path_id].preview, p_userdata);
+ p_receiver->call_deferred(p_receiver_func, path_id, cache[path_id].preview, cache[path_id].small_preview, p_userdata);
preview_mutex->unlock();
return;
}
@@ -312,7 +351,7 @@ void EditorResourcePreview::queue_resource_preview(const String &p_path, Object
preview_mutex->lock();
if (cache.has(p_path)) {
cache[p_path].order = order++;
- p_receiver->call_deferred(p_receiver_func, p_path, cache[p_path].preview, p_userdata);
+ p_receiver->call_deferred(p_receiver_func, p_path, cache[p_path].preview, cache[p_path].small_preview, p_userdata);
preview_mutex->unlock();
return;
}
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 434b26e901..a3417cdf60 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -63,8 +63,10 @@ protected:
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
- virtual Ref<Texture> generate_from_path(const String &p_path) const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
+ virtual Ref<Texture> generate_from_path(const String &p_path, const Size2 p_size) const;
+
+ virtual bool should_generate_small_preview() const;
EditorResourcePreviewGenerator();
};
@@ -92,6 +94,7 @@ class EditorResourcePreview : public Node {
struct Item {
Ref<Texture> preview;
+ Ref<Texture> small_preview;
int order;
uint32_t last_hash;
uint64_t modified_time;
@@ -101,8 +104,8 @@ class EditorResourcePreview : public Node {
Map<String, Item> cache;
- void _preview_ready(const String &p_str, const Ref<Texture> &p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
- Ref<Texture> _generate_preview(const QueueItem &p_item, const String &cache_base);
+ void _preview_ready(const String &p_str, const Ref<Texture> &p_texture, const Ref<Texture> &p_small_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
+ void _generate_preview(Ref<ImageTexture> &r_texture, Ref<ImageTexture> &r_small_texture, const QueueItem &p_item, const String &cache_base);
static void _thread_func(void *ud);
void _thread();
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 5d3c6dd087..f778c733d8 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -30,6 +30,7 @@
#include "editor_settings.h"
+#include "core/io/certs_compressed.gen.h"
#include "core/io/compression.h"
#include "core/io/config_file.h"
#include "core/io/file_access_memory.h"
@@ -510,17 +511,17 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("filesystem/file_dialog/show_hidden_files", false);
_initial_set("filesystem/file_dialog/display_mode", 0);
hints["filesystem/file_dialog/display_mode"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+
_initial_set("filesystem/file_dialog/thumbnail_size", 64);
hints["filesystem/file_dialog/thumbnail_size"] = PropertyInfo(Variant::INT, "filesystem/file_dialog/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
- _initial_set("docks/filesystem/disable_split", false);
- _initial_set("docks/filesystem/split_mode_minimum_height", 600);
_initial_set("docks/filesystem/display_mode", 0);
- hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+ hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Tree only, Split");
+ _initial_set("docks/filesystem/split_mode_minimum_height", 600);
_initial_set("docks/filesystem/thumbnail_size", 64);
hints["docks/filesystem/thumbnail_size"] = PropertyInfo(Variant::INT, "docks/filesystem/thumbnail_size", PROPERTY_HINT_RANGE, "32,128,16");
- _initial_set("docks/filesystem/display_mode", 0);
- hints["docks/filesystem/display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
+ _initial_set("docks/filesystem/files_display_mode", 0);
+ hints["docks/filesystem/files_display_mode"] = PropertyInfo(Variant::INT, "docks/filesystem/files_display_mode", PROPERTY_HINT_ENUM, "Thumbnails,List");
_initial_set("docks/filesystem/always_show_folders", true);
_initial_set("editors/animation/autorename_animation_tracks", true);
@@ -947,6 +948,10 @@ void EditorSettings::setup_network() {
_initial_set("network/debug/remote_port", port);
add_property_hint(PropertyInfo(Variant::INT, "network/debug/remote_port", PROPERTY_HINT_RANGE, "1,65535,1"));
+
+ // Editor SSL certificates override
+ _initial_set("network/ssl/editor_ssl_certificates", _SYSTEM_CERTS_PATH);
+ add_property_hint(PropertyInfo(Variant::STRING, "network/ssl/editor_ssl_certificates", PROPERTY_HINT_GLOBAL_FILE, "*.crt,*.pem"));
}
void EditorSettings::save() {
@@ -1147,20 +1152,20 @@ Variant EditorSettings::get_project_metadata(const String &p_section, const Stri
return cf->get_value(p_section, p_key, p_default);
}
-void EditorSettings::set_favorite_dirs(const Vector<String> &p_favorites_dirs) {
+void EditorSettings::set_favorites(const Vector<String> &p_favorites) {
- favorite_dirs = p_favorites_dirs;
- FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorite_dirs"), FileAccess::WRITE);
+ favorites = p_favorites;
+ FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::WRITE);
if (f) {
- for (int i = 0; i < favorite_dirs.size(); i++)
- f->store_line(favorite_dirs[i]);
+ for (int i = 0; i < favorites.size(); i++)
+ f->store_line(favorites[i]);
memdelete(f);
}
}
-Vector<String> EditorSettings::get_favorite_dirs() const {
+Vector<String> EditorSettings::get_favorites() const {
- return favorite_dirs;
+ return favorites;
}
void EditorSettings::set_recent_dirs(const Vector<String> &p_recent_dirs) {
@@ -1181,11 +1186,11 @@ Vector<String> EditorSettings::get_recent_dirs() const {
void EditorSettings::load_favorites() {
- FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorite_dirs"), FileAccess::READ);
+ FileAccess *f = FileAccess::open(get_project_settings_dir().plus_file("favorites"), FileAccess::READ);
if (f) {
String line = f->get_line().strip_edges();
while (line != "") {
- favorite_dirs.push_back(line);
+ favorites.push_back(line);
line = f->get_line().strip_edges();
}
memdelete(f);
@@ -1466,8 +1471,8 @@ void EditorSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_project_metadata", "section", "key", "data"), &EditorSettings::set_project_metadata);
ClassDB::bind_method(D_METHOD("get_project_metadata", "section", "key", "default"), &EditorSettings::get_project_metadata, DEFVAL(Variant()));
- ClassDB::bind_method(D_METHOD("set_favorite_dirs", "dirs"), &EditorSettings::set_favorite_dirs);
- ClassDB::bind_method(D_METHOD("get_favorite_dirs"), &EditorSettings::get_favorite_dirs);
+ ClassDB::bind_method(D_METHOD("set_favorites", "dirs"), &EditorSettings::set_favorites);
+ ClassDB::bind_method(D_METHOD("get_favorites"), &EditorSettings::get_favorites);
ClassDB::bind_method(D_METHOD("set_recent_dirs", "dirs"), &EditorSettings::set_recent_dirs);
ClassDB::bind_method(D_METHOD("get_recent_dirs"), &EditorSettings::get_recent_dirs);
diff --git a/editor/editor_settings.h b/editor/editor_settings.h
index 8165c36e67..7b0de9617c 100644
--- a/editor/editor_settings.h
+++ b/editor/editor_settings.h
@@ -107,7 +107,7 @@ private:
String config_file_path;
String project_config_dir;
- Vector<String> favorite_dirs;
+ Vector<String> favorites;
Vector<String> recent_dirs;
bool save_changed_setting;
@@ -173,8 +173,8 @@ public:
void set_project_metadata(const String &p_section, const String &p_key, Variant p_data);
Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default) const;
- void set_favorite_dirs(const Vector<String> &p_favorites_dirs);
- Vector<String> get_favorite_dirs() const;
+ void set_favorites(const Vector<String> &p_favorites);
+ Vector<String> get_favorites() const;
void set_recent_dirs(const Vector<String> &p_recent_dirs);
Vector<String> get_recent_dirs() const;
void load_favorites();
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index b5353a071c..b6e4375ce9 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -274,7 +274,7 @@ void EditorSpinSlider::_notification(int p_what) {
update();
}
if (p_what == NOTIFICATION_FOCUS_ENTER) {
- /* Sorry, I dont like this, it makes navigating the different fields with arrows more difficult.
+ /* Sorry, I don't like this, it makes navigating the different fields with arrows more difficult.
* Just press enter to edit.
* if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && !value_input_just_closed) {
_focus_entered();
diff --git a/editor/editor_sub_scene.cpp b/editor/editor_sub_scene.cpp
index 056ee59860..7036a0ddaa 100644
--- a/editor/editor_sub_scene.cpp
+++ b/editor/editor_sub_scene.cpp
@@ -30,6 +30,7 @@
#include "editor_sub_scene.h"
+#include "editor/editor_node.h"
#include "scene/gui/margin_container.h"
#include "scene/resources/packed_scene.h"
@@ -84,9 +85,7 @@ void EditorSubScene::_fill_tree(Node *p_node, TreeItem *p_parent) {
it->set_text(0, p_node->get_name());
it->set_editable(0, false);
it->set_selectable(0, true);
- if (has_icon(p_node->get_class(), "EditorIcons")) {
- it->set_icon(0, get_icon(p_node->get_class(), "EditorIcons"));
- }
+ it->set_icon(0, EditorNode::get_singleton()->get_object_icon(p_node, "Node"));
for (int i = 0; i < p_node->get_child_count(); i++) {
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 3a55966e7b..bd1d355fb3 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -40,27 +40,38 @@
#include "editor_settings.h"
#include "scene/main/viewport.h"
+Ref<Texture> FileSystemDock::_get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx) {
+ Ref<Texture> file_icon;
+ if (!p_dir->get_file_import_is_valid(p_idx)) {
+ file_icon = get_icon("ImportFail", "EditorIcons");
+ } else {
+ String file_type = p_dir->get_file_type(p_idx);
+ file_icon = (has_icon(file_type, "EditorIcons")) ? get_icon(file_type, "EditorIcons") : get_icon("File", "EditorIcons");
+ }
+ return file_icon;
+}
+
bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths) {
- TreeItem *item = tree->create_item(p_parent);
+ bool parent_should_expand = false;
+
+ // Create a tree item for the subdirectory
+ TreeItem *subdirectory_item = tree->create_item(p_parent);
String dname = p_dir->get_name();
if (dname == "")
dname = "res://";
- item->set_text(0, dname);
- item->set_icon(0, get_icon("Folder", "EditorIcons"));
- item->set_selectable(0, true);
+ subdirectory_item->set_text(0, dname);
+ subdirectory_item->set_icon(0, get_icon("Folder", "EditorIcons"));
+ subdirectory_item->set_selectable(0, true);
String lpath = p_dir->get_path();
- if (lpath != "res://" && lpath.ends_with("/")) {
- lpath = lpath.substr(0, lpath.length() - 1);
- }
- item->set_metadata(0, lpath);
- if (lpath == path) {
- item->select(0);
+ subdirectory_item->set_metadata(0, lpath);
+ if (path == lpath || ((display_mode_setting == DISPLAY_MODE_SETTING_SPLIT) && path.get_base_dir() == lpath)) {
+ subdirectory_item->select(0);
}
if ((path.begins_with(lpath) && path != lpath)) {
- item->set_collapsed(false);
+ subdirectory_item->set_collapsed(false);
} else {
bool is_collapsed = true;
for (int i = 0; i < uncollapsed_paths.size(); i++) {
@@ -69,23 +80,65 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
break;
}
}
- item->set_collapsed(is_collapsed);
+ subdirectory_item->set_collapsed(is_collapsed);
+ }
+ if (searched_string.length() > 0 && dname.to_lower().find(searched_string) >= 0) {
+ parent_should_expand = true;
}
+ // Create items for all subdirectories
for (int i = 0; i < p_dir->get_subdir_count(); i++)
- _create_tree(item, p_dir->get_subdir(i), uncollapsed_paths);
+ parent_should_expand = (_create_tree(subdirectory_item, p_dir->get_subdir(i), uncollapsed_paths) || parent_should_expand);
- return true;
-}
+ // Create all items for the files in the subdirectory
+ if (display_mode_setting == DISPLAY_MODE_SETTING_TREE_ONLY) {
+ for (int i = 0; i < p_dir->get_file_count(); i++) {
+ String file_name = p_dir->get_file(i);
+
+ if (searched_string.length() > 0) {
+ if (file_name.to_lower().find(searched_string) < 0) {
+ // The seached string is not in the file name, we skip it
+ continue;
+ } else {
+ // We expand all parents
+ parent_should_expand = true;
+ }
+ }
-void FileSystemDock::_update_tree(bool keep_collapse_state, bool p_uncollapse_root) {
+ TreeItem *file_item = tree->create_item(subdirectory_item);
+ file_item->set_text(0, file_name);
+ file_item->set_icon(0, _get_tree_item_icon(p_dir, i));
+ String file_metadata = lpath.plus_file(file_name);
+ file_item->set_metadata(0, file_metadata);
+ if (path == file_metadata) {
+ file_item->select(0);
+ file_item->set_as_cursor(0);
+ }
+ Array udata;
+ udata.push_back(tree_update_id);
+ udata.push_back(file_item);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(file_metadata, this, "_tree_thumbnail_done", udata);
+ }
+ }
- Vector<String> uncollapsed_paths;
- if (keep_collapse_state) {
- TreeItem *root = tree->get_root();
- if (root) {
- TreeItem *resTree = root->get_children()->get_next();
+ if (searched_string.length() > 0) {
+ if (parent_should_expand) {
+ subdirectory_item->set_collapsed(false);
+ } else if (dname != "res://") {
+ subdirectory_item->get_parent()->remove_child(subdirectory_item);
+ }
+ }
+
+ return parent_should_expand;
+}
+Vector<String> FileSystemDock::_compute_uncollapsed_paths() {
+ // Register currently collapsed paths
+ Vector<String> uncollapsed_paths;
+ TreeItem *root = tree->get_root();
+ if (root) {
+ TreeItem *resTree = root->get_children()->get_next();
+ if (resTree) {
Vector<TreeItem *> needs_check;
needs_check.push_back(resTree);
@@ -102,84 +155,123 @@ void FileSystemDock::_update_tree(bool keep_collapse_state, bool p_uncollapse_ro
}
}
}
+ return uncollapsed_paths;
+}
+
+void FileSystemDock::_update_tree(const Vector<String> p_uncollapsed_paths, bool p_uncollapse_root) {
+ // Recreate the tree
tree->clear();
+ tree_update_id++;
updating_tree = true;
-
TreeItem *root = tree->create_item();
+
+ // Handles the favorites
TreeItem *favorites = tree->create_item(root);
favorites->set_icon(0, get_icon("Favorites", "EditorIcons"));
favorites->set_text(0, TTR("Favorites:"));
favorites->set_selectable(0, false);
- Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorite_dirs();
- String res_path = "res://";
- Ref<Texture> folder_icon = get_icon("Folder", "EditorIcons");
+ Vector<String> favorite_paths = EditorSettings::get_singleton()->get_favorites();
for (int i = 0; i < favorite_paths.size(); i++) {
String fave = favorite_paths[i];
- if (!fave.begins_with(res_path))
+ if (!fave.begins_with("res://"))
+ continue;
+ if (display_mode_setting == DISPLAY_MODE_SETTING_SPLIT && !fave.ends_with("/"))
continue;
- TreeItem *ti = tree->create_item(favorites);
- if (fave == res_path)
- ti->set_text(0, "/");
- else
- ti->set_text(0, fave.get_file());
- ti->set_icon(0, folder_icon);
- ti->set_selectable(0, true);
- ti->set_metadata(0, fave);
+ Ref<Texture> folder_icon = get_icon("Folder", "EditorIcons");
+
+ String text;
+ Ref<Texture> icon;
+ if (fave == "res://") {
+ text = "/";
+ icon = folder_icon;
+ } else if (fave.ends_with("/")) {
+ text = fave.substr(0, fave.length() - 1).get_file();
+ icon = folder_icon;
+ } else {
+ text = fave.get_file();
+ int index;
+ EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(fave, &index);
+ if (dir) {
+ icon = _get_tree_item_icon(dir, index);
+ } else {
+ icon = get_icon("File", "EditorIcons");
+ }
+ }
+
+ if (searched_string.length() == 0 || text.to_lower().find(searched_string) >= 0) {
+ TreeItem *ti = tree->create_item(favorites);
+ ti->set_text(0, text);
+ ti->set_icon(0, icon);
+ ti->set_tooltip(0, fave);
+ ti->set_selectable(0, true);
+ ti->set_metadata(0, fave);
+ }
}
+ Vector<String> uncollapsed_paths = p_uncollapsed_paths;
if (p_uncollapse_root) {
uncollapsed_paths.push_back("res://");
}
+ // Create the remaining of the tree
_create_tree(root, EditorFileSystem::get_singleton()->get_filesystem(), uncollapsed_paths);
tree->ensure_cursor_is_visible();
updating_tree = false;
}
void FileSystemDock::_update_display_mode() {
-
- bool disable_split = bool(EditorSettings::get_singleton()->get("docks/filesystem/disable_split"));
bool compact_mode = get_size().height < int(EditorSettings::get_singleton()->get("docks/filesystem/split_mode_minimum_height"));
- DisplayMode new_mode;
- if (disable_split || compact_mode) {
- new_mode = file_list_view ? DISPLAY_FILE_LIST_ONLY : DISPLAY_TREE_ONLY;
+
+ // Compute the new display mode
+ DisplayMode new_display_mode;
+ if ((display_mode_setting == DISPLAY_MODE_SETTING_TREE_ONLY) || compact_mode) {
+ new_display_mode = file_list_view ? DISPLAY_MODE_FILE_LIST_ONLY : DISPLAY_MODE_TREE_ONLY;
} else {
- new_mode = DISPLAY_SPLIT;
+ new_display_mode = DISPLAY_MODE_SPLIT;
}
- if (new_mode != display_mode) {
- switch (new_mode) {
- case DISPLAY_TREE_ONLY:
+ if (new_display_mode != display_mode || old_display_mode_setting != display_mode_setting) {
+ display_mode = new_display_mode;
+ old_display_mode_setting = display_mode_setting;
+ button_toggle_display_mode->set_pressed(display_mode_setting == DISPLAY_MODE_SETTING_SPLIT ? true : false);
+ switch (display_mode) {
+ case DISPLAY_MODE_TREE_ONLY:
tree->show();
tree->set_v_size_flags(SIZE_EXPAND_FILL);
- _update_tree(true);
+ if (display_mode_setting == DISPLAY_MODE_SETTING_TREE_ONLY) {
+ tree_search_box->show();
+ } else {
+ tree_search_box->hide();
+ }
+ _update_tree(_compute_uncollapsed_paths());
file_list_vb->hide();
break;
- case DISPLAY_FILE_LIST_ONLY:
+ case DISPLAY_MODE_FILE_LIST_ONLY:
tree->hide();
+ tree_search_box->hide();
button_tree->show();
file_list_vb->show();
_update_files(true);
break;
- case DISPLAY_SPLIT:
+ case DISPLAY_MODE_SPLIT:
tree->show();
tree->set_v_size_flags(SIZE_EXPAND_FILL);
button_tree->hide();
tree->ensure_cursor_is_visible();
- _update_tree(true);
+ tree_search_box->hide();
+ _update_tree(_compute_uncollapsed_paths());
file_list_vb->show();
_update_files(true);
break;
}
- display_mode = new_mode;
}
}
@@ -201,34 +293,35 @@ void FileSystemDock::_notification(int p_what) {
String ei = "EditorIcons";
button_reload->set_icon(get_icon("Reload", ei));
- button_favorite->set_icon(get_icon("Favorites", ei));
- //button_instance->set_icon(get_icon("Add", ei));
- //button_open->set_icon(get_icon("Folder", ei));
+ button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
button_tree->set_icon(get_icon("Filesystem", ei));
_update_file_list_display_mode_button();
button_file_list_display_mode->connect("pressed", this, "_change_file_display");
- //file_options->set_icon( get_icon("Tools","ei"));
- files->connect("item_activated", this, "_select_file");
+
+ files->connect("item_activated", this, "_file_list_activate_file");
button_hist_next->connect("pressed", this, "_fw_history");
button_hist_prev->connect("pressed", this, "_bw_history");
- search_box->set_right_icon(get_icon("Search", ei));
- search_box->set_clear_button_enabled(true);
+ tree_search_box->set_right_icon(get_icon("Search", ei));
+ tree_search_box->set_clear_button_enabled(true);
+ file_list_search_box->set_right_icon(get_icon("Search", ei));
+ file_list_search_box->set_clear_button_enabled(true);
button_hist_next->set_icon(get_icon("Forward", ei));
button_hist_prev->set_icon(get_icon("Back", ei));
- button_show->set_icon(get_icon("GuiVisibilityVisible", "EditorIcons"));
- file_options->connect("id_pressed", this, "_file_option");
- folder_options->connect("id_pressed", this, "_folder_option");
+ file_list_popup->connect("id_pressed", this, "_file_list_rmb_option");
+ tree_popup->connect("id_pressed", this, "_tree_rmb_option");
button_tree->connect("pressed", this, "_go_to_tree", varray(), CONNECT_DEFERRED);
current_path->connect("text_entered", this, "navigate_to_path");
_update_display_mode();
+ always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders"));
+
if (EditorFileSystem::get_singleton()->is_scanning()) {
_set_scanning_mode();
} else {
- _update_tree(false, true);
+ _update_tree(Vector<String>(), true);
}
} break;
@@ -245,7 +338,7 @@ void FileSystemDock::_notification(int p_what) {
Dictionary dd = get_viewport()->gui_get_drag_data();
if (tree->is_visible_in_tree() && dd.has("type")) {
if ((String(dd["type"]) == "files") || (String(dd["type"]) == "files_and_dirs") || (String(dd["type"]) == "resource")) {
- tree->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM);
+ tree->set_drop_mode_flags(Tree::DROP_MODE_ON_ITEM | Tree::DROP_MODE_INBETWEEN);
} else if ((String(dd["type"]) == "favorite")) {
tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN);
}
@@ -261,20 +354,37 @@ void FileSystemDock::_notification(int p_what) {
// Update icons
String ei = "EditorIcons";
button_reload->set_icon(get_icon("Reload", ei));
- button_favorite->set_icon(get_icon("Favorites", ei));
+ button_toggle_display_mode->set_icon(get_icon("Panels2", ei));
button_tree->set_icon(get_icon("Filesystem", ei));
button_hist_next->set_icon(get_icon("Forward", ei));
button_hist_prev->set_icon(get_icon("Back", ei));
- search_box->set_right_icon(get_icon("Search", ei));
- search_box->set_clear_button_enabled(true);
+ tree_search_box->set_right_icon(get_icon("Search", ei));
+ tree_search_box->set_clear_button_enabled(true);
+ file_list_search_box->set_right_icon(get_icon("Search", ei));
+ file_list_search_box->set_clear_button_enabled(true);
- // Change size mode
- int new_file_list_mode = int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode"));
+ bool should_update_files = false;
+
+ // Update file list display mode
+ int new_file_list_mode = int(EditorSettings::get_singleton()->get("docks/filesystem/files_display_mode"));
if (new_file_list_mode != file_list_display_mode) {
set_file_list_display_mode(new_file_list_mode);
- } else {
_update_file_list_display_mode_button();
+ should_update_files = true;
+ }
+
+ // Update display of files in tree
+ display_mode_setting = DisplayModeSetting(int(EditorSettings::get_singleton()->get("docks/filesystem/display_mode")));
+
+ // Update allways showfolders
+ bool new_always_show_folders = bool(EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders"));
+ if (new_always_show_folders != always_show_folders) {
+ always_show_folders = new_always_show_folders;
+ should_update_files = true;
+ }
+
+ if (should_update_files) {
_update_files(true);
}
@@ -285,74 +395,33 @@ void FileSystemDock::_notification(int p_what) {
}
}
-void FileSystemDock::_dir_selected() {
+void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_selected) {
+
+ // Return if we don't select something new
+ if (!p_selected)
+ return;
+ // Tree item selected
TreeItem *sel = tree->get_selected();
if (!sel)
return;
path = sel->get_metadata(0);
- bool found = false;
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorite_dirs();
- for (int i = 0; i < favorites.size(); i++) {
-
- if (favorites[i] == path) {
- found = true;
- break;
- }
- }
-
- button_favorite->set_pressed(found);
+ // Set the current path
current_path->set_text(path);
_push_to_history();
- if (display_mode == DISPLAY_SPLIT) {
+ // Update the file list
+ if (!updating_tree && display_mode == DISPLAY_MODE_SPLIT) {
_update_files(false);
}
}
-void FileSystemDock::_favorites_pressed() {
-
- TreeItem *sel = tree->get_selected();
- if (!sel)
- return;
- path = sel->get_metadata(0);
-
- int idx = -1;
- Vector<String> favorites = EditorSettings::get_singleton()->get_favorite_dirs();
- for (int i = 0; i < favorites.size(); i++) {
-
- if (favorites[i] == path) {
- idx = i;
- break;
- }
- }
-
- if (idx == -1) {
- favorites.push_back(path);
- } else {
- favorites.remove(idx);
- }
- EditorSettings::get_singleton()->set_favorite_dirs(favorites);
- _update_tree(true);
-}
-
-void FileSystemDock::_show_current_scene_file() {
-
- int index = EditorNode::get_editor_data().get_edited_scene();
- String path = EditorNode::get_editor_data().get_scene_path(index);
- if (path != String()) {
- navigate_to_path(path);
- }
-}
-
String FileSystemDock::get_selected_path() const {
-
- TreeItem *sel = tree->get_selected();
- if (!sel)
- return "";
-
- return sel->get_metadata(0);
+ if (path.ends_with("/"))
+ return path;
+ else
+ return path.get_base_dir();
}
String FileSystemDock::get_current_path() const {
@@ -361,14 +430,17 @@ String FileSystemDock::get_current_path() const {
}
void FileSystemDock::navigate_to_path(const String &p_path) {
+
+ String target_path = p_path;
// If the path is a file, do not only go to the directory in the tree, also select the file in the file list.
- String file_name = "";
+ if (target_path.ends_with("/")) {
+ target_path = target_path.substr(0, target_path.length() - 1);
+ }
DirAccess *dirAccess = DirAccess::open("res://");
if (dirAccess->file_exists(p_path)) {
- path = p_path.get_base_dir();
- file_name = p_path.get_file();
+ path = target_path;
} else if (dirAccess->dir_exists(p_path)) {
- path = p_path;
+ path = target_path + "/";
} else {
ERR_EXPLAIN(vformat(TTR("Cannot navigate to '%s' as it has not been found in the file system!"), p_path));
ERR_FAIL();
@@ -377,13 +449,20 @@ void FileSystemDock::navigate_to_path(const String &p_path) {
current_path->set_text(path);
_push_to_history();
- if (display_mode == DISPLAY_SPLIT) {
- _update_tree(true);
+ if (display_mode == DISPLAY_MODE_SPLIT) {
+ _update_tree(_compute_uncollapsed_paths());
_update_files(false);
- } else {
- _go_to_file_list();
+ } else if (display_mode == DISPLAY_MODE_TREE_ONLY) {
+ if (path.ends_with("/")) {
+ _go_to_file_list();
+ } else {
+ _update_tree(_compute_uncollapsed_paths());
+ }
+ } else { // DISPLAY_MODE_FILE_LIST_ONLY
+ _update_files(true);
}
+ String file_name = p_path.get_file();
if (!file_name.empty()) {
for (int i = 0; i < files->get_item_count(); i++) {
if (files->get_item_text(i) == file_name) {
@@ -395,10 +474,9 @@ void FileSystemDock::navigate_to_path(const String &p_path) {
}
}
-void FileSystemDock::_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata) {
+void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
if ((file_list_vb->is_visible_in_tree() || path == p_path.get_base_dir()) && p_preview.is_valid()) {
-
Array uarr = p_udata;
int idx = uarr[0];
String file = uarr[1];
@@ -407,6 +485,27 @@ void FileSystemDock::_thumbnail_done(const String &p_path, const Ref<Texture> &p
}
}
+void FileSystemDock::_tree_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata) {
+ if (p_small_preview.is_valid()) {
+ Array uarr = p_udata;
+ if (tree_update_id == (int)uarr[0]) {
+ TreeItem *file_item = Object::cast_to<TreeItem>(uarr[1]);
+ if (file_item) {
+ file_item->set_icon(0, p_small_preview);
+
+ // Update the favorite icon if needed
+ TreeItem *favorite = tree->get_root()->get_children()->get_children();
+ while (favorite) {
+ if (favorite->get_metadata(0) == file_item->get_metadata(0)) {
+ favorite->set_icon(0, p_small_preview);
+ }
+ favorite = favorite->get_next();
+ }
+ }
+ }
+ }
+}
+
void FileSystemDock::_update_file_list_display_mode_button() {
if (button_file_list_display_mode->is_pressed()) {
@@ -424,7 +523,7 @@ void FileSystemDock::_change_file_display() {
_update_file_list_display_mode_button();
- EditorSettings::get_singleton()->set("docks/filesystem/display_mode", file_list_display_mode);
+ EditorSettings::get_singleton()->set("docks/filesystem/files_display_mode", file_list_display_mode);
_update_files(true);
}
@@ -438,12 +537,10 @@ void FileSystemDock::_search(EditorFileSystemDirectory *p_path, List<FileInfo> *
_search(p_path->get_subdir(i), matches, p_max_items);
}
- String match = search_box->get_text().to_lower();
-
for (int i = 0; i < p_path->get_file_count(); i++) {
String file = p_path->get_file(i);
- if (file.to_lower().find(match) != -1) {
+ if (file.to_lower().find(searched_string) != -1) {
FileInfo fi;
fi.name = file;
@@ -461,12 +558,10 @@ void FileSystemDock::_search(EditorFileSystemDirectory *p_path, List<FileInfo> *
void FileSystemDock::_update_files(bool p_keep_selection) {
+ // Register the previously selected items
Set<String> cselection;
-
if (p_keep_selection) {
-
for (int i = 0; i < files->get_item_count(); i++) {
-
if (files->is_selected(i))
cselection.insert(files->get_item_text(i));
}
@@ -476,7 +571,17 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
current_path->set_text(path);
- EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(path);
+ String directory = path;
+ if (directory.ends_with("/") && directory != "res://") {
+ directory = directory.substr(0, directory.length() - 1);
+ }
+ String file = "";
+ EditorFileSystemDirectory *efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
+ if (!efd) {
+ directory = path.get_base_dir();
+ file = path.get_file();
+ efd = EditorFileSystem::get_singleton()->get_filesystem_path(directory);
+ }
if (!efd)
return;
@@ -487,10 +592,8 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
Ref<Texture> file_thumbnail;
Ref<Texture> file_thumbnail_broken;
- bool always_show_folders = EditorSettings::get_singleton()->get("docks/filesystem/always_show_folders");
-
bool use_thumbnails = (file_list_display_mode == FILE_LIST_DISPLAY_THUMBNAILS);
- bool use_folders = search_box->get_text().length() == 0 && ((display_mode == DISPLAY_FILE_LIST_ONLY || display_mode == DISPLAY_TREE_ONLY) || always_show_folders);
+ bool use_folders = searched_string.length() == 0 && ((display_mode == DISPLAY_MODE_FILE_LIST_ONLY || display_mode == DISPLAY_MODE_TREE_ONLY) || always_show_folders);
if (use_thumbnails) {
@@ -521,14 +624,15 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
if (use_folders) {
Ref<Texture> folderIcon = (use_thumbnails) ? folder_thumbnail : get_icon("folder", "FileDialog");
- if (path != "res://") {
+ if (directory != "res://") {
files->add_item("..", folderIcon, true);
- String bd = path.get_base_dir();
+ String bd = directory.get_base_dir();
if (bd != "res://" && !bd.ends_with("/"))
bd += "/";
files->set_item_metadata(files->get_item_count() - 1, bd);
+ files->set_item_selectable(files->get_item_count() - 1, false);
}
for (int i = 0; i < efd->get_subdir_count(); i++) {
@@ -536,16 +640,17 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
String dname = efd->get_subdir(i)->get_name();
files->add_item(dname, folderIcon, true);
- files->set_item_metadata(files->get_item_count() - 1, path.plus_file(dname) + "/");
+ files->set_item_metadata(files->get_item_count() - 1, directory.plus_file(dname) + "/");
- if (cselection.has(dname))
+ if (cselection.has(dname)) {
files->select(files->get_item_count() - 1, false);
+ }
}
}
List<FileInfo> filelist;
- if (search_box->get_text().length() > 0) {
+ if (searched_string.length() > 0) {
_search(EditorFileSystem::get_singleton()->get_filesystem(), &filelist, 128);
filelist.sort();
@@ -555,7 +660,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
FileInfo fi;
fi.name = efd->get_file(i);
- fi.path = path.plus_file(fi.name);
+ fi.path = directory.plus_file(fi.name);
fi.type = efd->get_file_type(i);
fi.import_broken = !efd->get_file_import_is_valid(i);
fi.import_status = 0;
@@ -598,7 +703,7 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
udata.resize(2);
udata[0] = item_index;
udata[1] = fname;
- EditorResourcePreview::get_singleton()->queue_resource_preview(fpath, this, "_thumbnail_done", udata);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(fpath, this, "_file_list_thumbnail_done", udata);
}
} else {
files->add_item(fname, type_icon, true);
@@ -609,6 +714,11 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
if (cselection.has(fname))
files->select(item_index, false);
+ if (!p_keep_selection && file != "" && fname == file) {
+ files->select(item_index, true);
+ files->ensure_current_is_visible();
+ }
+
if (finfo->sources.size()) {
for (int j = 0; j < finfo->sources.size(); j++) {
tooltip += "\nSource: " + finfo->sources[j];
@@ -618,8 +728,8 @@ void FileSystemDock::_update_files(bool p_keep_selection) {
}
}
-void FileSystemDock::_select_file(int p_idx) {
- String fpath = files->get_item_metadata(p_idx);
+void FileSystemDock::_select_file(const String p_path) {
+ String fpath = p_path;
if (fpath.ends_with("/")) {
if (fpath != "res://") {
fpath = fpath.substr(0, fpath.length() - 1);
@@ -634,9 +744,21 @@ void FileSystemDock::_select_file(int p_idx) {
}
}
+void FileSystemDock::_tree_activate_file() {
+ TreeItem *selected = tree->get_selected();
+ if (selected) {
+ call_deferred("_select_file", selected->get_metadata(0));
+ }
+}
+
+void FileSystemDock::_file_list_activate_file(int p_idx) {
+ _select_file(files->get_item_metadata(p_idx));
+}
+
void FileSystemDock::_go_to_file_list() {
- if (display_mode == DISPLAY_TREE_ONLY) {
+ if (display_mode == DISPLAY_MODE_TREE_ONLY) {
+
file_list_view = true;
_update_display_mode();
} else {
@@ -645,6 +767,7 @@ void FileSystemDock::_go_to_file_list() {
_update_files(false);
}
}
+
void FileSystemDock::_go_to_tree() {
file_list_view = false;
@@ -655,7 +778,7 @@ void FileSystemDock::_go_to_tree() {
void FileSystemDock::_preview_invalidated(const String &p_path) {
- if (file_list_display_mode == FILE_LIST_DISPLAY_THUMBNAILS && p_path.get_base_dir() == path && search_box->get_text() == String() && file_list_vb->is_visible_in_tree()) {
+ if (file_list_display_mode == FILE_LIST_DISPLAY_THUMBNAILS && p_path.get_base_dir() == path && searched_string.length() == 0 && file_list_vb->is_visible_in_tree()) {
for (int i = 0; i < files->get_item_count(); i++) {
@@ -665,7 +788,7 @@ void FileSystemDock::_preview_invalidated(const String &p_path) {
udata.resize(2);
udata[0] = i;
udata[1] = files->get_item_text(i);
- EditorResourcePreview::get_singleton()->queue_resource_preview(p_path, this, "_thumbnail_done", udata);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(p_path, this, "_file_list_thumbnail_done", udata);
break;
}
}
@@ -680,7 +803,7 @@ void FileSystemDock::_fs_changed() {
split_box->show();
if (tree->is_visible()) {
- _update_tree(true);
+ _update_tree(_compute_uncollapsed_paths());
}
if (file_list_vb->is_visible()) {
@@ -724,7 +847,7 @@ void FileSystemDock::_update_history() {
current_path->set_text(path);
if (tree->is_visible()) {
- _update_tree(true);
+ _update_tree(_compute_uncollapsed_paths());
tree->grab_focus();
tree->ensure_cursor_is_visible();
}
@@ -968,23 +1091,23 @@ void FileSystemDock::_update_project_settings_after_move(const Map<String, Strin
ProjectSettings::get_singleton()->save();
}
-void FileSystemDock::_update_favorite_dirs_list_after_move(const Map<String, String> &p_renames) const {
+void FileSystemDock::_update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const {
- Vector<String> favorite_dirs = EditorSettings::get_singleton()->get_favorite_dirs();
- Vector<String> new_favorite_dirs;
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ Vector<String> new_favorites;
- for (int i = 0; i < favorite_dirs.size(); i++) {
- String old_path = favorite_dirs[i] + "/";
-
- if (p_renames.has(old_path)) {
- String new_path = p_renames[old_path];
- new_favorite_dirs.push_back(new_path.substr(0, new_path.length() - 1));
+ for (int i = 0; i < favorites.size(); i++) {
+ String old_path = favorites[i];
+ if (p_folders_renames.has(old_path)) {
+ new_favorites.push_back(p_folders_renames[old_path]);
+ } else if (p_files_renames.has(old_path)) {
+ new_favorites.push_back(p_files_renames[old_path]);
} else {
- new_favorite_dirs.push_back(favorite_dirs[i]);
+ new_favorites.push_back(old_path);
}
}
- EditorSettings::get_singleton()->set_favorite_dirs(new_favorite_dirs);
+ EditorSettings::get_singleton()->set_favorites(new_favorites);
}
void FileSystemDock::_make_dir_confirm() {
@@ -998,9 +1121,13 @@ void FileSystemDock::_make_dir_confirm() {
return;
}
- print_verbose("Making folder " + dir_name + " in " + path);
+ String directory = path;
+ if (!directory.ends_with("/")) {
+ directory = directory.get_base_dir();
+ }
+ print_verbose("Making folder " + dir_name + " in " + directory);
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
- Error err = da->change_dir(path);
+ Error err = da->change_dir(directory);
if (err == OK) {
err = da->make_dir(dir_name);
}
@@ -1051,7 +1178,7 @@ void FileSystemDock::_rename_operation_confirm() {
_update_dependencies_after_move(file_renames);
_update_resource_paths_after_move(file_renames);
_update_project_settings_after_move(file_renames);
- _update_favorite_dirs_list_after_move(folder_renames);
+ _update_favorites_list_after_move(file_renames, folder_renames);
//Rescan everything
print_verbose("FileSystem: calling rescan.");
@@ -1144,111 +1271,209 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool overw
_update_dependencies_after_move(file_renames);
_update_resource_paths_after_move(file_renames);
_update_project_settings_after_move(file_renames);
- _update_favorite_dirs_list_after_move(folder_renames);
+ _update_favorites_list_after_move(file_renames, folder_renames);
print_verbose("FileSystem: calling rescan.");
_rescan();
}
}
-void FileSystemDock::_file_option(int p_option) {
+Vector<String> FileSystemDock::_tree_get_selected(bool remove_self_inclusion) {
+ // Build a list of selected items with the active one at the first position
+ Vector<String> selected_strings;
+
+ TreeItem *active_selected = tree->get_selected();
+ if (active_selected) {
+ selected_strings.push_back(active_selected->get_metadata(0));
+ }
+
+ TreeItem *selected = tree->get_root();
+ selected = tree->get_next_selected(selected);
+ while (selected) {
+ if (selected != active_selected) {
+ selected_strings.push_back(selected->get_metadata(0));
+ }
+ selected = tree->get_next_selected(selected);
+ }
+
+ // Remove paths or files that are included into another
+ if (remove_self_inclusion && selected_strings.size() > 1) {
+ selected_strings.sort_custom<NaturalNoCaseComparator>();
+ String last_path = "";
+ for (int i = 0; i < selected_strings.size(); i++) {
+ if (last_path != "" && selected_strings[i].begins_with(last_path)) {
+ selected_strings.remove(i);
+ i--;
+ }
+ if (selected_strings[i].ends_with("/")) {
+ last_path = selected_strings[i];
+ }
+ }
+ }
+ return selected_strings;
+}
+
+void FileSystemDock::_tree_rmb_option(int p_option) {
+
+ Vector<String> selected_strings = _tree_get_selected();
+
+ // Execute the current option
switch (p_option) {
- case FILE_SHOW_IN_EXPLORER: {
+ case FOLDER_EXPAND_ALL:
+ case FOLDER_COLLAPSE_ALL: {
+ // Expand or collapse the folder
+ if (selected_strings.size() == 1) {
+ bool is_collapsed = (p_option == FOLDER_COLLAPSE_ALL);
+
+ Vector<TreeItem *> needs_check;
+ needs_check.push_back(tree->get_selected());
- String path = this->path;
+ while (needs_check.size()) {
+ needs_check[0]->set_collapsed(is_collapsed);
- // first try to grab directory from selected file, so that it works for searched files
- int idx = files->get_current();
+ TreeItem *child = needs_check[0]->get_children();
+ while (child) {
+ needs_check.push_back(child);
+ child = child->get_next();
+ }
- if (idx >= 0 && idx < files->get_item_count()) {
- path = files->get_item_metadata(idx);
- path = path.get_base_dir();
+ needs_check.remove(0);
+ }
}
+ } break;
+ default: {
+ _file_option(p_option, selected_strings);
+ } break;
+ }
+}
- path = ProjectSettings::get_singleton()->globalize_path(path);
- OS::get_singleton()->shell_open(String("file://") + path);
+void FileSystemDock::_file_list_rmb_option(int p_option) {
+ Vector<int> selected_id = files->get_selected_items();
+ Vector<String> selected;
+ for (int i = 0; i < selected_id.size(); i++) {
+ selected.push_back(files->get_item_metadata(selected_id[i]));
+ }
+ _file_option(p_option, selected);
+}
+
+void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected) {
+ // The first one should be the active item
+
+ switch (p_option) {
+ case FILE_SHOW_IN_EXPLORER: {
+ // Show the file / folder in the OS explorer
+ String fpath = path;
+ if (!fpath.ends_with("/")) {
+ fpath = fpath.get_base_dir();
+ }
+ String dir = ProjectSettings::get_singleton()->globalize_path(fpath);
+ OS::get_singleton()->shell_open(String("file://") + dir);
} break;
+
case FILE_OPEN: {
- for (int i = 0; i < files->get_item_count(); i++) {
- if (files->is_selected(i)) {
- _select_file(i);
- }
+ // Open the file
+ for (int i = 0; i < p_selected.size(); i++) {
+ _select_file(p_selected[i]);
}
} break;
- case FILE_INSTANCE: {
+ case FILE_INSTANCE: {
+ // Instance all selected scenes
Vector<String> paths;
-
- for (int i = 0; i < files->get_item_count(); i++) {
- if (!files->is_selected(i))
- continue;
- String fpath = files->get_item_metadata(i);
+ for (int i = 0; i < p_selected.size(); i++) {
+ String fpath = p_selected[i];
if (EditorFileSystem::get_singleton()->get_file_type(fpath) == "PackedScene") {
paths.push_back(fpath);
}
}
-
if (!paths.empty()) {
emit_signal("instance", paths);
}
} break;
- case FILE_DEPENDENCIES: {
- int idx = files->get_current();
- if (idx < 0 || idx >= files->get_item_count())
- break;
- String fpath = files->get_item_metadata(idx);
- deps_editor->edit(fpath);
+ case FILE_ADD_FAVORITE: {
+ // Add the files from favorites
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ for (int i = 0; i < p_selected.size(); i++) {
+ if (favorites.find(p_selected[i]) == -1) {
+ favorites.push_back(p_selected[i]);
+ }
+ }
+ EditorSettings::get_singleton()->set_favorites(favorites);
+ _update_tree(_compute_uncollapsed_paths());
} break;
- case FILE_OWNERS: {
- int idx = files->get_current();
- if (idx < 0 || idx >= files->get_item_count())
- break;
- String fpath = files->get_item_metadata(idx);
- owners_editor->show(fpath);
+ case FILE_REMOVE_FAVORITE: {
+ // Remove the files from favorites
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ for (int i = 0; i < p_selected.size(); i++) {
+ favorites.erase(p_selected[i]);
+ }
+ EditorSettings::get_singleton()->set_favorites(favorites);
+ _update_tree(_compute_uncollapsed_paths());
} break;
+
+ case FILE_DEPENDENCIES: {
+ // Checkout the file dependencies
+ if (!p_selected.empty()) {
+ String fpath = p_selected[0];
+ deps_editor->edit(fpath);
+ }
+ } break;
+
+ case FILE_OWNERS: {
+ // Checkout the file owners
+ if (!p_selected.empty()) {
+ String fpath = p_selected[0];
+ owners_editor->show(fpath);
+ }
+ } break;
+
case FILE_MOVE: {
+ // Move the files to a given location
to_move.clear();
- for (int i = 0; i < files->get_item_count(); i++) {
- if (!files->is_selected(i))
- continue;
-
- String fpath = files->get_item_metadata(i);
- to_move.push_back(FileOrFolder(fpath, !fpath.ends_with("/")));
+ for (int i = 0; i < p_selected.size(); i++) {
+ String fpath = p_selected[i];
+ if (fpath != "res://") {
+ to_move.push_back(FileOrFolder(fpath, !fpath.ends_with("/")));
+ }
}
if (to_move.size() > 0) {
move_dialog->popup_centered_ratio();
}
} break;
- case FILE_RENAME: {
- int idx = files->get_current();
- if (idx < 0 || idx >= files->get_item_count())
- break;
- to_rename.path = files->get_item_metadata(idx);
- to_rename.is_file = !to_rename.path.ends_with("/");
- if (to_rename.is_file) {
- String name = to_rename.path.get_file();
- rename_dialog->set_title(TTR("Renaming file:") + " " + name);
- rename_dialog_text->set_text(name);
- rename_dialog_text->select(0, name.find_last("."));
- } else {
- String name = to_rename.path.substr(0, to_rename.path.length() - 1).get_file();
- rename_dialog->set_title(TTR("Renaming folder:") + " " + name);
- rename_dialog_text->set_text(name);
- rename_dialog_text->select(0, name.length());
+ case FILE_RENAME: {
+ // Rename the active file
+ if (!p_selected.empty()) {
+ to_rename.path = p_selected[0];
+ if (to_rename.path != "res://") {
+ to_rename.is_file = !to_rename.path.ends_with("/");
+ if (to_rename.is_file) {
+ String name = to_rename.path.get_file();
+ rename_dialog->set_title(TTR("Renaming file:") + " " + name);
+ rename_dialog_text->set_text(name);
+ rename_dialog_text->select(0, name.find_last("."));
+ } else {
+ String name = to_rename.path.substr(0, to_rename.path.length() - 1).get_file();
+ rename_dialog->set_title(TTR("Renaming folder:") + " " + name);
+ rename_dialog_text->set_text(name);
+ rename_dialog_text->select(0, name.length());
+ }
+ rename_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
+ rename_dialog_text->grab_focus();
+ }
}
- rename_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
- rename_dialog_text->grab_focus();
} break;
+
case FILE_REMOVE: {
+ // Remove the selected files
Vector<String> remove_files;
Vector<String> remove_folders;
- for (int i = 0; i < files->get_item_count(); i++) {
- String fpath = files->get_item_metadata(i);
- if (files->is_selected(i) && fpath != "res://") {
+ for (int i = 0; i < p_selected.size(); i++) {
+ String fpath = p_selected[i];
+ if (fpath != "res://") {
if (fpath.ends_with("/")) {
remove_folders.push_back(fpath);
} else {
@@ -1259,166 +1484,77 @@ void FileSystemDock::_file_option(int p_option) {
if (remove_files.size() + remove_folders.size() > 0) {
remove_dialog->show(remove_folders, remove_files);
- //1) find if used
- //2) warn
}
} break;
- case FILE_DUPLICATE: {
- int idx = files->get_current();
- if (idx < 0 || idx >= files->get_item_count())
- break;
- to_duplicate.path = files->get_item_metadata(idx);
- to_duplicate.is_file = !to_duplicate.path.ends_with("/");
- if (to_duplicate.is_file) {
- String name = to_duplicate.path.get_file();
- duplicate_dialog->set_title(TTR("Duplicating file:") + " " + name);
- duplicate_dialog_text->set_text(name);
- duplicate_dialog_text->select(0, name.find_last("."));
- } else {
- String name = to_duplicate.path.substr(0, to_duplicate.path.length() - 1).get_file();
- duplicate_dialog->set_title(TTR("Duplicating folder:") + " " + name);
- duplicate_dialog_text->set_text(name);
- duplicate_dialog_text->select(0, name.length());
+ case FILE_DUPLICATE: {
+ // Duplicate the selected files
+ for (int i = 0; i < p_selected.size(); i++) {
+ to_duplicate.path = p_selected[i];
+ to_duplicate.is_file = !to_duplicate.path.ends_with("/");
+ if (to_duplicate.is_file) {
+ String name = to_duplicate.path.get_file();
+ duplicate_dialog->set_title(TTR("Duplicating file:") + " " + name);
+ duplicate_dialog_text->set_text(name);
+ duplicate_dialog_text->select(0, name.find_last("."));
+ } else {
+ String name = to_duplicate.path.substr(0, to_duplicate.path.length() - 1).get_file();
+ duplicate_dialog->set_title(TTR("Duplicating folder:") + " " + name);
+ duplicate_dialog_text->set_text(name);
+ duplicate_dialog_text->select(0, name.length());
+ }
+ duplicate_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
+ duplicate_dialog_text->grab_focus();
}
- duplicate_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
- duplicate_dialog_text->grab_focus();
} break;
+
case FILE_INFO: {
} break;
- case FILE_REIMPORT: {
+ case FILE_REIMPORT: {
+ // Reimport all selected files
Vector<String> reimport;
- for (int i = 0; i < files->get_item_count(); i++) {
-
- if (!files->is_selected(i))
- continue;
-
- String fpath = files->get_item_metadata(i);
- reimport.push_back(fpath);
+ for (int i = 0; i < p_selected.size(); i++) {
+ reimport.push_back(p_selected[i]);
}
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();
-
- if (editor.begins_with("texture_")) { //compatibility fix for old texture format
- editor="texture";
- }
-
- Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(editor);
- ERR_FAIL_COND(!rimp.is_valid());
-
- if (reimport.size()==1) {
- rimp->import_dialog(reimport[0]);
- } else {
- rimp->reimport_multiple_files(reimport);
-
- }
- */
} break;
+
case FILE_NEW_FOLDER: {
+ // Create a new folder
make_dir_dialog_text->set_text("new folder");
make_dir_dialog_text->select_all();
make_dir_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
make_dir_dialog_text->grab_focus();
} break;
+
case FILE_NEW_SCRIPT: {
- String tarDir = path;
- if (tarDir != "res://" && !tarDir.ends_with("/")) {
- tarDir += "/";
+ // Create a new script
+ String fpath = path;
+ if (!fpath.ends_with("/")) {
+ fpath = fpath.get_base_dir();
}
-
- make_script_dialog_text->config("Node", tarDir + "new_script.gd");
+ make_script_dialog_text->config("Node", fpath + "new_script.gd");
make_script_dialog_text->popup_centered(Size2(300, 300) * EDSCALE);
} break;
+
case FILE_COPY_PATH: {
- int idx = files->get_current();
- if (idx < 0 || idx >= files->get_item_count())
- break;
- String fpath = files->get_item_metadata(idx);
- OS::get_singleton()->set_clipboard(fpath);
+ // Copy the file path
+ if (!p_selected.empty()) {
+ String fpath = p_selected[0];
+ OS::get_singleton()->set_clipboard(fpath);
+ }
} break;
+
case FILE_NEW_RESOURCE: {
+ // Create a new resource
new_resource_dialog->popup_create(true);
} break;
}
}
-void FileSystemDock::_folder_option(int p_option) {
-
- TreeItem *selected = tree->get_selected();
-
- switch (p_option) {
- case FOLDER_EXPAND_ALL:
- case FOLDER_COLLAPSE_ALL: {
- bool is_collapsed = (p_option == FOLDER_COLLAPSE_ALL);
- Vector<TreeItem *> needs_check;
- needs_check.push_back(selected);
-
- while (needs_check.size()) {
- needs_check[0]->set_collapsed(is_collapsed);
-
- TreeItem *child = needs_check[0]->get_children();
- while (child) {
- needs_check.push_back(child);
- child = child->get_next();
- }
-
- needs_check.remove(0);
- }
- } break;
- case FOLDER_MOVE: {
- to_move.clear();
- String fpath = selected->get_metadata(tree->get_selected_column());
- if (fpath != "res://") {
- fpath = fpath.ends_with("/") ? fpath.substr(0, fpath.length() - 1) : fpath;
- to_move.push_back(FileOrFolder(fpath, false));
- move_dialog->popup_centered_ratio();
- }
- } break;
- case FOLDER_RENAME: {
- to_rename.path = selected->get_metadata(tree->get_selected_column());
- to_rename.is_file = false;
- if (to_rename.path != "res://") {
- String name = to_rename.path.ends_with("/") ? to_rename.path.substr(0, to_rename.path.length() - 1).get_file() : to_rename.path.get_file();
- rename_dialog->set_title(TTR("Renaming folder:") + " " + name);
- rename_dialog_text->set_text(name);
- rename_dialog_text->select(0, name.length());
- rename_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
- rename_dialog_text->grab_focus();
- }
- } break;
- case FOLDER_REMOVE: {
- Vector<String> remove_folders;
- Vector<String> remove_files;
- String fpath = selected->get_metadata(tree->get_selected_column());
- if (fpath != "res://") {
- remove_folders.push_back(fpath);
- remove_dialog->show(remove_folders, remove_files);
- }
- } break;
- case FOLDER_NEW_FOLDER: {
- make_dir_dialog_text->set_text("new folder");
- make_dir_dialog_text->select_all();
- make_dir_dialog->popup_centered_minsize(Size2(250, 80) * EDSCALE);
- make_dir_dialog_text->grab_focus();
- } break;
- case FOLDER_COPY_PATH: {
- String fpath = selected->get_metadata(tree->get_selected_column());
- OS::get_singleton()->set_clipboard(fpath);
- } break;
- case FOLDER_SHOW_IN_EXPLORER: {
- String fpath = selected->get_metadata(tree->get_selected_column());
- String dir = ProjectSettings::get_singleton()->globalize_path(fpath);
- OS::get_singleton()->shell_open(String("file://") + dir);
- } break;
- }
-}
-
void FileSystemDock::_resource_created() const {
Object *c = new_resource_dialog->instance_selected();
@@ -1431,38 +1567,39 @@ void FileSystemDock::_resource_created() const {
RES current_res = RES(r);
- editor->save_resource_as(current_res, path);
-}
-
-void FileSystemDock::_dir_rmb_pressed(const Vector2 &p_pos) {
- folder_options->clear();
- folder_options->set_size(Size2(1, 1));
+ String fpath = path;
+ if (!fpath.ends_with("/")) {
+ fpath = fpath.get_base_dir();
+ }
- folder_options->add_item(TTR("Expand all"), FOLDER_EXPAND_ALL);
- folder_options->add_item(TTR("Collapse all"), FOLDER_COLLAPSE_ALL);
+ editor->save_resource_as(current_res, fpath);
+}
- TreeItem *item = tree->get_selected();
- if (item) {
- String fpath = item->get_metadata(tree->get_selected_column());
- folder_options->add_separator();
- folder_options->add_item(TTR("Copy Path"), FOLDER_COPY_PATH);
- if (fpath != "res://") {
- folder_options->add_item(TTR("Rename..."), FOLDER_RENAME);
- folder_options->add_item(TTR("Move To..."), FOLDER_MOVE);
- folder_options->add_item(TTR("Delete"), FOLDER_REMOVE);
- }
- folder_options->add_separator();
- folder_options->add_item(TTR("New Folder..."), FOLDER_NEW_FOLDER);
- folder_options->add_item(TTR("Open In File Manager"), FOLDER_SHOW_IN_EXPLORER);
+void FileSystemDock::_search_changed(const String &p_text, const Control *p_from) {
+ if (searched_string.length() == 0 && p_text.length() > 0) {
+ // Register the uncollapsed paths before they change
+ uncollapsed_paths_before_search = _compute_uncollapsed_paths();
}
- folder_options->set_position(tree->get_global_position() + p_pos);
- folder_options->popup();
-}
-void FileSystemDock::_search_changed(const String &p_text) {
+ searched_string = p_text.to_lower();
- if (file_list_vb->is_visible())
- _update_files(false);
+ if (p_from == tree_search_box)
+ file_list_search_box->set_text(searched_string);
+ else // file_list_search_box
+ tree_search_box->set_text(searched_string);
+
+ switch (display_mode) {
+ case DISPLAY_MODE_FILE_LIST_ONLY: {
+ _update_files(false);
+ } break;
+ case DISPLAY_MODE_TREE_ONLY: {
+ _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
+ } break;
+ case DISPLAY_MODE_SPLIT: {
+ _update_files(false);
+ _update_tree(searched_string.length() == 0 ? uncollapsed_paths_before_search : Vector<String>());
+ } break;
+ }
}
void FileSystemDock::_rescan() {
@@ -1471,20 +1608,25 @@ void FileSystemDock::_rescan() {
EditorFileSystem::get_singleton()->scan();
}
+void FileSystemDock::_toggle_split_mode(bool p_active) {
+ display_mode_setting = p_active ? DISPLAY_MODE_SETTING_SPLIT : DISPLAY_MODE_SETTING_TREE_ONLY;
+ EditorSettings::get_singleton()->set("docks/filesystem/display_mode", int(display_mode_setting));
+ _update_display_mode();
+}
+
void FileSystemDock::fix_dependencies(const String &p_for_file) {
deps_editor->edit(p_for_file);
}
void FileSystemDock::focus_on_filter() {
- if (display_mode == DISPLAY_FILE_LIST_ONLY && tree->is_visible()) {
+ if (display_mode == DISPLAY_MODE_FILE_LIST_ONLY && tree->is_visible()) {
// Tree mode, switch to files list with search box
tree->hide();
file_list_vb->show();
- button_favorite->hide();
}
- search_box->grab_focus();
+ file_list_search_box->grab_focus();
}
void FileSystemDock::set_file_list_display_mode(int p_mode) {
@@ -1497,33 +1639,43 @@ void FileSystemDock::set_file_list_display_mode(int p_mode) {
}
Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
- bool is_favorite = false;
+ bool all_favorites = true;
+ bool all_not_favorites = true;
+
Vector<String> paths;
if (p_from == tree) {
- TreeItem *selected = tree->get_selected();
- if (!selected)
- return Variant();
-
- String folder = selected->get_metadata(0);
- if (folder == String())
- return Variant();
-
- paths.push_back(folder.ends_with("/") ? folder : (folder + "/"));
- is_favorite = selected->get_parent() != NULL && tree->get_root()->get_children() == selected->get_parent();
+ // Check if the first selected is in favorite
+ TreeItem *selected = tree->get_next_selected(tree->get_root());
+ while (selected) {
+ bool is_favorite = selected->get_parent() != NULL && tree->get_root()->get_children() == selected->get_parent();
+ all_favorites &= is_favorite;
+ all_not_favorites &= !is_favorite;
+ selected = tree->get_next_selected(selected);
+ }
+ if (all_favorites) {
+ paths = _tree_get_selected(false);
+ } else {
+ paths = _tree_get_selected();
+ }
} else if (p_from == files) {
for (int i = 0; i < files->get_item_count(); i++) {
if (files->is_selected(i)) {
paths.push_back(files->get_item_metadata(i));
}
}
+ all_favorites = false;
+ all_not_favorites = true;
}
if (paths.empty())
return Variant();
+ if (!all_favorites && !all_not_favorites)
+ return Variant();
+
Dictionary drag_data = EditorNode::get_singleton()->drag_files_and_dirs(paths, p_from);
- if (is_favorite) {
+ if (all_favorites) {
drag_data["type"] = "favorite";
}
return drag_data;
@@ -1535,34 +1687,46 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da
if (drag_data.has("type") && String(drag_data["type"]) == "favorite") {
- //moving favorite around
+ // Moving favorite around
TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return false;
- int what = tree->get_drop_section_at_position(p_point);
+ int drop_section = tree->get_drop_section_at_position(p_point);
+ TreeItem *favorites_item = tree->get_root()->get_children();
- if (ti == tree->get_root()->get_children()) {
- return (what == 1); //the parent, first fav
+ TreeItem *resources_item = favorites_item->get_next();
+
+ if (ti == favorites_item) {
+ return (drop_section == 1); // The parent, first fav
}
- if (ti->get_parent() && tree->get_root()->get_children() == ti->get_parent()) {
- return true; // a favorite
+ if (ti->get_parent() && favorites_item == ti->get_parent()) {
+ return true; // A favorite
}
-
- if (ti == tree->get_root()->get_children()->get_next()) {
- return (what == -1); //the tree, last fav
+ if (ti == resources_item) {
+ return (drop_section == -1); // The tree, last fav
}
return false;
}
if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
- String to_dir = _get_drag_target_folder(p_point, p_from);
+ // Move resources
+ String to_dir;
+ bool favorite;
+ _get_drag_target_folder(to_dir, favorite, p_point, p_from);
return !to_dir.empty();
}
if (drag_data.has("type") && (String(drag_data["type"]) == "files" || String(drag_data["type"]) == "files_and_dirs")) {
- String to_dir = _get_drag_target_folder(p_point, p_from);
+ // Move files or dir
+ String to_dir;
+ bool favorite;
+ _get_drag_target_folder(to_dir, favorite, p_point, p_from);
+
+ if (favorite)
+ return true;
+
if (to_dir.empty())
return false;
@@ -1587,71 +1751,67 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
return;
Dictionary drag_data = p_data;
- if (drag_data.has("type") && String(drag_data["type"]) == "favorite") {
+ Vector<String> dirs = EditorSettings::get_singleton()->get_favorites();
- //moving favorite around
+ if (drag_data.has("type") && String(drag_data["type"]) == "favorite") {
+ // Moving favorite around
TreeItem *ti = tree->get_item_at_position(p_point);
if (!ti)
return;
+ int drop_section = tree->get_drop_section_at_position(p_point);
+ int drop_position;
Vector<String> files = drag_data["files"];
-
- ERR_FAIL_COND(files.size() != 1);
-
- String swap = files[0];
- if (swap != "res://" && swap.ends_with("/")) {
- swap = swap.substr(0, swap.length() - 1);
- }
-
- int what = tree->get_drop_section_at_position(p_point);
-
- TreeItem *swap_item = NULL;
-
- if (ti == tree->get_root()->get_children()) {
- swap_item = tree->get_root()->get_children()->get_children();
-
- } else if (ti->get_parent() && tree->get_root()->get_children() == ti->get_parent()) {
- if (what == -1) {
- swap_item = ti;
- } else {
- swap_item = ti->get_next();
+ TreeItem *favorites_item = tree->get_root()->get_children();
+ TreeItem *resources_item = favorites_item->get_next();
+
+ if (ti == favorites_item) {
+ // Drop on the favorite folder
+ drop_position = 0;
+ } else if (ti == resources_item) {
+ // Drop on the resouce item
+ drop_position = dirs.size();
+ } else {
+ // Drop in the list
+ drop_position = dirs.find(ti->get_metadata(0));
+ if (drop_section == 1) {
+ drop_position++;
}
}
- String swap_with;
-
- if (swap_item) {
- swap_with = swap_item->get_metadata(0);
- if (swap_with != "res://" && swap_with.ends_with("/")) {
- swap_with = swap_with.substr(0, swap_with.length() - 1);
+ // Remove dragged favorites
+ Vector<int> to_remove;
+ int offset = 0;
+ for (int i = 0; i < files.size(); i++) {
+ int to_remove_pos = dirs.find(files[i]);
+ to_remove.push_back(to_remove_pos);
+ if (to_remove_pos < drop_position) {
+ offset++;
}
}
+ drop_position -= offset;
+ to_remove.sort();
+ for (int i = 0; i < to_remove.size(); i++) {
+ dirs.remove(to_remove[i] - i);
+ }
- if (swap == swap_with)
- return;
-
- Vector<String> dirs = EditorSettings::get_singleton()->get_favorite_dirs();
-
- ERR_FAIL_COND(dirs.find(swap) == -1);
- ERR_FAIL_COND(swap_with != String() && dirs.find(swap_with) == -1);
-
- dirs.erase(swap);
-
- if (swap_with == String()) {
- dirs.push_back(swap);
- } else {
- int idx = dirs.find(swap_with);
- dirs.insert(idx, swap);
+ // Re-add them at the right position
+ for (int i = 0; i < files.size(); i++) {
+ dirs.insert(drop_position, files[i]);
+ drop_position++;
}
- EditorSettings::get_singleton()->set_favorite_dirs(dirs);
- _update_tree(true);
+ EditorSettings::get_singleton()->set_favorites(dirs);
+ _update_tree(_compute_uncollapsed_paths());
return;
}
if (drag_data.has("type") && String(drag_data["type"]) == "resource") {
+ // Moving resource
Ref<Resource> res = drag_data["resource"];
- String to_dir = _get_drag_target_folder(p_point, p_from);
+ String to_dir;
+ bool favorite;
+ _get_drag_target_folder(to_dir, favorite, p_point, p_from);
if (res.is_valid() && !to_dir.empty()) {
EditorNode::get_singleton()->push_item(res.ptr());
EditorNode::get_singleton()->save_resource_as(res, to_dir);
@@ -1659,7 +1819,10 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
}
if (drag_data.has("type") && (String(drag_data["type"]) == "files" || String(drag_data["type"]) == "files_and_dirs")) {
- String to_dir = _get_drag_target_folder(p_point, p_from);
+ // Move files or add to favorites
+ String to_dir;
+ bool favorite;
+ _get_drag_target_folder(to_dir, favorite, p_point, p_from);
if (!to_dir.empty()) {
Vector<String> fnames = drag_data["files"];
to_move.clear();
@@ -1667,50 +1830,93 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data,
to_move.push_back(FileOrFolder(fnames[i], !fnames[i].ends_with("/")));
}
_move_operation_confirm(to_dir);
+ } else if (favorite) {
+ // Add the files from favorites
+ Vector<String> fnames = drag_data["files"];
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+ for (int i = 0; i < fnames.size(); i++) {
+ if (favorites.find(fnames[i]) == -1) {
+ favorites.push_back(fnames[i]);
+ }
+ }
+ EditorSettings::get_singleton()->set_favorites(favorites);
+ _update_tree(_compute_uncollapsed_paths());
}
}
}
-String FileSystemDock::_get_drag_target_folder(const Point2 &p_point, Control *p_from) const {
+void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favorites, const Point2 &p_point, Control *p_from) const {
+ target = String();
+ target_favorites = false;
+
+ // In the file list
if (p_from == files) {
int pos = files->get_item_at_position(p_point, true);
- if (pos == -1)
- return path;
+ if (pos == -1) {
+ return;
+ }
- String target = files->get_item_metadata(pos);
- return target.ends_with("/") ? target : path;
+ String ltarget = files->get_item_metadata(pos);
+ target = ltarget.ends_with("/") ? target : path;
+ return;
}
+ // In the tree
if (p_from == tree) {
TreeItem *ti = tree->get_item_at_position(p_point);
- if (ti && ti != tree->get_root()->get_children())
- return ti->get_metadata(0);
+ int section = tree->get_drop_section_at_position(p_point);
+ if (ti) {
+ // Check the favorites first
+ if (ti == tree->get_root()->get_children() && section >= 0) {
+ target_favorites = true;
+ return;
+ } else if (ti->get_parent() == tree->get_root()->get_children()) {
+ target_favorites = true;
+ return;
+ } else {
+ String fpath = ti->get_metadata(0);
+ if (section == 0) {
+ if (fpath.ends_with("/")) {
+ // We drop on a folder
+ target = fpath;
+ return;
+ }
+ } else {
+ if (ti->get_parent() != tree->get_root()->get_children()) {
+ // Not in the favorite section
+ if (fpath != "res://") {
+ // We drop between two files
+ if (fpath.ends_with("/")) {
+ fpath = fpath.substr(0, fpath.length() - 1);
+ }
+ target = fpath.get_base_dir();
+ return;
+ }
+ }
+ }
+ }
+ }
}
- return String();
+ return;
}
-void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
-
- //Right clicking ".." should clear current selection
- if (files->get_item_text(p_item) == "..") {
- for (int i = 0; i < files->get_item_count(); i++) {
- files->unselect(i);
- }
- }
+void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths) {
+ // Add options for files and folders
+ ERR_FAIL_COND(p_paths.empty())
Vector<String> filenames;
Vector<String> foldernames;
+ Vector<String> favorites = EditorSettings::get_singleton()->get_favorites();
+
bool all_files = true;
bool all_files_scenes = true;
bool all_folders = true;
- for (int i = 0; i < files->get_item_count(); i++) {
- if (!files->is_selected(i)) {
- continue;
- }
-
- String fpath = files->get_item_metadata(i);
+ bool all_favorites = true;
+ bool all_not_favorites = true;
+ for (int i = 0; i < p_paths.size(); i++) {
+ String fpath = p_paths[i];
if (fpath.ends_with("/")) {
foldernames.push_back(fpath);
all_files = false;
@@ -1719,68 +1925,135 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) {
all_folders = false;
all_files_scenes &= (EditorFileSystem::get_singleton()->get_file_type(fpath) == "PackedScene");
}
+
+ // Check if in favorites
+ bool found = false;
+ for (int j = 0; j < favorites.size(); j++) {
+ if (favorites[j] == fpath) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ all_not_favorites = false;
+ } else {
+ all_favorites = false;
+ }
}
- file_options->clear();
- file_options->set_size(Size2(1, 1));
if (all_files) {
if (all_files_scenes && filenames.size() >= 1) {
- file_options->add_item(TTR("Open Scene(s)"), FILE_OPEN);
- file_options->add_item(TTR("Instance"), FILE_INSTANCE);
- file_options->add_separator();
+ p_popup->add_item(TTR("Open Scene(s)"), FILE_OPEN);
+ p_popup->add_item(TTR("Instance"), FILE_INSTANCE);
+ p_popup->add_separator();
}
if (!all_files_scenes && filenames.size() == 1) {
- file_options->add_item(TTR("Open"), FILE_OPEN);
- file_options->add_separator();
+ p_popup->add_item(TTR("Open"), FILE_OPEN);
+ p_popup->add_separator();
}
+ }
+
+ if (p_paths.size() >= 1) {
+ if (!all_favorites) {
+ p_popup->add_item(TTR("Add to favorites"), FILE_ADD_FAVORITE);
+ }
+ if (!all_not_favorites) {
+ p_popup->add_item(TTR("Remove from favorites"), FILE_REMOVE_FAVORITE);
+ }
+ p_popup->add_separator();
+ }
+ if (all_files) {
if (filenames.size() == 1) {
- file_options->add_item(TTR("Edit Dependencies..."), FILE_DEPENDENCIES);
- file_options->add_item(TTR("View Owners..."), FILE_OWNERS);
- file_options->add_separator();
+ p_popup->add_item(TTR("Edit Dependencies..."), FILE_DEPENDENCIES);
+ p_popup->add_item(TTR("View Owners..."), FILE_OWNERS);
+ p_popup->add_separator();
}
} else if (all_folders && foldernames.size() > 0) {
- file_options->add_item(TTR("Open"), FILE_OPEN);
- file_options->add_separator();
+ p_popup->add_item(TTR("Open"), FILE_OPEN);
+ p_popup->add_separator();
}
- int num_items = filenames.size() + foldernames.size();
- if (num_items >= 1) {
- if (num_items == 1) {
- file_options->add_item(TTR("Copy Path"), FILE_COPY_PATH);
- file_options->add_item(TTR("Rename..."), FILE_RENAME);
- file_options->add_item(TTR("Duplicate..."), FILE_DUPLICATE);
- }
- file_options->add_item(TTR("Move To..."), FILE_MOVE);
- file_options->add_item(TTR("Delete"), FILE_REMOVE);
- file_options->add_separator();
+ if (p_paths.size() == 1) {
+ p_popup->add_item(TTR("Copy Path"), FILE_COPY_PATH);
+ p_popup->add_item(TTR("Rename..."), FILE_RENAME);
+ p_popup->add_item(TTR("Duplicate..."), FILE_DUPLICATE);
+ }
+
+ p_popup->add_item(TTR("Move To..."), FILE_MOVE);
+ p_popup->add_item(TTR("Delete"), FILE_REMOVE);
+
+ if (p_paths.size() == 1) {
+ p_popup->add_separator();
+ p_popup->add_item(TTR("New Folder..."), FILE_NEW_FOLDER);
+ p_popup->add_item(TTR("New Script..."), FILE_NEW_SCRIPT);
+ p_popup->add_item(TTR("New Resource..."), FILE_NEW_RESOURCE);
+
+ String fpath = p_paths[0];
+ String item_text = fpath.ends_with("/") ? TTR("Open In File Manager") : TTR("Show In File Manager");
+ p_popup->add_item(item_text, FILE_SHOW_IN_EXPLORER);
}
+}
- file_options->add_item(TTR("New Folder..."), FILE_NEW_FOLDER);
- file_options->add_item(TTR("New Script..."), FILE_NEW_SCRIPT);
- file_options->add_item(TTR("New Resource..."), FILE_NEW_RESOURCE);
+void FileSystemDock::_tree_rmb_select(const Vector2 &p_pos) {
+ // Right click is pressed in the tree
+ Vector<String> paths = _tree_get_selected();
- String fpath = files->get_item_metadata(p_item);
- String item_text = fpath.ends_with("/") ? TTR("Open In File Manager") : TTR("Show In File Manager");
- file_options->add_item(item_text, FILE_SHOW_IN_EXPLORER);
+ if (paths.size() == 1) {
+ if (paths[0].ends_with("/")) {
+ tree_popup->add_item(TTR("Expand all"), FOLDER_EXPAND_ALL);
+ tree_popup->add_item(TTR("Collapse all"), FOLDER_COLLAPSE_ALL);
+ tree_popup->add_separator();
+ }
+ }
- file_options->set_position(files->get_global_position() + p_pos);
- file_options->popup();
+ // Popup
+ if (!paths.empty()) {
+ tree_popup->clear();
+ tree_popup->set_size(Size2(1, 1));
+ _file_and_folders_fill_popup(tree_popup, paths);
+ tree_popup->set_position(tree->get_global_position() + p_pos);
+ tree_popup->popup();
+ }
}
-void FileSystemDock::_rmb_pressed(const Vector2 &p_pos) {
- file_options->clear();
- file_options->set_size(Size2(1, 1));
+void FileSystemDock::_file_list_rmb_select(int p_item, const Vector2 &p_pos) {
+ // Right click is pressed in the file list
+ Vector<String> paths;
+ for (int i = 0; i < files->get_item_count(); i++) {
+ if (!files->is_selected(i))
+ continue;
+ if (files->get_item_text(p_item) == "..") {
+ files->unselect(i);
+ continue;
+ }
+ paths.push_back(files->get_item_metadata(i));
+ }
+
+ // Popup
+ if (!paths.empty()) {
+ file_list_popup->clear();
+ file_list_popup->set_size(Size2(1, 1));
+ _file_and_folders_fill_popup(file_list_popup, paths);
+ file_list_popup->set_position(files->get_global_position() + p_pos);
+ file_list_popup->popup();
+ }
+}
- file_options->add_item(TTR("New Folder..."), FILE_NEW_FOLDER);
- file_options->add_item(TTR("New Script..."), FILE_NEW_SCRIPT);
- file_options->add_item(TTR("New Resource..."), FILE_NEW_RESOURCE);
- file_options->add_item(TTR("Show In File Manager"), FILE_SHOW_IN_EXPLORER);
- file_options->set_position(files->get_global_position() + p_pos);
- file_options->popup();
+void FileSystemDock::_file_list_rmb_pressed(const Vector2 &p_pos) {
+ // Right click on empty space for file list
+ file_list_popup->clear();
+ file_list_popup->set_size(Size2(1, 1));
+
+ file_list_popup->add_item(TTR("New Folder..."), FILE_NEW_FOLDER);
+ file_list_popup->add_item(TTR("New Script..."), FILE_NEW_SCRIPT);
+ file_list_popup->add_item(TTR("New Resource..."), FILE_NEW_RESOURCE);
+ file_list_popup->add_item(TTR("Show In File Manager"), FILE_SHOW_IN_EXPLORER);
+ file_list_popup->set_position(files->get_global_position() + p_pos);
+ file_list_popup->popup();
}
void FileSystemDock::select_file(const String &p_file) {
@@ -1790,11 +2063,24 @@ void FileSystemDock::select_file(const String &p_file) {
void FileSystemDock::_file_multi_selected(int p_index, bool p_selected) {
+ // Set the path to the current focussed item
+ int current = files->get_current();
+ if (current == p_index) {
+ String fpath = files->get_item_metadata(current);
+ if (!fpath.ends_with("/")) {
+ path = fpath;
+ if (display_mode == DISPLAY_MODE_SPLIT) {
+ _update_tree(_compute_uncollapsed_paths());
+ }
+ }
+ }
+
+ // Update the import dock
import_dock_needs_update = true;
call_deferred("_update_import_dock");
}
-void FileSystemDock::_files_gui_input(Ref<InputEvent> p_event) {
+void FileSystemDock::_tree_gui_input(Ref<InputEvent> p_event) {
if (get_viewport()->get_modal_stack_top())
return; //ignore because of modal window
@@ -1802,21 +2088,34 @@ void FileSystemDock::_files_gui_input(Ref<InputEvent> p_event) {
Ref<InputEventKey> key = p_event;
if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
- _file_option(FILE_DUPLICATE);
+ _tree_rmb_option(FILE_DUPLICATE);
} else if (ED_IS_SHORTCUT("filesystem_dock/copy_path", p_event)) {
- _file_option(FILE_COPY_PATH);
+ _tree_rmb_option(FILE_COPY_PATH);
} else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
- _file_option(FILE_REMOVE);
+ _tree_rmb_option(FILE_REMOVE);
} else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
- _file_option(FILE_RENAME);
+ _tree_rmb_option(FILE_RENAME);
}
}
}
-void FileSystemDock::_file_selected() {
+void FileSystemDock::_file_list_gui_input(Ref<InputEvent> p_event) {
- import_dock_needs_update = true;
- _update_import_dock();
+ if (get_viewport()->get_modal_stack_top())
+ return; //ignore because of modal window
+
+ Ref<InputEventKey> key = p_event;
+ if (key.is_valid() && key->is_pressed() && !key->is_echo()) {
+ if (ED_IS_SHORTCUT("filesystem_dock/duplicate", p_event)) {
+ _file_list_rmb_option(FILE_DUPLICATE);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/copy_path", p_event)) {
+ _file_list_rmb_option(FILE_COPY_PATH);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/delete", p_event)) {
+ _file_list_rmb_option(FILE_REMOVE);
+ } else if (ED_IS_SHORTCUT("filesystem_dock/rename", p_event)) {
+ _file_list_rmb_option(FILE_RENAME);
+ }
+ }
}
void FileSystemDock::_update_import_dock() {
@@ -1869,16 +2168,25 @@ void FileSystemDock::_update_import_dock() {
void FileSystemDock::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_files_gui_input"), &FileSystemDock::_files_gui_input);
+ ClassDB::bind_method(D_METHOD("_file_list_gui_input"), &FileSystemDock::_file_list_gui_input);
+ ClassDB::bind_method(D_METHOD("_tree_gui_input"), &FileSystemDock::_tree_gui_input);
+
ClassDB::bind_method(D_METHOD("_update_tree"), &FileSystemDock::_update_tree);
ClassDB::bind_method(D_METHOD("_rescan"), &FileSystemDock::_rescan);
- ClassDB::bind_method(D_METHOD("_favorites_pressed"), &FileSystemDock::_favorites_pressed);
- ClassDB::bind_method(D_METHOD("_show_current_scene_file"), &FileSystemDock::_show_current_scene_file);
- //ClassDB::bind_method(D_METHOD("_instance_pressed"),&ScenesDock::_instance_pressed);
- ClassDB::bind_method(D_METHOD("_go_to_file_list"), &FileSystemDock::_go_to_file_list);
- ClassDB::bind_method(D_METHOD("_dir_rmb_pressed"), &FileSystemDock::_dir_rmb_pressed);
- ClassDB::bind_method(D_METHOD("_thumbnail_done"), &FileSystemDock::_thumbnail_done);
+ ClassDB::bind_method(D_METHOD("_toggle_split_mode"), &FileSystemDock::_toggle_split_mode);
+
+ ClassDB::bind_method(D_METHOD("_tree_rmb_option", "option"), &FileSystemDock::_tree_rmb_option);
+ ClassDB::bind_method(D_METHOD("_file_list_rmb_option", "option"), &FileSystemDock::_file_list_rmb_option);
+
+ ClassDB::bind_method(D_METHOD("_tree_rmb_select"), &FileSystemDock::_tree_rmb_select);
+ ClassDB::bind_method(D_METHOD("_file_list_rmb_select"), &FileSystemDock::_file_list_rmb_select);
+ ClassDB::bind_method(D_METHOD("_file_list_rmb_pressed"), &FileSystemDock::_file_list_rmb_pressed);
+
+ ClassDB::bind_method(D_METHOD("_file_list_thumbnail_done"), &FileSystemDock::_file_list_thumbnail_done);
+ ClassDB::bind_method(D_METHOD("_tree_thumbnail_done"), &FileSystemDock::_tree_thumbnail_done);
+ ClassDB::bind_method(D_METHOD("_file_list_activate_file"), &FileSystemDock::_file_list_activate_file);
+ ClassDB::bind_method(D_METHOD("_tree_activate_file"), &FileSystemDock::_tree_activate_file);
ClassDB::bind_method(D_METHOD("_select_file"), &FileSystemDock::_select_file);
ClassDB::bind_method(D_METHOD("_go_to_tree"), &FileSystemDock::_go_to_tree);
ClassDB::bind_method(D_METHOD("navigate_to_path"), &FileSystemDock::navigate_to_path);
@@ -1886,9 +2194,7 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("_fw_history"), &FileSystemDock::_fw_history);
ClassDB::bind_method(D_METHOD("_bw_history"), &FileSystemDock::_bw_history);
ClassDB::bind_method(D_METHOD("_fs_changed"), &FileSystemDock::_fs_changed);
- ClassDB::bind_method(D_METHOD("_dir_selected"), &FileSystemDock::_dir_selected);
- ClassDB::bind_method(D_METHOD("_file_option"), &FileSystemDock::_file_option);
- ClassDB::bind_method(D_METHOD("_folder_option"), &FileSystemDock::_folder_option);
+ ClassDB::bind_method(D_METHOD("_tree_multi_selected"), &FileSystemDock::_tree_multi_selected);
ClassDB::bind_method(D_METHOD("_make_dir_confirm"), &FileSystemDock::_make_dir_confirm);
ClassDB::bind_method(D_METHOD("_resource_created"), &FileSystemDock::_resource_created);
ClassDB::bind_method(D_METHOD("_move_operation_confirm", "to_path", "overwrite"), &FileSystemDock::_move_operation_confirm, DEFVAL(false));
@@ -1901,13 +2207,10 @@ void FileSystemDock::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &FileSystemDock::get_drag_data_fw);
ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &FileSystemDock::can_drop_data_fw);
ClassDB::bind_method(D_METHOD("drop_data_fw"), &FileSystemDock::drop_data_fw);
- ClassDB::bind_method(D_METHOD("_files_list_rmb_select"), &FileSystemDock::_files_list_rmb_select);
ClassDB::bind_method(D_METHOD("_preview_invalidated"), &FileSystemDock::_preview_invalidated);
- ClassDB::bind_method(D_METHOD("_file_selected"), &FileSystemDock::_file_selected);
ClassDB::bind_method(D_METHOD("_file_multi_selected"), &FileSystemDock::_file_multi_selected);
ClassDB::bind_method(D_METHOD("_update_import_dock"), &FileSystemDock::_update_import_dock);
- ClassDB::bind_method(D_METHOD("_rmb_pressed"), &FileSystemDock::_rmb_pressed);
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
ADD_SIGNAL(MethodInfo("open"));
@@ -1924,9 +2227,12 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
ED_SHORTCUT("filesystem_dock/delete", TTR("Delete"), KEY_DELETE);
ED_SHORTCUT("filesystem_dock/rename", TTR("Rename"));
+ VBoxContainer *top_vbc = memnew(VBoxContainer);
+ add_child(top_vbc);
+
HBoxContainer *toolbar_hbc = memnew(HBoxContainer);
toolbar_hbc->add_constant_override("separation", 0);
- add_child(toolbar_hbc);
+ top_vbc->add_child(toolbar_hbc);
button_hist_prev = memnew(ToolButton);
button_hist_prev->set_disabled(true);
@@ -1952,22 +2258,25 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_reload->hide();
toolbar_hbc->add_child(button_reload);
- //toolbar_hbc->add_spacer();
+ button_toggle_display_mode = memnew(Button);
+ button_toggle_display_mode->set_flat(true);
+ button_toggle_display_mode->set_toggle_mode(true);
+ button_toggle_display_mode->connect("toggled", this, "_toggle_split_mode");
+ button_toggle_display_mode->set_focus_mode(FOCUS_NONE);
+ button_toggle_display_mode->set_tooltip(TTR("Toggle split mode"));
+ toolbar_hbc->add_child(button_toggle_display_mode);
- button_favorite = memnew(Button);
- button_favorite->set_flat(true);
- button_favorite->set_toggle_mode(true);
- button_favorite->connect("pressed", this, "_favorites_pressed");
- button_favorite->set_tooltip(TTR("Toggle folder status as Favorite."));
- button_favorite->set_focus_mode(FOCUS_NONE);
- toolbar_hbc->add_child(button_favorite);
-
- button_show = memnew(Button);
- button_show->set_flat(true);
- button_show->connect("pressed", this, "_show_current_scene_file");
- toolbar_hbc->add_child(button_show);
- button_show->set_focus_mode(FOCUS_NONE);
- button_show->set_tooltip(TTR("Show current scene file."));
+ HBoxContainer *toolbar2_hbc = memnew(HBoxContainer);
+ toolbar2_hbc->add_constant_override("separation", 0);
+ top_vbc->add_child(toolbar2_hbc);
+
+ tree_search_box = memnew(LineEdit);
+ tree_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
+ tree_search_box->set_placeholder(TTR("Search files"));
+ tree_search_box->connect("text_changed", this, "_search_changed", varray(tree_search_box));
+ toolbar2_hbc->add_child(tree_search_box);
+
+ //toolbar_hbc->add_spacer();
//Control *spacer = memnew( Control);
@@ -1990,13 +2299,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_instance->set_tooltip(TTR("Instance the selected scene(s) as child of the selected node."));
*/
- file_options = memnew(PopupMenu);
- file_options->set_hide_on_window_lose_focus(true);
- add_child(file_options);
+ file_list_popup = memnew(PopupMenu);
+ file_list_popup->set_hide_on_window_lose_focus(true);
+ add_child(file_list_popup);
- folder_options = memnew(PopupMenu);
- folder_options->set_hide_on_window_lose_focus(true);
- add_child(folder_options);
+ tree_popup = memnew(PopupMenu);
+ tree_popup->set_hide_on_window_lose_focus(true);
+ add_child(tree_popup);
split_box = memnew(VSplitContainer);
split_box->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -2007,13 +2316,15 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
tree->set_hide_root(true);
tree->set_drag_forwarding(this);
tree->set_allow_rmb_select(true);
+ tree->set_select_mode(Tree::SELECT_MULTI);
tree->set_custom_minimum_size(Size2(0, 200 * EDSCALE));
split_box->add_child(tree);
tree->connect("item_edited", this, "_favorite_toggled");
- tree->connect("item_activated", this, "_go_to_file_list");
- tree->connect("cell_selected", this, "_dir_selected");
- tree->connect("item_rmb_selected", this, "_dir_rmb_pressed");
+ tree->connect("item_activated", this, "_tree_activate_file");
+ tree->connect("multi_selected", this, "_tree_multi_selected");
+ tree->connect("item_rmb_selected", this, "_tree_rmb_select");
+ tree->connect("gui_input", this, "_tree_gui_input");
file_list_vb = memnew(VBoxContainer);
file_list_vb->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -2027,11 +2338,11 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
button_tree->hide();
path_hb->add_child(button_tree);
- search_box = memnew(LineEdit);
- search_box->set_h_size_flags(SIZE_EXPAND_FILL);
- search_box->set_placeholder(TTR("Search files"));
- search_box->connect("text_changed", this, "_search_changed");
- path_hb->add_child(search_box);
+ file_list_search_box = memnew(LineEdit);
+ file_list_search_box->set_h_size_flags(SIZE_EXPAND_FILL);
+ file_list_search_box->set_placeholder(TTR("Search files"));
+ file_list_search_box->connect("text_changed", this, "_search_changed", varray(file_list_search_box));
+ path_hb->add_child(file_list_search_box);
button_file_list_display_mode = memnew(ToolButton);
button_file_list_display_mode->set_toggle_mode(true);
@@ -2041,11 +2352,10 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
files->set_v_size_flags(SIZE_EXPAND_FILL);
files->set_select_mode(ItemList::SELECT_MULTI);
files->set_drag_forwarding(this);
- files->connect("item_rmb_selected", this, "_files_list_rmb_select");
- files->connect("gui_input", this, "_files_gui_input");
- files->connect("item_selected", this, "_file_selected");
+ files->connect("item_rmb_selected", this, "_file_list_rmb_select");
+ files->connect("gui_input", this, "_file_list_gui_input");
files->connect("multi_selected", this, "_file_multi_selected");
- files->connect("rmb_clicked", this, "_rmb_pressed");
+ files->connect("rmb_clicked", this, "_file_list_rmb_pressed");
files->set_allow_rmb_select(true);
file_list_vb->add_child(files);
@@ -2123,7 +2433,11 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
new_resource_dialog->set_base_type("Resource");
new_resource_dialog->connect("create", this, "_resource_created");
+ searched_string = String();
+ uncollapsed_paths_before_search = Vector<String>();
+
updating_tree = false;
+ tree_update_id = 0;
initialized = false;
import_dock_needs_update = false;
@@ -2131,8 +2445,12 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
history_max_size = 20;
history.push_back("res://");
- display_mode = DISPLAY_SPLIT;
+ display_mode = DISPLAY_MODE_SPLIT;
file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS;
+
+ display_mode_setting = DISPLAY_MODE_SETTING_TREE_ONLY;
+ old_display_mode_setting = DISPLAY_MODE_SETTING_TREE_ONLY;
+ always_show_folders = false;
}
FileSystemDock::~FileSystemDock() {
diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h
index 40be645bf7..51c8791b25 100644
--- a/editor/filesystem_dock.h
+++ b/editor/filesystem_dock.h
@@ -66,15 +66,22 @@ public:
};
private:
+ enum DisplayModeSetting {
+ DISPLAY_MODE_SETTING_TREE_ONLY,
+ DISPLAY_MODE_SETTING_SPLIT,
+ };
+
enum DisplayMode {
- DISPLAY_TREE_ONLY,
- DISPLAY_FILE_LIST_ONLY,
- DISPLAY_SPLIT,
+ DISPLAY_MODE_TREE_ONLY,
+ DISPLAY_MODE_FILE_LIST_ONLY,
+ DISPLAY_MODE_SPLIT,
};
enum FileMenu {
FILE_OPEN,
FILE_INSTANCE,
+ FILE_ADD_FAVORITE,
+ FILE_REMOVE_FAVORITE,
FILE_DEPENDENCIES,
FILE_OWNERS,
FILE_MOVE,
@@ -87,18 +94,9 @@ private:
FILE_NEW_SCRIPT,
FILE_SHOW_IN_EXPLORER,
FILE_COPY_PATH,
- FILE_NEW_RESOURCE
- };
-
- enum FolderMenu {
+ FILE_NEW_RESOURCE,
FOLDER_EXPAND_ALL,
FOLDER_COLLAPSE_ALL,
- FOLDER_MOVE,
- FOLDER_RENAME,
- FOLDER_REMOVE,
- FOLDER_NEW_FOLDER,
- FOLDER_SHOW_IN_EXPLORER,
- FOLDER_COPY_PATH
};
VBoxContainer *scanning_vb;
@@ -109,24 +107,30 @@ private:
EditorNode *editor;
Set<String> favorites;
+ Button *button_toggle_display_mode;
Button *button_reload;
- Button *button_favorite;
Button *button_tree;
Button *button_file_list_display_mode;
Button *button_hist_next;
Button *button_hist_prev;
- Button *button_show;
LineEdit *current_path;
- LineEdit *search_box;
+ LineEdit *tree_search_box;
+ LineEdit *file_list_search_box;
+
+ String searched_string;
+ Vector<String> uncollapsed_paths_before_search;
+
TextureRect *search_icon;
HBoxContainer *path_hb;
FileListDisplayMode file_list_display_mode;
DisplayMode display_mode;
+ DisplayModeSetting display_mode_setting;
+ DisplayModeSetting old_display_mode_setting;
bool file_list_view;
- PopupMenu *file_options;
- PopupMenu *folder_options;
+ PopupMenu *file_list_popup;
+ PopupMenu *tree_popup;
DependencyEditor *deps_editor;
DependencyEditorOwners *owners_editor;
@@ -143,6 +147,8 @@ private:
ScriptCreateDialog *make_script_dialog_text;
CreateDialog *new_resource_dialog;
+ bool always_show_folders;
+
class FileOrFolder {
public:
String path;
@@ -169,14 +175,18 @@ private:
bool initialized;
bool updating_tree;
+ int tree_update_id;
Tree *tree; //directories
ItemList *files;
bool import_dock_needs_update;
+ Ref<Texture> _get_tree_item_icon(EditorFileSystemDirectory *p_dir, int p_idx);
bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, Vector<String> &uncollapsed_paths);
- void _update_tree(bool keep_collapse_state, bool p_uncollapse_root = false);
+ Vector<String> _compute_uncollapsed_paths();
+ void _update_tree(const Vector<String> p_uncollapsed_paths = Vector<String>(), bool p_uncollapse_root = false);
- void _files_gui_input(Ref<InputEvent> p_event);
+ void _file_list_gui_input(Ref<InputEvent> p_event);
+ void _tree_gui_input(Ref<InputEvent> p_event);
void _update_files(bool p_keep_selection);
void _update_file_list_display_mode_button();
@@ -186,12 +196,13 @@ private:
void _go_to_tree();
void _go_to_file_list();
- void _select_file(int p_idx);
+ void _select_file(const String p_path);
+ void _tree_activate_file();
+ void _file_list_activate_file(int p_idx);
void _file_multi_selected(int p_index, bool p_selected);
- void _update_import_dock();
+ void _tree_multi_selected(Object *p_item, int p_column, bool p_selected);
- void _file_selected();
- void _dir_selected();
+ void _update_import_dock();
void _get_all_items_in_dir(EditorFileSystemDirectory *efsd, Vector<String> &files, Vector<String> &folders) const;
void _find_remaps(EditorFileSystemDirectory *efsd, const Map<String, String> &renames, Vector<String> &to_remaps) const;
@@ -199,8 +210,8 @@ private:
void _try_duplicate_item(const FileOrFolder &p_item, const String &p_new_path) const;
void _update_dependencies_after_move(const Map<String, String> &p_renames) const;
void _update_resource_paths_after_move(const Map<String, String> &p_renames) const;
- void _update_favorite_dirs_list_after_move(const Map<String, String> &p_renames) const;
- void _update_project_settings_after_move(const Map<String, String> &p_renames) const;
+ void _update_favorites_list_after_move(const Map<String, String> &p_files_renames, const Map<String, String> &p_folders_renames) const;
+ void _update_project_settings_after_move(const Map<String, String> &p_folders_renames) const;
void _resource_created() const;
void _make_dir_confirm();
@@ -210,8 +221,9 @@ private:
bool _check_existing();
void _move_operation_confirm(const String &p_to_path, bool overwrite = false);
- void _file_option(int p_option);
- void _folder_option(int p_option);
+ void _tree_rmb_option(int p_option);
+ void _file_list_rmb_option(int p_option);
+ void _file_option(int p_option, const Vector<String> p_selected);
void _fw_history();
void _bw_history();
@@ -221,13 +233,14 @@ private:
void _set_scanning_mode();
void _rescan();
- void _favorites_pressed();
- void _show_current_scene_file();
- void _search_changed(const String &p_text);
+ void _toggle_split_mode(bool p_active);
- void _dir_rmb_pressed(const Vector2 &p_pos);
- void _files_list_rmb_select(int p_item, const Vector2 &p_pos);
- void _rmb_pressed(const Vector2 &p_pos);
+ void _search_changed(const String &p_text, const Control *p_from);
+
+ void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths);
+ void _tree_rmb_select(const Vector2 &p_pos);
+ void _file_list_rmb_select(int p_item, const Vector2 &p_pos);
+ void _file_list_rmb_pressed(const Vector2 &p_pos);
struct FileInfo {
String name;
@@ -238,7 +251,7 @@ private:
bool import_broken;
bool operator<(const FileInfo &fi) const {
- return name < fi.name;
+ return NaturalNoCaseComparator()(name, fi.name);
}
};
@@ -247,13 +260,16 @@ private:
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
- String _get_drag_target_folder(const Point2 &p_point, Control *p_from) const;
+ void _get_drag_target_folder(String &target, bool &target_favorites, const Point2 &p_point, Control *p_from) const;
void _preview_invalidated(const String &p_path);
- void _thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Variant &p_udata);
+ void _file_list_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata);
+ void _tree_thumbnail_done(const String &p_path, const Ref<Texture> &p_preview, const Ref<Texture> &p_small_preview, const Variant &p_udata);
void _update_display_mode();
+ Vector<String> _tree_get_selected(bool remove_self_inclusion = true);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp
index 9ede8a05bc..11d0b67bd6 100644
--- a/editor/find_in_files.cpp
+++ b/editor/find_in_files.cpp
@@ -864,7 +864,7 @@ void FindInFilesPanel::apply_replaces_in_file(String fpath, const Vector<Result>
// If the file is already open, I assume the editor will reload it.
// If there are unsaved changes, the user will be asked on focus,
- // however that means either loosing changes or loosing replaces.
+ // however that means either losing changes or losing replaces.
FileAccess *f = FileAccess::open(fpath, FileAccess::READ);
ERR_FAIL_COND(f == NULL);
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 0efd14e932..cb9703342f 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -90,12 +90,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
node->set_metadata(0, path);
node->set_tooltip(0, path);
- Ref<Texture> icon;
- if (p_current->has_meta("_editor_icon")) {
- icon = p_current->get_meta("_editor_icon");
- } else {
- icon = get_icon((has_icon(p_current->get_class(), "EditorIcons") ? p_current->get_class() : String("Object")), "EditorIcons");
- }
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(p_current, "Node");
node->set_icon(0, icon);
if (!_can_edit(p_current, selected_group)) {
diff --git a/editor/icons/README.md b/editor/icons/README.md
index 3a2aba5b07..5f652e47ab 100644
--- a/editor/icons/README.md
+++ b/editor/icons/README.md
@@ -9,4 +9,4 @@ There you can find the optimizer script.
If you add a new icon, please make a pull request to this repo:
https://github.com/godotengine/godot-design/
-and store the the optimized SVG version here.
+and store the optimized SVG version here.
diff --git a/editor/icons/icon_GUI_checked.svg b/editor/icons/icon_GUI_checked.svg
index e5fa67ebf5..8d00eca8d3 100644
--- a/editor/icons/icon_GUI_checked.svg
+++ b/editor/icons/icon_GUI_checked.svg
@@ -1,3 +1 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg">
-<path d="m4 2c-1.1046 0-2 0.89543-2 2v8c0 1.1046 0.89543 2 2 2h8c1.1046 0 2-0.89543 2-2v-8c0-1.1046-0.89543-2-2-2h-8zm7.293 2.293l1.4141 1.4141-6.707 6.707-2.707-2.707 1.4141-1.4141 1.293 1.293 5.293-5.293z" fill="#e0e0e0" fill-opacity=".78431"/>
-</svg>
+<svg height="16" viewBox="0 0 16 15.999999" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m3.3333333 1c-1.2887 0-2.3333333 1.0446683-2.3333333 2.3333333v9.3333337c0 1.2887 1.0446683 2.333333 2.3333333 2.333333h9.3333337c1.2887 0 2.333333-1.044668 2.333333-2.333333v-9.3333337c0-1.2887-1.044668-2.3333333-2.333333-2.3333333z" fill-opacity=".188235" stroke-width="1.166667"/><path d="m11.500773 3.7343508-5.6117507 5.6117502-1.7045017-1.6814543-1.4992276 1.4992276 3.2037293 3.1806817 7.1109777-7.1109775z" stroke-width="1.060227"/></g></svg> \ No newline at end of file
diff --git a/editor/icons/icon_GUI_radio_checked.svg b/editor/icons/icon_GUI_radio_checked.svg
index 6a65d49eeb..447b57f8ae 100644
--- a/editor/icons/icon_GUI_radio_checked.svg
+++ b/editor/icons/icon_GUI_radio_checked.svg
@@ -1,6 +1 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<circle cx="8" cy="1044.4" r="5" fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".78431" stroke-width="2"/>
-<circle cx="8" cy="1044.4" r="3" fill="#e0e0e0" fill-opacity=".78431"/>
-</g>
-</svg>
+<svg height="16" viewBox="0 0 16 15.999999" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><path d="m15 8a7 7 0 0 1 -7 7 7 7 0 0 1 -7-7 7 7 0 0 1 7-7 7 7 0 0 1 7 7" fill-opacity=".188235" stroke-width="2.333333"/><path d="m12 8a4 4 0 0 1 -4 4 4 4 0 0 1 -4-4 4 4 0 0 1 4-4 4 4 0 0 1 4 4" stroke-width="1.333333"/></g></svg> \ No newline at end of file
diff --git a/editor/icons/icon_GUI_radio_unchecked.svg b/editor/icons/icon_GUI_radio_unchecked.svg
index 6e52a8af77..1e8117bd10 100644
--- a/editor/icons/icon_GUI_radio_unchecked.svg
+++ b/editor/icons/icon_GUI_radio_unchecked.svg
@@ -1,5 +1 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<circle cx="8" cy="1044.4" r="5" fill="none" stroke="#e0e0e0" stroke-linecap="round" stroke-linejoin="round" stroke-opacity=".78431" stroke-width="2"/>
-</g>
-</svg>
+<svg height="16" viewBox="0 0 16 15.999999" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m15 8a7 7 0 0 1 -7 7 7 7 0 0 1 -7-7 7 7 0 0 1 7-7 7 7 0 0 1 7 7" fill="#e0e0e0" fill-opacity=".188235" stroke-width="2.333333"/></svg> \ No newline at end of file
diff --git a/editor/icons/icon_GUI_unchecked.svg b/editor/icons/icon_GUI_unchecked.svg
index 59df40954f..9575422df3 100644
--- a/editor/icons/icon_GUI_unchecked.svg
+++ b/editor/icons/icon_GUI_unchecked.svg
@@ -1,3 +1 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 15.999999" xmlns="http://www.w3.org/2000/svg">
-<path d="m4 2a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-8zm0.80078 2h6.3984a0.8 0.8 0 0 1 0.80078 0.80078v6.3984a0.8 0.8 0 0 1 -0.80078 0.80078h-6.3984a0.8 0.8 0 0 1 -0.80078 -0.80078v-6.3984a0.8 0.8 0 0 1 0.80078 -0.80078z" fill="#e0e0e0" fill-opacity=".78431"/>
-</svg>
+<svg height="16" viewBox="0 0 16 15.999999" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3.3333333 1c-1.2887 0-2.3333333 1.0446683-2.3333333 2.3333333v9.3333337c0 1.2887 1.0446683 2.333333 2.3333333 2.333333h9.3333337c1.2887 0 2.333333-1.044668 2.333333-2.333333v-9.3333337c0-1.2887-1.044668-2.3333333-2.333333-2.3333333z" fill="#e0e0e0" fill-opacity=".188235" stroke-width="1.166667"/></svg> \ No newline at end of file
diff --git a/editor/icons/icon_g_l_e_s_2.svg b/editor/icons/icon_g_l_e_s_2.svg
deleted file mode 100644
index efc4f01e4f..0000000000
--- a/editor/icons/icon_g_l_e_s_2.svg
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- id="svg2"
- width="48"
- height="16"
- viewBox="0 0 47.999999 16"
- sodipodi:docname="icon_g_l_e_s_2.svg"
- inkscape:version="0.92.3 (2405546, 2018-03-11)">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs6" />
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1484"
- inkscape:window-height="697"
- id="namedview4"
- showgrid="false"
- inkscape:zoom="13.520979"
- inkscape:cx="20.549976"
- inkscape:cy="7.9399684"
- inkscape:window-x="67"
- inkscape:window-y="27"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg2" />
- <path
- inkscape:connector-curvature="0"
- id="path835"
- d="m 19.839879,15.499154 c -0.0652,-0.0268 -0.141743,-0.1098 -0.170113,-0.184417 -0.03304,-0.08688 -0.05158,-0.95731 -0.05158,-5.912028 V 3.1830459 l 0.108486,-0.1379162 c 0.150269,-0.1910365 0.41814,-0.1907342 0.568677,6.436e-4 l 0.10899,0.1385579 -0.01358,6.2990785 c -0.01194,6.8660953 -0.0921,5.3381383 -0.0921,5.9327083 -0.106573,0.104434 -0.315006,0.142158 -0.458762,0.08303 z M 5.3808767,14.575188 C 4.5309456,14.518738 3.6260357,14.196602 2.9750499,13.718734 2.5767564,13.42636 2.0035795,12.787236 1.747789,12.350269 1.2385669,11.480363 1.0170768,10.580508 1.0213778,9.399057 1.0293972,7.2009406 1.9726797,5.5285643 3.6891526,4.6693537 4.7813316,4.1226444 6.2246017,4.0371807 7.4330177,4.4476602 8.1309525,4.6847376 8.4685433,4.8972607 9.0207129,5.4471587 9.4063328,5.8311907 9.5338898,6.0004852 9.7108978,6.3631718 9.8335428,6.6144683 9.9681328,6.9987435 10.020175,7.2461971 10.145759,7.8433551 10.170431,7.8289765 9.0218356,7.828057 8.5307356,7.8276009 8.0769363,7.8134035 8.0133918,7.7963663 7.9392662,7.7764919 7.8757344,7.6970176 7.8361313,7.5746239 7.5012661,6.5397183 6.6297764,6.0267536 5.4889128,6.193037 4.244092,6.3744711 3.4980921,7.3344965 3.343357,8.9541432 3.2260083,10.182472 3.5434132,11.329338 4.1781352,11.97041 c 0.46237,0.466997 0.9869175,0.673904 1.7084683,0.673904 1.2025378,0 1.9439704,-0.533034 2.1862936,-1.57178 0.055989,-0.240028 0.059178,-0.324448 0.012859,-0.341503 -0.033838,-0.01246 -0.5090516,-0.02871 -1.0560342,-0.03612 L 6.0352096,10.681458 V 9.8178001 8.9541431 l 1.9890278,-0.014575 c 1.0939663,-0.00802 2.0422396,-0.00163 2.1072756,0.014201 l 0.118246,0.028779 -0.01356,2.6814549 -0.01356,2.681455 -0.7170922,0.01455 c -0.8295927,0.01682 -0.7753286,0.05076 -0.8815155,-0.55106 -0.036825,-0.208719 -0.077853,-0.379487 -0.091164,-0.379487 -0.013311,0 -0.16916,0.135437 -0.3463303,0.300972 -0.3894417,0.363866 -0.8188673,0.600316 -1.3418506,0.738852 -0.4725114,0.125166 -0.8081647,0.149449 -1.4638111,0.10591 z M 32.49721,14.469781 c -0.928547,-0.194854 -1.630354,-0.56605 -2.174913,-1.150343 -0.515384,-0.552992 -0.832054,-1.344249 -0.800629,-2.000518 l 0.01549,-0.323408 1.060826,-0.01418 1.060825,-0.01418 0.05146,0.135352 c 0.0283,0.07444 0.0517,0.198593 0.05197,0.275887 8.54e-4,0.230559 0.229434,0.649361 0.479979,0.879354 0.347226,0.318744 0.735307,0.44853 1.431019,0.478576 1.267096,0.05472 2.007349,-0.393206 1.947849,-1.178652 -0.0456,-0.601928 -0.471503,-0.860841 -2.12876,-1.294103 C 32.881626,10.103917 32.242852,9.9264243 32.07283,9.8691486 30.95902,9.4939337 30.283515,8.9537559 29.97948,8.195172 29.836139,7.8375288 29.784025,7.0484225 29.874852,6.6109088 30.100606,5.5234588 31.071976,4.6456053 32.416011,4.314394 33.01697,4.1662997 34.128873,4.156633 34.77144,4.293917 c 1.67335,0.3575071 2.584333,1.270761 2.774448,2.7813655 0.0543,0.4314615 0.0347,0.4394334 -1.080484,0.4394334 -0.521251,0 -0.9851,-0.023133 -1.038665,-0.051802 C 35.367672,7.4313026 35.307808,7.3078793 35.273143,7.1462409 35.195527,6.7843357 35.099156,6.6147944 34.849667,6.4012402 34.543832,6.1394568 34.14764,6.029069 33.515213,6.0294329 c -0.428465,2.111e-4 -0.570793,0.021517 -0.784491,0.1172346 -0.47592,0.2131691 -0.654939,0.4628549 -0.654939,0.9134748 0,0.5904894 0.225799,0.7059322 2.58195,1.3200619 1.350552,0.3520209 1.903346,0.598685 2.415601,1.0778741 0.591219,0.5530567 0.852295,1.2543747 0.796412,2.1393787 -0.07929,1.255762 -0.891416,2.255747 -2.192274,2.699402 -0.885807,0.302103 -2.21918,0.374602 -3.180262,0.172924 z M 11.476954,14.306572 c -0.0138,-0.03619 -0.019,-2.268126 -0.01158,-4.9598581 l 0.0135,-4.8940567 1.066335,-0.01419 c 0.742348,-0.00988 1.088249,0.00399 1.138458,0.045665 0.06009,0.049873 0.07211,0.7135739 0.07211,3.9791612 v 3.9193056 h 2.293081 c 1.756352,0 2.314103,0.01538 2.382892,0.06567 0.07993,0.05845 0.08822,0.166396 0.07543,0.981428 l -0.01437,0.915757 -3.495384,0.01345 c -2.768549,0.0107 -3.500605,-1.69e-4 -3.520473,-0.05234 z m 10.193414,0.0026 c -0.04842,-0.04842 -0.06297,-1.193838 -0.06236,-4.9074882 4.61e-4,-2.6643823 0.01959,-4.8739347 0.04256,-4.9101166 0.03301,-0.05201 0.813774,-0.062971 3.728627,-0.052342 l 3.686862,0.013441 V 5.3948518 6.337024 l -2.5648,0.026171 -2.5648,0.026172 v 0.9421438 0.9421716 l 2.313597,0.026171 c 1.548367,0.017515 2.332217,0.044804 2.36989,0.082507 0.03673,0.036745 0.05127,0.3461819 0.04183,0.889829 l -0.01446,0.8334926 -2.355428,0.02617 -2.355429,0.02617 v 1.0992 1.099199 l 2.617143,0.0274 c 1.439428,0.01507 2.623562,0.03274 2.63141,0.03926 0.0078,0.0065 0.0078,0.441727 0,0.967118 l -0.01427,0.955257 -3.718613,0.01343 c -2.848812,0.01027 -3.733388,-0.0013 -3.781773,-0.04973 z m 17.753791,-0.378679 c -0.04061,-0.105824 0.0759,-0.828141 0.198829,-1.232689 0.288088,-0.948035 0.88431,-1.590368 2.319422,-2.498804 1.100465,-0.6965999 1.86374,-1.2293374 2.17747,-1.5198007 0.515251,-0.477031 0.731074,-1.0868265 0.620161,-1.7522036 -0.126353,-0.7579473 -0.607483,-1.1395723 -1.436711,-1.1395723 -0.930964,0 -1.401324,0.4507271 -1.481617,1.4197789 l -0.03634,0.4383927 h -1.099202 -1.099196 l -0.01524,-0.3725124 c -0.03408,-0.8332648 0.288934,-1.6827799 0.855164,-2.2490093 0.399774,-0.3997734 1.09283,-0.7574546 1.70958,-0.8822975 0.580047,-0.1174131 1.71432,-0.1077309 2.332892,0.019914 1.258364,0.2596698 2.203978,1.0560413 2.520675,2.1228587 0.104477,0.3519131 0.117355,0.4871812 0.09657,1.0144101 -0.01959,0.4962935 -0.04847,0.667451 -0.157022,0.9292002 -0.313508,0.7560998 -0.900391,1.3802206 -1.888823,2.0086882 -1.507571,0.958543 -1.915442,1.243322 -2.230808,1.557578 -0.26352,0.262604 -0.32016,0.345357 -0.261709,0.382352 0.04123,0.0261 1.061246,0.04757 2.280484,0.04802 1.96272,7.11e-4 2.209393,0.0099 2.237659,0.0836 0.01749,0.04554 0.03178,0.408703 0.03178,0.807033 0,0.398331 -0.0143,0.761495 -0.03178,0.807033 -0.0286,0.07445 -0.414152,0.0828 -3.822672,0.0828 -3.236429,0 -3.795092,-0.01093 -3.819578,-0.07475 z"
- style="fill:#5586a4;fill-opacity:1;stroke-width:0.05234285"
- sodipodi:nodetypes="ccscccccccccsscsscccccscccsccsccccccccccssscccccccccccccccscsccsccccsssscscccccccscscscccccccscccccccscccccccscccccccccccscccccsssccccccccscscc" />
- <path
- style="fill:#000000;stroke-width:1.06666672"
- d=""
- id="path819"
- inkscape:connector-curvature="0" />
- <path
- style="fill:#000000;stroke-width:1.06666672"
- d=""
- id="path817"
- inkscape:connector-curvature="0" />
-</svg>
diff --git a/editor/icons/icon_g_l_e_s_3.svg b/editor/icons/icon_g_l_e_s_3.svg
deleted file mode 100644
index dfa3c26b38..0000000000
--- a/editor/icons/icon_g_l_e_s_3.svg
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- id="svg2"
- width="48"
- height="16"
- viewBox="0 0 47.999999 16"
- sodipodi:docname="icon_g_l_e_s_3.svg"
- inkscape:version="0.92.3 (2405546, 2018-03-11)">
- <metadata
- id="metadata8">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs6" />
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1484"
- inkscape:window-height="697"
- id="namedview4"
- showgrid="false"
- inkscape:zoom="13.520979"
- inkscape:cx="20.549976"
- inkscape:cy="7.9399684"
- inkscape:window-x="67"
- inkscape:window-y="27"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg2" />
- <path
- style="fill:#6aa455;fill-opacity:1;stroke-width:0.05234285"
- d="M 20.011719 2.9023438 C 19.90715 2.9022255 19.801697 2.9494036 19.726562 3.0449219 L 19.619141 3.1835938 L 19.619141 9.4023438 C 19.619141 14.357062 19.636882 15.227573 19.669922 15.314453 C 19.698292 15.38907 19.774644 15.4732 19.839844 15.5 C 19.9836 15.559128 20.192255 15.52045 20.298828 15.416016 C 20.298828 14.821446 20.378685 16.35047 20.390625 9.484375 L 20.404297 3.1835938 L 20.294922 3.0449219 C 20.219653 2.949233 20.116287 2.902462 20.011719 2.9023438 z M 33.578125 4.1972656 C 33.144709 4.2010336 32.716495 4.240406 32.416016 4.3144531 C 31.071981 4.6456644 30.100754 5.5238781 29.875 6.6113281 C 29.784173 7.0488418 29.835175 7.8376693 29.978516 8.1953125 C 30.282551 8.9538964 30.958456 9.4939257 32.072266 9.8691406 C 32.242288 9.9264163 32.881487 10.104023 33.492188 10.263672 C 35.149445 10.696934 35.575494 10.956666 35.621094 11.558594 C 35.680594 12.34404 34.940924 12.791048 33.673828 12.736328 C 32.978116 12.706282 32.589413 12.576557 32.242188 12.257812 C 31.991643 12.02782 31.762573 11.609465 31.761719 11.378906 C 31.761449 11.301612 31.739238 11.176002 31.710938 11.101562 L 31.658203 10.966797 L 30.597656 10.980469 L 29.537109 10.996094 L 29.521484 11.318359 C 29.490059 11.974628 29.806882 12.767321 30.322266 13.320312 C 30.866825 13.904606 31.5695 14.275849 32.498047 14.470703 C 33.459129 14.672381 34.791927 14.598978 35.677734 14.296875 C 36.978592 13.85322 37.789851 12.853418 37.869141 11.597656 C 37.925024 10.712652 37.665438 10.012041 37.074219 9.4589844 C 36.561964 8.9797953 36.008755 8.7328803 34.658203 8.3808594 C 32.302052 7.7667297 32.076172 7.6510363 32.076172 7.0605469 C 32.076172 6.609927 32.254549 6.3596535 32.730469 6.1464844 C 32.944167 6.0507668 33.08716 6.029508 33.515625 6.0292969 C 34.148052 6.028933 34.543774 6.1386072 34.849609 6.4003906 C 35.099098 6.6139448 35.195822 6.7845792 35.273438 7.1464844 C 35.308103 7.3081228 35.366714 7.4312793 35.425781 7.4628906 C 35.479346 7.4915596 35.943593 7.515625 36.464844 7.515625 C 37.580028 7.515625 37.599222 7.5076334 37.544922 7.0761719 C 37.354807 5.5655674 36.444834 4.6504759 34.771484 4.2929688 C 34.450201 4.2243268 34.011541 4.1934977 33.578125 4.1972656 z M 5.5175781 4.1992188 C 4.8691862 4.2376134 4.2355426 4.3965672 3.6894531 4.6699219 C 1.9729802 5.5291325 1.0295038 7.2003211 1.0214844 9.3984375 C 1.0171834 10.579889 1.2388248 11.479703 1.7480469 12.349609 C 2.0038374 12.786576 2.5763159 13.426376 2.9746094 13.71875 C 3.6255952 14.196618 4.5309283 14.517769 5.3808594 14.574219 C 6.0365058 14.617758 6.3712386 14.593916 6.84375 14.46875 C 7.3667333 14.330214 7.7980583 14.094335 8.1875 13.730469 C 8.3646703 13.564934 8.5198921 13.429688 8.5332031 13.429688 C 8.5465141 13.429688 8.588175 13.599875 8.625 13.808594 C 8.7311869 14.410414 8.6762667 14.376195 9.5058594 14.359375 L 10.222656 14.345703 L 10.236328 11.664062 L 10.25 8.9824219 L 10.130859 8.953125 C 10.065823 8.937294 9.1174038 8.9314331 8.0234375 8.9394531 L 6.0351562 8.9550781 L 6.0351562 9.8183594 L 6.0351562 10.681641 L 7.0292969 10.695312 C 7.5762795 10.702722 8.0520995 10.718009 8.0859375 10.730469 C 8.1322565 10.747524 8.1282546 10.832238 8.0722656 11.072266 C 7.8299424 12.111012 7.0892565 12.644531 5.8867188 12.644531 C 5.1651679 12.644531 4.6401044 12.4377 4.1777344 11.970703 C 3.5430124 11.329631 3.2264013 10.183407 3.34375 8.9550781 C 3.4984851 7.3354314 4.2434605 6.3747935 5.4882812 6.1933594 C 6.6291449 6.027076 7.5010723 6.5393131 7.8359375 7.5742188 C 7.8755406 7.6966124 7.9395463 7.7770006 8.0136719 7.796875 C 8.0772164 7.8139122 8.5303844 7.8276689 9.0214844 7.828125 C 10.17008 7.8290445 10.145115 7.8432518 10.019531 7.2460938 C 9.967489 6.9986401 9.8335825 6.6145778 9.7109375 6.3632812 C 9.5339295 6.0005947 9.4071043 5.8312976 9.0214844 5.4472656 C 8.4693148 4.8973676 8.1315285 4.684343 7.4335938 4.4472656 C 6.8293858 4.2420259 6.16597 4.1608241 5.5175781 4.1992188 z M 42.03125 4.2617188 L 41.537109 4.4335938 C 40.933232 4.6433398 40.657695 4.8014669 40.300781 5.1386719 C 39.969225 5.4519119 39.761404 5.8046136 39.621094 6.2910156 C 39.502474 6.7023596 39.433137 7.3494687 39.498047 7.4492188 C 39.531044 7.4999487 39.783863 7.5127831 40.576172 7.5019531 L 41.611328 7.4863281 L 41.691406 7.0703125 C 41.808812 6.4678105 41.927622 6.2685471 42.265625 6.0957031 C 42.510424 5.9705181 42.604184 5.953125 43.019531 5.953125 C 43.426321 5.953125 43.533311 5.9721266 43.765625 6.0878906 C 44.253715 6.3311276 44.455638 6.904517 44.273438 7.53125 C 44.105442 8.109131 43.697334 8.363965 42.791016 8.453125 C 42.521874 8.479605 42.288464 8.51424 42.271484 8.53125 C 42.225224 8.577174 42.232777 9.7874244 42.279297 9.8339844 C 42.301291 9.8559744 42.598053 9.8907794 42.939453 9.9121094 C 43.836652 9.9681724 44.239534 10.166191 44.525391 10.691406 C 44.916028 11.409137 44.561069 12.318315 43.787109 12.582031 C 43.476088 12.688024 42.767292 12.688624 42.470703 12.583984 C 42.00204 12.418633 41.795632 12.174325 41.642578 11.597656 L 41.560547 11.285156 L 40.46875 11.285156 L 39.376953 11.285156 L 39.361328 11.527344 C 39.352678 11.660649 39.384791 11.918152 39.431641 12.099609 C 39.739925 13.294376 40.783209 14.156157 42.212891 14.396484 C 42.284425 14.408514 42.682741 14.422181 43.097656 14.425781 C 44.074936 14.434074 44.653306 14.320796 45.308594 13.996094 C 46.07786 13.61492 46.610204 13.058412 46.847656 12.382812 C 47.087412 11.700564 47.08166 10.999125 46.833984 10.333984 C 46.695621 9.962377 46.130198 9.3782416 45.6875 9.1503906 C 45.523031 9.0657476 45.386773 8.9810006 45.386719 8.9628906 C 45.386654 8.9447846 45.539488 8.8195027 45.724609 8.6835938 C 46.129744 8.3861558 46.390215 8.064434 46.53125 7.6875 C 46.963216 6.532963 46.370297 5.2063894 45.166016 4.6308594 C 44.482944 4.3044164 44.23589 4.2611938 43.072266 4.2617188 L 42.03125 4.2617188 z M 12.544922 4.4375 L 11.478516 4.453125 L 11.464844 9.3476562 C 11.457424 12.039388 11.462763 14.270451 11.476562 14.306641 C 11.49643 14.358812 12.229498 14.370075 14.998047 14.359375 L 18.492188 14.345703 L 18.507812 13.429688 C 18.520602 12.614656 18.511571 12.507669 18.431641 12.449219 C 18.362852 12.398929 17.80518 12.382812 16.048828 12.382812 L 13.755859 12.382812 L 13.755859 8.4628906 C 13.755859 5.1973033 13.743684 4.534248 13.683594 4.484375 C 13.633385 4.4427 13.28727 4.42762 12.544922 4.4375 z M 25.378906 4.4394531 C 22.464053 4.4288241 21.683401 4.4401775 21.650391 4.4921875 C 21.627421 4.5283694 21.607883 6.7379615 21.607422 9.4023438 C 21.606812 13.115994 21.621502 14.260174 21.669922 14.308594 C 21.718307 14.357024 22.60236 14.369645 25.451172 14.359375 L 29.169922 14.345703 L 29.185547 13.390625 C 29.193347 12.865234 29.193347 12.430328 29.185547 12.423828 C 29.177699 12.417308 27.992162 12.399836 26.552734 12.384766 L 23.935547 12.355469 L 23.935547 11.257812 L 23.935547 10.158203 L 26.291016 10.132812 L 28.646484 10.105469 L 28.662109 9.2714844 C 28.671549 8.7278373 28.655871 8.4195575 28.619141 8.3828125 C 28.581468 8.3451095 27.798367 8.3182962 26.25 8.3007812 L 23.935547 8.2734375 L 23.935547 7.3320312 L 23.935547 6.3886719 L 26.501953 6.3632812 L 29.066406 6.3378906 L 29.066406 5.3945312 L 29.066406 4.453125 L 25.378906 4.4394531 z "
- id="path3424" />
- <path
- style="fill:#000000;stroke-width:1.06666672"
- d=""
- id="path819"
- inkscape:connector-curvature="0" />
- <path
- style="fill:#000000;stroke-width:1.06666672"
- d=""
- id="path817"
- inkscape:connector-curvature="0" />
-</svg>
diff --git a/editor/import/resource_importer_layered_texture.cpp b/editor/import/resource_importer_layered_texture.cpp
index a0ed27c72c..afda07c1c2 100644
--- a/editor/import/resource_importer_layered_texture.cpp
+++ b/editor/import/resource_importer_layered_texture.cpp
@@ -304,7 +304,7 @@ Error ResourceImporterLayeredTexture::import(const String &p_source_file, const
}
if (!ok_on_pc) {
- EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correcly on PC.");
+ EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correctly on PC.");
}
} else {
//import normally
diff --git a/editor/import/resource_importer_texture.cpp b/editor/import/resource_importer_texture.cpp
index acca1725d7..5eb1a42f9f 100644
--- a/editor/import/resource_importer_texture.cpp
+++ b/editor/import/resource_importer_texture.cpp
@@ -499,7 +499,7 @@ Error ResourceImporterTexture::import(const String &p_source_file, const String
}
if (!ok_on_pc) {
- EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correcly on PC.");
+ EditorNode::add_io_error("Warning, no suitable PC VRAM compression enabled in Project Settings. This texture will not display correctly on PC.");
}
} else {
//import normally
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index 9145a66510..81a798f0b6 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -104,6 +104,7 @@ void InspectorDock::_menu_option(int p_option) {
res = duplicates[res];
current->set(E->get().name, res);
+ editor->get_inspector()->update_property(E->get().name);
}
}
}
@@ -158,7 +159,6 @@ void InspectorDock::_resource_file_selected(String p_file) {
RES res = ResourceLoader::load(p_file);
if (res.is_null()) {
- warning_dialog->get_ok()->set_text(TTR("OK"));
warning_dialog->set_text(TTR("Failed to load resource."));
return;
};
@@ -231,11 +231,10 @@ void InspectorDock::_prepare_history() {
already.insert(id);
- Ref<Texture> icon = get_icon("Object", "EditorIcons");
- if (has_icon(obj->get_class(), "EditorIcons"))
- icon = get_icon(obj->get_class(), "EditorIcons");
- else
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj, "");
+ if (icon.is_null()) {
icon = base_icon;
+ }
String text;
if (Object::cast_to<Resource>(obj)) {
@@ -320,7 +319,6 @@ void InspectorDock::_transform_keyed(Object *sp, const String &p_sub, const Tran
}
void InspectorDock::_warning_pressed() {
- warning_dialog->get_ok()->set_text(TTR("Ok"));
warning_dialog->popup_centered_minsize();
}
@@ -405,8 +403,8 @@ void InspectorDock::update(Object *p_object) {
PopupMenu *p = object_menu->get_popup();
p->clear();
- p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand all properties")), EXPAND_ALL);
- p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse all properties")), COLLAPSE_ALL);
+ p->add_shortcut(ED_SHORTCUT("property_editor/expand_all", TTR("Expand All Properties")), EXPAND_ALL);
+ p->add_shortcut(ED_SHORTCUT("property_editor/collapse_all", TTR("Collapse All Properties")), COLLAPSE_ALL);
p->add_separator();
if (is_resource) {
p->add_item(TTR("Save"), RESOURCE_SAVE);
diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp
index 2d341cdd93..f7e59e2beb 100644
--- a/editor/plugins/abstract_polygon_2d_editor.cpp
+++ b/editor/plugins/abstract_polygon_2d_editor.cpp
@@ -275,6 +275,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return (mb.is_valid() && mb->get_button_index() == 1);
}
+ CanvasItemEditor::Tool tool = CanvasItemEditor::get_singleton()->get_current_tool();
+ if (tool != CanvasItemEditor::TOOL_SELECT)
+ return false;
+
if (mb.is_valid()) {
Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
@@ -283,10 +287,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
-
if (mb->get_button_index() == BUTTON_LEFT) {
-
if (mb->is_pressed()) {
+ if (mb->get_control() || mb->get_shift() || mb->get_alt())
+ return false;
const PosVertex insert = closest_edge_point(gpoint);
@@ -512,12 +516,10 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
return false;
}
-void AbstractPolygon2DEditor::forward_draw_over_viewport(Control *p_overlay) {
+void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
if (!_get_node())
return;
- Control *vpc = canvas_item_editor->get_viewport_control();
-
Transform2D xform = canvas_item_editor->get_canvas_transform() * _get_node()->get_global_transform();
const Ref<Texture> handle = get_icon("EditorHandle", "EditorIcons");
@@ -558,7 +560,7 @@ void AbstractPolygon2DEditor::forward_draw_over_viewport(Control *p_overlay) {
Vector2 point = xform.xform(p);
Vector2 next_point = xform.xform(p2);
- vpc->draw_line(point, next_point, col, 2 * EDSCALE);
+ p_overlay->draw_line(point, next_point, col, 2 * EDSCALE);
}
}
@@ -582,7 +584,7 @@ void AbstractPolygon2DEditor::forward_draw_over_viewport(Control *p_overlay) {
p2 = points[(i + 1) % n_points] + offset;
const Vector2 next_point = xform.xform(p2);
- vpc->draw_line(point, next_point, col, 2 * EDSCALE);
+ p_overlay->draw_line(point, next_point, col, 2 * EDSCALE);
}
}
@@ -594,14 +596,14 @@ void AbstractPolygon2DEditor::forward_draw_over_viewport(Control *p_overlay) {
const Vector2 point = xform.xform(p);
const Color modulate = vertex == active_point ? Color(0.5, 1, 2) : Color(1, 1, 1);
- vpc->draw_texture(handle, point - handle->get_size() * 0.5, modulate);
+ p_overlay->draw_texture(handle, point - handle->get_size() * 0.5, modulate);
}
}
if (edge_point.valid()) {
Ref<Texture> add_handle = get_icon("EditorHandleAdd", "EditorIcons");
- vpc->draw_texture(add_handle, edge_point.pos - add_handle->get_size() * 0.5);
+ p_overlay->draw_texture(add_handle, edge_point.pos - add_handle->get_size() * 0.5);
}
}
diff --git a/editor/plugins/abstract_polygon_2d_editor.h b/editor/plugins/abstract_polygon_2d_editor.h
index 9ba03bcdf6..00634ba5b8 100644
--- a/editor/plugins/abstract_polygon_2d_editor.h
+++ b/editor/plugins/abstract_polygon_2d_editor.h
@@ -137,7 +137,7 @@ protected:
public:
bool forward_gui_input(const Ref<InputEvent> &p_event);
- void forward_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_draw_over_viewport(Control *p_overlay);
void edit(Node *p_polygon);
AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wip_destructive = true);
@@ -153,7 +153,7 @@ class AbstractPolygon2DEditorPlugin : public EditorPlugin {
public:
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return polygon_editor->forward_gui_input(p_event); }
- virtual void forward_draw_over_viewport(Control *p_overlay) { polygon_editor->forward_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { polygon_editor->forward_canvas_draw_over_viewport(p_overlay); }
bool has_main_screen() const { return false; }
virtual String get_name() const { return klass; }
diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp
index 4d27a5cea4..19d5243776 100644
--- a/editor/plugins/animation_blend_tree_editor_plugin.cpp
+++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp
@@ -241,7 +241,7 @@ void AnimationNodeBlendTreeEditor::_update_graph() {
mb->get_popup()->connect("index_pressed", this, "_anim_selected", varray(options, E->get()), CONNECT_DEFERRED);
}
- /* should be no longer necesary, as the boolean works
+ /* should be no longer necessary, as the boolean works
Ref<AnimationNodeOneShot> oneshot = agnode;
if (oneshot.is_valid()) {
@@ -542,11 +542,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
if (base->has_node(accum)) {
Node *node = base->get_node(accum);
- if (has_icon(node->get_class(), "EditorIcons")) {
- ti->set_icon(0, get_icon(node->get_class(), "EditorIcons"));
- } else {
- ti->set_icon(0, get_icon("Node", "EditorIcons"));
- }
+ ti->set_icon(0, EditorNode::get_singleton()->get_object_icon(node, "Node"));
}
} else {
@@ -559,7 +555,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
node = base->get_node(accum);
}
if (!node)
- continue; //no node, cant edit
+ continue; //no node, can't edit
if (path.get_subname_count()) {
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index bd7b58f65a..445664f8dd 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -908,7 +908,7 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
}
}
-void AnimationPlayerEditor::forward_force_draw_over_viewport(Control *p_overlay) {
+void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_overlay) {
if (!onion.can_overlay)
return;
@@ -1515,7 +1515,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
void AnimationPlayerEditor::_start_onion_skinning() {
- // FIXME: Using "idle_frame" makes onion layers update one frame behing the current
+ // FIXME: Using "idle_frame" makes onion layers update one frame behind the current
if (!get_tree()->is_connected("idle_frame", this, "call_deferred")) {
get_tree()->connect("idle_frame", this, "call_deferred", varray("_prepare_onion_layers_1"));
}
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index 5ac7b99903..55f082aadb 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -246,7 +246,7 @@ public:
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
void edit(AnimationPlayer *p_player);
- void forward_force_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_force_draw_over_viewport(Control *p_overlay);
AnimationPlayerEditor(EditorNode *p_editor, AnimationPlayerEditorPlugin *p_plugin);
};
@@ -271,7 +271,7 @@ public:
virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
- virtual void forward_force_draw_over_viewport(Control *p_overlay) { anim_editor->forward_force_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_force_draw_over_viewport(Control *p_overlay) { anim_editor->forward_canvas_force_draw_over_viewport(p_overlay); }
AnimationPlayerEditorPlugin(EditorNode *p_node);
~AnimationPlayerEditorPlugin();
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp
index d00c06bd12..e83773257b 100644
--- a/editor/plugins/animation_state_machine_editor.cpp
+++ b/editor/plugins/animation_state_machine_editor.cpp
@@ -663,7 +663,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() {
transition_lines.clear();
- //draw conecting line for potential new transition
+ //draw connecting line for potential new transition
if (connecting) {
Vector2 from = (state_machine->get_node_position(connecting_from) * EDSCALE) - state_machine->get_graph_offset() * EDSCALE;
Vector2 to;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 7fe9f429b0..406c3def0d 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -443,8 +443,12 @@ void CanvasItemEditor::_find_canvas_items_at_pos(const Point2 &p_pos, Node *p_no
CanvasItem *canvas_item = Object::cast_to<CanvasItem>(p_node);
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
- if (canvas_item && !canvas_item->is_set_as_toplevel()) {
- _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_limit, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ if (canvas_item) {
+ if (!canvas_item->is_set_as_toplevel()) {
+ _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_limit, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ } else {
+ _find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_limit, canvas_item->get_transform(), p_canvas_xform);
+ }
} else {
CanvasLayer *cl = Object::cast_to<CanvasLayer>(p_node);
_find_canvas_items_at_pos(p_pos, p_node->get_child(i), r_items, p_limit, Transform2D(), cl ? cl->get_transform() : p_canvas_xform);
@@ -610,8 +614,12 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n
if (!lock_children || !editable) {
for (int i = p_node->get_child_count() - 1; i >= 0; i--) {
- if (canvas_item && !canvas_item->is_set_as_toplevel()) {
- _find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ if (canvas_item) {
+ if (!canvas_item->is_set_as_toplevel()) {
+ _find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, p_parent_xform * canvas_item->get_transform(), p_canvas_xform);
+ } else {
+ _find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, canvas_item->get_transform(), p_canvas_xform);
+ }
} else {
CanvasLayer *canvas_layer = Object::cast_to<CanvasLayer>(p_node);
_find_canvas_items_in_rect(p_rect, p_node->get_child(i), r_items, Transform2D(), canvas_layer ? canvas_layer->get_transform() : p_canvas_xform);
@@ -1905,11 +1913,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
for (int i = 0; i < selection_results.size(); i++) {
CanvasItem *item = selection_results[i].item;
- Ref<Texture> icon;
- if (item->has_meta("_editor_icon"))
- icon = item->get_meta("_editor_icon");
- else
- icon = get_icon(has_icon(item->get_class(), "EditorIcons") ? item->get_class() : String("Object"), "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(item, "Node");
String node_path = "/" + root_name + "/" + root_path.rel_path_to(item->get_path());
selection_menu->add_item(item->get_name());
@@ -2046,10 +2050,7 @@ bool CanvasItemEditor::_gui_input_hover(const Ref<InputEvent> &p_event) {
_HoverResult hover_result;
hover_result.position = canvas_item->get_global_transform_with_canvas().get_origin();
- if (has_icon(canvas_item->get_class(), "EditorIcons"))
- hover_result.icon = get_icon(canvas_item->get_class(), "EditorIcons");
- else
- hover_result.icon = get_icon("Object", "EditorIcons");
+ hover_result.icon = EditorNode::get_singleton()->get_object_icon(canvas_item);
hover_result.name = canvas_item->get_name();
hovering_results_tmp.push_back(hover_result);
@@ -2898,7 +2899,7 @@ void CanvasItemEditor::_draw_hover() {
Size2 item_size = Size2(node_icon->get_size().x + 4 + node_name_size.x, MAX(node_icon->get_size().y, node_name_size.y - 3));
Point2 pos = transform.xform(hovering_results[i].position) - Point2(0, item_size.y) + (Point2(node_icon->get_size().x, -node_icon->get_size().y) / 4);
- // Rectify the position to avoid overlaping items
+ // Rectify the position to avoid overlapping items
for (List<Rect2>::Element *E = previous_rects.front(); E; E = E->next()) {
if (E->get().intersects(Rect2(pos, item_size))) {
pos.y = E->get().get_position().y - item_size.y;
@@ -2945,13 +2946,13 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p
float offset = 0;
Ref<Texture> lock = get_icon("LockViewport", "EditorIcons");
- if (p_node->has_meta("_edit_lock_")) {
+ if (p_node->has_meta("_edit_lock_") && show_edit_locks) {
lock->draw(viewport_canvas_item, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0));
offset += lock->get_size().x;
}
Ref<Texture> group = get_icon("GroupViewport", "EditorIcons");
- if (canvas_item->has_meta("_edit_group_")) {
+ if (canvas_item->has_meta("_edit_group_") && show_edit_locks) {
group->draw(viewport_canvas_item, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0));
//offset += group->get_size().x;
}
@@ -3025,6 +3026,7 @@ bool CanvasItemEditor::_build_bones_list(Node *p_node) {
}
void CanvasItemEditor::_draw_viewport() {
+
// Update the transform
transform = Transform2D();
transform.scale_basis(Size2(zoom, zoom));
@@ -3073,11 +3075,11 @@ void CanvasItemEditor::_draw_viewport() {
EditorPluginList *over_plugin_list = editor->get_editor_plugins_over();
if (!over_plugin_list->empty()) {
- over_plugin_list->forward_draw_over_viewport(viewport);
+ over_plugin_list->forward_canvas_draw_over_viewport(viewport);
}
EditorPluginList *force_over_plugin_list = editor->get_editor_plugins_force_over();
if (!force_over_plugin_list->empty()) {
- force_over_plugin_list->forward_force_draw_over_viewport(viewport);
+ force_over_plugin_list->forward_canvas_force_draw_over_viewport(viewport);
}
_draw_bones();
@@ -3550,6 +3552,12 @@ void CanvasItemEditor::_popup_callback(int p_op) {
view_menu->get_popup()->set_item_checked(idx, show_viewport);
viewport->update();
} break;
+ case SHOW_EDIT_LOCKS: {
+ show_edit_locks = !show_edit_locks;
+ int idx = view_menu->get_popup()->get_item_index(SHOW_EDIT_LOCKS);
+ view_menu->get_popup()->set_item_checked(idx, show_edit_locks);
+ viewport->update();
+ } break;
case SNAP_USE_NODE_PARENT: {
snap_node_parent = !snap_node_parent;
int idx = smartsnap_config_popup->get_item_index(SNAP_USE_NODE_PARENT);
@@ -4153,6 +4161,7 @@ Dictionary CanvasItemEditor::get_state() const {
state["show_rulers"] = show_rulers;
state["show_guides"] = show_guides;
state["show_helpers"] = show_helpers;
+ state["show_edit_locks"] = show_edit_locks;
state["snap_rotation"] = snap_rotation;
state["snap_relative"] = snap_relative;
state["snap_pixel"] = snap_pixel;
@@ -4272,6 +4281,12 @@ void CanvasItemEditor::set_state(const Dictionary &p_state) {
view_menu->get_popup()->set_item_checked(idx, show_helpers);
}
+ if (state.has("show_edit_locks")) {
+ show_edit_locks = state["show_edit_locks"];
+ int idx = view_menu->get_popup()->get_item_index(SHOW_EDIT_LOCKS);
+ view_menu->get_popup()->set_item_checked(idx, show_edit_locks);
+ }
+
if (state.has("snap_rotation")) {
snap_rotation = state["snap_rotation"];
int idx = snap_config_menu->get_popup()->get_item_index(SNAP_USE_ROTATION);
@@ -4397,7 +4412,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
zoom_plus = memnew(ToolButton);
zoom_hb->add_child(zoom_plus);
zoom_plus->connect("pressed", this, "_button_zoom_plus");
- zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom in"), KEY_MASK_CMD | KEY_PLUS));
+ zoom_plus->set_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_plus", TTR("Zoom in"), KEY_MASK_CMD | KEY_EQUAL)); // Usually direct access key for PLUS
zoom_plus->set_focus_mode(FOCUS_NONE);
updating_scroll = false;
@@ -4419,13 +4434,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), KEY_W));
move_button->set_tooltip(TTR("Move Mode"));
- scale_button = memnew(ToolButton);
- hb->add_child(scale_button);
- scale_button->set_toggle_mode(true);
- scale_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE));
- scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
- scale_button->set_tooltip(TTR("Scale Mode"));
-
rotate_button = memnew(ToolButton);
hb->add_child(rotate_button);
rotate_button->set_toggle_mode(true);
@@ -4433,6 +4441,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), KEY_E));
rotate_button->set_tooltip(TTR("Rotate Mode"));
+ scale_button = memnew(ToolButton);
+ hb->add_child(scale_button);
+ scale_button->set_toggle_mode(true);
+ scale_button->connect("pressed", this, "_button_tool_select", make_binds(TOOL_SCALE));
+ scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), KEY_S));
+ scale_button->set_tooltip(TTR("Scale Mode"));
+
hb->add_child(memnew(VSeparator));
list_select_button = memnew(ToolButton);
@@ -4542,6 +4557,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_guides", TTR("Show Guides"), KEY_Y), SHOW_GUIDES);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_origin", TTR("Show Origin")), SHOW_ORIGIN);
p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_viewport", TTR("Show Viewport")), SHOW_VIEWPORT);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_edit_locks", TTR("Show Group And Lock Icons")), SHOW_EDIT_LOCKS);
+
p->add_separator();
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION);
p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION);
@@ -4632,6 +4649,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
show_helpers = false;
show_rulers = true;
show_guides = true;
+ show_edit_locks = true;
zoom = 1;
view_offset = Point2(-150 - RULER_WIDTH, -95 - RULER_WIDTH);
previous_update_view_offset = view_offset; // Moves the view a little bit to the left so that (0,0) is visible. The values a relative to a 16/10 screen
@@ -4924,7 +4942,6 @@ void CanvasItemEditorViewport::_perform_drop_data() {
// Without root dropping multiple files is not allowed
if (!target_node && selected_files.size() > 1) {
- accept->get_ok()->set_text(TTR("Ok"));
accept->set_text(TTR("Cannot instantiate multiple nodes without root."));
accept->popup_centered_minsize();
return;
@@ -4986,7 +5003,6 @@ void CanvasItemEditorViewport::_perform_drop_data() {
files_str += error_files[i].get_file().get_basename() + ",";
}
files_str = files_str.substr(0, files_str.length() - 1);
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.c_str()));
accept->popup_centered_minsize();
}
diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h
index 61d77581d3..61631dee7d 100644
--- a/editor/plugins/canvas_item_editor_plugin.h
+++ b/editor/plugins/canvas_item_editor_plugin.h
@@ -71,8 +71,7 @@ class CanvasItemEditor : public VBoxContainer {
GDCLASS(CanvasItemEditor, VBoxContainer);
- EditorNode *editor;
-
+public:
enum Tool {
TOOL_SELECT,
TOOL_LIST_SELECT,
@@ -84,6 +83,9 @@ class CanvasItemEditor : public VBoxContainer {
TOOL_MAX
};
+private:
+ EditorNode *editor;
+
enum MenuOption {
SNAP_USE,
SNAP_USE_NODE_PARENT,
@@ -103,6 +105,7 @@ class CanvasItemEditor : public VBoxContainer {
SHOW_GUIDES,
SHOW_ORIGIN,
SHOW_VIEWPORT,
+ SHOW_EDIT_LOCKS,
LOCK_SELECTED,
UNLOCK_SELECTED,
GROUP_SELECTED,
@@ -223,6 +226,7 @@ class CanvasItemEditor : public VBoxContainer {
bool show_origin;
bool show_viewport;
bool show_helpers;
+ bool show_edit_locks;
float zoom;
Point2 view_offset;
Point2 previous_update_view_offset;
@@ -535,6 +539,8 @@ public:
Control *get_viewport_control() { return viewport; }
+ Tool get_current_tool() { return tool; }
+
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
void edit(CanvasItem *p_canvas_item);
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 9e052bb027..e3f364790a 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -415,7 +415,7 @@ void CollisionShape2DEditor::_get_current_shape_type() {
canvas_item_editor->get_viewport_control()->update();
}
-void CollisionShape2DEditor::forward_draw_over_viewport(Control *p_overlay) {
+void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
if (!node) {
return;
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h
index 10784f1129..fb7b2acb0f 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -75,7 +75,7 @@ protected:
public:
bool forward_canvas_gui_input(const Ref<InputEvent> &p_event);
- void forward_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_draw_over_viewport(Control *p_overlay);
void edit(Node *p_node);
CollisionShape2DEditor(EditorNode *p_editor);
@@ -89,7 +89,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin {
public:
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return collision_shape_2d_editor->forward_canvas_gui_input(p_event); }
- virtual void forward_draw_over_viewport(Control *p_overlay) { return collision_shape_2d_editor->forward_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { return collision_shape_2d_editor->forward_canvas_draw_over_viewport(p_overlay); }
virtual String get_name() const { return "CollisionShape2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index 72a746e95b..7f83865777 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/editor/plugins/editor_preview_plugins.cpp
@@ -78,7 +78,11 @@ bool EditorTexturePreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Texture");
}
-Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from) const {
+bool EditorTexturePreviewPlugin::should_generate_small_preview() const {
+ return true;
+}
+
+Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<Image> img;
Ref<AtlasTexture> atex = p_from;
@@ -100,8 +104,6 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from) const {
img = img->duplicate();
img->clear_mipmaps();
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
if (img->is_compressed()) {
if (img->decompress() != OK)
return Ref<Texture>();
@@ -109,22 +111,15 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from) const {
img->convert(Image::FORMAT_RGBA8);
}
- int width, height;
- if (img->get_width() > thumbnail_size && img->get_width() >= img->get_height()) {
-
- width = thumbnail_size;
- height = img->get_height() * thumbnail_size / img->get_width();
- } else if (img->get_height() > thumbnail_size && img->get_height() >= img->get_width()) {
-
- height = thumbnail_size;
- width = img->get_width() * thumbnail_size / img->get_height();
- } else {
-
- width = img->get_width();
- height = img->get_height();
+ Vector2 new_size = img->get_size();
+ if (new_size.x > p_size.x) {
+ new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x);
}
+ if (new_size.y > p_size.y) {
+ new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
+ }
+ img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
- img->resize(width, height);
post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
@@ -143,7 +138,7 @@ bool EditorImagePreviewPlugin::handles(const String &p_type) const {
return p_type == "Image";
}
-Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<Image> img = p_from;
@@ -153,8 +148,6 @@ Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from) const {
img = img->duplicate();
img->clear_mipmaps();
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
if (img->is_compressed()) {
if (img->decompress() != OK)
return Ref<Image>();
@@ -162,22 +155,15 @@ Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from) const {
img->convert(Image::FORMAT_RGBA8);
}
- int width, height;
- if (img->get_width() > thumbnail_size && img->get_width() >= img->get_height()) {
-
- width = thumbnail_size;
- height = img->get_height() * thumbnail_size / img->get_width();
- } else if (img->get_height() > thumbnail_size && img->get_height() >= img->get_width()) {
-
- height = thumbnail_size;
- width = img->get_width() * thumbnail_size / img->get_height();
- } else {
-
- width = img->get_width();
- height = img->get_height();
+ Vector2 new_size = img->get_size();
+ if (new_size.x > p_size.x) {
+ new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x);
+ }
+ if (new_size.y > p_size.y) {
+ new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
}
+ img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
- img->resize(width, height);
post_process_preview(img);
Ref<ImageTexture> ptex;
@@ -190,6 +176,9 @@ Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from) const {
EditorImagePreviewPlugin::EditorImagePreviewPlugin() {
}
+bool EditorImagePreviewPlugin::should_generate_small_preview() const {
+ return true;
+}
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////
bool EditorBitmapPreviewPlugin::handles(const String &p_type) const {
@@ -197,7 +186,7 @@ bool EditorBitmapPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "BitMap");
}
-Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<BitMap> bm = p_from;
@@ -227,8 +216,6 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from) const {
img.instance();
img->create(bm->get_size().width, bm->get_size().height, 0, Image::FORMAT_L8, data);
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
if (img->is_compressed()) {
if (img->decompress() != OK)
return Ref<Texture>();
@@ -236,22 +223,15 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from) const {
img->convert(Image::FORMAT_RGBA8);
}
- int width, height;
- if (img->get_width() > thumbnail_size && img->get_width() >= img->get_height()) {
-
- width = thumbnail_size;
- height = img->get_height() * thumbnail_size / img->get_width();
- } else if (img->get_height() > thumbnail_size && img->get_height() >= img->get_width()) {
-
- height = thumbnail_size;
- width = img->get_width() * thumbnail_size / img->get_height();
- } else {
-
- width = img->get_width();
- height = img->get_height();
+ Vector2 new_size = img->get_size();
+ if (new_size.x > p_size.x) {
+ new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x);
+ }
+ if (new_size.y > p_size.y) {
+ new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
}
+ img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
- img->resize(width, height);
post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
@@ -260,6 +240,10 @@ Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from) const {
return ptex;
}
+bool EditorBitmapPreviewPlugin::should_generate_small_preview() const {
+ return true;
+}
+
EditorBitmapPreviewPlugin::EditorBitmapPreviewPlugin() {
}
@@ -269,12 +253,12 @@ bool EditorPackedScenePreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "PackedScene");
}
-Ref<Texture> EditorPackedScenePreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorPackedScenePreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
- return generate_from_path(p_from->get_path());
+ return generate_from_path(p_from->get_path(), p_size);
}
-Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_path) const {
+Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_path, const Size2 p_size) const {
String temp_path = EditorSettings::get_singleton()->get_cache_dir();
String cache_base = ProjectSettings::get_singleton()->globalize_path(p_path).md5_text();
@@ -323,7 +307,11 @@ bool EditorMaterialPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Material"); //any material
}
-Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES &p_from) const {
+bool EditorMaterialPreviewPlugin::should_generate_small_preview() const {
+ return true;
+}
+
+Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<Material> material = p_from;
ERR_FAIL_COND_V(material.is_null(), Ref<Texture>());
@@ -346,10 +334,9 @@ Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES &p_from) const {
ERR_FAIL_COND_V(!img.is_valid(), Ref<ImageTexture>());
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
img->convert(Image::FORMAT_RGBA8);
- img->resize(thumbnail_size, thumbnail_size);
+ int thumbnail_size = MAX(p_size.x, p_size.y);
+ img->resize(thumbnail_size, thumbnail_size, Image::INTERPOLATE_CUBIC);
post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
ptex->create_from_image(img, 0);
@@ -490,7 +477,7 @@ bool EditorScriptPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Script");
}
-Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<Script> scr = p_from;
if (scr.is_null())
@@ -512,10 +499,9 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from) const {
int line = 0;
int col = 0;
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
Ref<Image> img;
img.instance();
+ int thumbnail_size = MAX(p_size.x, p_size.y);
img->create(thumbnail_size, thumbnail_size, 0, Image::FORMAT_RGBA8);
Color bg_color = EditorSettings::get_singleton()->get("text_editor/highlighting/background_color");
@@ -613,16 +599,15 @@ bool EditorAudioStreamPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "AudioStream");
}
-Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<AudioStream> stream = p_from;
ERR_FAIL_COND_V(stream.is_null(), Ref<Texture>());
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
PoolVector<uint8_t> img;
- int w = thumbnail_size;
- int h = thumbnail_size;
+
+ int w = p_size.x;
+ int h = p_size.y;
img.resize(w * h * 3);
PoolVector<uint8_t>::Write imgdata = img.write();
@@ -711,7 +696,7 @@ bool EditorMeshPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Mesh"); //any Mesh
}
-Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
Ref<Mesh> mesh = p_from;
ERR_FAIL_COND_V(mesh.is_null(), Ref<Texture>());
@@ -749,10 +734,17 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from) const {
VS::get_singleton()->instance_set_base(mesh_instance, RID());
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
img->convert(Image::FORMAT_RGBA8);
- img->resize(thumbnail_size, thumbnail_size);
+
+ Vector2 new_size = img->get_size();
+ if (new_size.x > p_size.x) {
+ new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x);
+ }
+ if (new_size.y > p_size.y) {
+ new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
+ }
+ img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
+
post_process_preview(img);
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
@@ -825,15 +817,12 @@ bool EditorFontPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "DynamicFontData");
}
-Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path) const {
+Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path, const Size2 p_size) const {
Ref<DynamicFontData> SampledFont;
SampledFont.instance();
SampledFont->set_font_path(p_path);
- int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size");
- thumbnail_size *= EDSCALE;
-
Ref<DynamicFont> sampled_font;
sampled_font.instance();
sampled_font->set_size(50);
@@ -864,7 +853,15 @@ Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path) c
ERR_FAIL_COND_V(img.is_null(), Ref<ImageTexture>());
img->convert(Image::FORMAT_RGBA8);
- img->resize(thumbnail_size, thumbnail_size);
+
+ Vector2 new_size = img->get_size();
+ if (new_size.x > p_size.x) {
+ new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x);
+ }
+ if (new_size.y > p_size.y) {
+ new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
+ }
+ img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC);
post_process_preview(img);
@@ -874,9 +871,9 @@ Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path) c
return ptex;
}
-Ref<Texture> EditorFontPreviewPlugin::generate(const RES &p_from) const {
+Ref<Texture> EditorFontPreviewPlugin::generate(const RES &p_from, const Size2 p_size) const {
- return generate_from_path(p_from->get_path());
+ return generate_from_path(p_from->get_path(), p_size);
}
EditorFontPreviewPlugin::EditorFontPreviewPlugin() {
diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h
index 8bd7943383..ed5d2a3ecd 100644
--- a/editor/plugins/editor_preview_plugins.h
+++ b/editor/plugins/editor_preview_plugins.h
@@ -39,7 +39,8 @@ class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator)
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual bool should_generate_small_preview() const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorTexturePreviewPlugin();
};
@@ -48,7 +49,8 @@ class EditorImagePreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorImagePreviewPlugin, EditorResourcePreviewGenerator)
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual bool should_generate_small_preview() const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorImagePreviewPlugin();
};
@@ -57,7 +59,8 @@ class EditorBitmapPreviewPlugin : public EditorResourcePreviewGenerator {
GDCLASS(EditorBitmapPreviewPlugin, EditorResourcePreviewGenerator)
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual bool should_generate_small_preview() const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorBitmapPreviewPlugin();
};
@@ -66,8 +69,8 @@ class EditorPackedScenePreviewPlugin : public EditorResourcePreviewGenerator {
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
- virtual Ref<Texture> generate_from_path(const String &p_path) const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
+ virtual Ref<Texture> generate_from_path(const String &p_path, const Size2 p_size) const;
EditorPackedScenePreviewPlugin();
};
@@ -95,7 +98,8 @@ protected:
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual bool should_generate_small_preview() const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorMaterialPreviewPlugin();
~EditorMaterialPreviewPlugin();
@@ -104,7 +108,7 @@ public:
class EditorScriptPreviewPlugin : public EditorResourcePreviewGenerator {
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorScriptPreviewPlugin();
};
@@ -112,7 +116,7 @@ public:
class EditorAudioStreamPreviewPlugin : public EditorResourcePreviewGenerator {
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorAudioStreamPreviewPlugin();
};
@@ -139,7 +143,7 @@ protected:
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
EditorMeshPreviewPlugin();
~EditorMeshPreviewPlugin();
@@ -162,8 +166,8 @@ protected:
public:
virtual bool handles(const String &p_type) const;
- virtual Ref<Texture> generate(const RES &p_from) const;
- virtual Ref<Texture> generate_from_path(const String &p_path) const;
+ virtual Ref<Texture> generate(const RES &p_from, const Size2 p_size) const;
+ virtual Ref<Texture> generate_from_path(const String &p_path, const Size2 p_size) const;
EditorFontPreviewPlugin();
~EditorFontPreviewPlugin();
diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp
index 7b5de9c009..186e66f980 100644
--- a/editor/plugins/item_list_editor_plugin.cpp
+++ b/editor/plugins/item_list_editor_plugin.cpp
@@ -317,10 +317,7 @@ void ItemListEditor::edit(Node *p_item_list) {
item_plugins[i]->set_object(p_item_list);
property_editor->edit(item_plugins[i]);
- if (has_icon(item_list->get_class(), "EditorIcons"))
- toolbar_button->set_icon(get_icon(item_list->get_class(), "EditorIcons"));
- else
- toolbar_button->set_icon(Ref<Texture>());
+ toolbar_button->set_icon(EditorNode::get_singleton()->get_object_icon(item_list, ""));
selected_idx = i;
return;
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.cpp b/editor/plugins/light_occluder_2d_editor_plugin.cpp
index 4f8a307cc1..2f2e1dae81 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -319,13 +319,11 @@ bool LightOccluder2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return false;
}
-void LightOccluder2DEditor::forward_draw_over_viewport(Control *p_overlay) {
+void LightOccluder2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
if (!node || !node->get_occluder_polygon().is_valid())
return;
- Control *vpc = canvas_item_editor->get_viewport_control();
-
Vector<Vector2> poly;
if (wip_active)
@@ -353,9 +351,9 @@ void LightOccluder2DEditor::forward_draw_over_viewport(Control *p_overlay) {
if (i == poly.size() - 1 && (!node->get_occluder_polygon()->is_closed() || wip_active)) {
} else {
- vpc->draw_line(point, next_point, col, 2);
+ p_overlay->draw_line(point, next_point, col, 2);
}
- vpc->draw_texture(handle, point - handle->get_size() * 0.5);
+ p_overlay->draw_texture(handle, point - handle->get_size() * 0.5);
}
}
diff --git a/editor/plugins/light_occluder_2d_editor_plugin.h b/editor/plugins/light_occluder_2d_editor_plugin.h
index 39de8b1020..a1962892ee 100644
--- a/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -83,7 +83,7 @@ protected:
public:
Vector2 snap_point(const Vector2 &p_point) const;
- void forward_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_draw_over_viewport(Control *p_overlay);
bool forward_gui_input(const Ref<InputEvent> &p_event);
void edit(Node *p_collision_polygon);
LightOccluder2DEditor(EditorNode *p_editor);
@@ -98,7 +98,7 @@ class LightOccluder2DEditorPlugin : public EditorPlugin {
public:
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return light_occluder_editor->forward_gui_input(p_event); }
- virtual void forward_draw_over_viewport(Control *p_overlay) { return light_occluder_editor->forward_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { return light_occluder_editor->forward_canvas_draw_over_viewport(p_overlay); }
virtual String get_name() const { return "LightOccluder2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp
index 96c1ad2f2b..88b3194490 100644
--- a/editor/plugins/path_2d_editor_plugin.cpp
+++ b/editor/plugins/path_2d_editor_plugin.cpp
@@ -288,7 +288,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return false;
}
-void Path2DEditor::forward_draw_over_viewport(Control *p_overlay) {
+void Path2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
if (!node)
return;
diff --git a/editor/plugins/path_2d_editor_plugin.h b/editor/plugins/path_2d_editor_plugin.h
index 1e3955f84f..3a78657746 100644
--- a/editor/plugins/path_2d_editor_plugin.h
+++ b/editor/plugins/path_2d_editor_plugin.h
@@ -107,7 +107,7 @@ protected:
public:
bool forward_gui_input(const Ref<InputEvent> &p_event);
- void forward_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_draw_over_viewport(Control *p_overlay);
void edit(Node *p_path2d);
Path2DEditor(EditorNode *p_editor);
};
@@ -121,7 +121,7 @@ class Path2DEditorPlugin : public EditorPlugin {
public:
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return path2d_editor->forward_gui_input(p_event); }
- virtual void forward_draw_over_viewport(Control *p_overlay) { return path2d_editor->forward_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { return path2d_editor->forward_canvas_draw_over_viewport(p_overlay); }
virtual String get_name() const { return "Path2D"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index da6aa48f9c..dd327d0a2c 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -238,8 +238,7 @@ void ResourcePreloaderEditor::_update_library() {
ti->set_text(2, type);
ti->set_selectable(2, false);
- if (has_icon(type, "EditorIcons"))
- ti->set_icon(2, get_icon(type, "EditorIcons"));
+ ti->set_icon(2, EditorNode::get_singleton()->get_class_icon(type, ""));
}
//player->add_resource("default",resource);
diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp
index aac58507f2..b3adf19a64 100644
--- a/editor/plugins/root_motion_editor_plugin.cpp
+++ b/editor/plugins/root_motion_editor_plugin.cpp
@@ -109,11 +109,7 @@ void EditorPropertyRootMotion::_node_assign() {
if (base->has_node(accum)) {
Node *node = base->get_node(accum);
- if (has_icon(node->get_class(), "EditorIcons")) {
- ti->set_icon(0, get_icon(node->get_class(), "EditorIcons"));
- } else {
- ti->set_icon(0, get_icon("Node", "EditorIcons"));
- }
+ ti->set_icon(0, EditorNode::get_singleton()->get_object_icon(node, "Node"));
}
} else {
@@ -126,7 +122,7 @@ void EditorPropertyRootMotion::_node_assign() {
node = base->get_node(accum);
}
if (!node)
- continue; //no node, cant edit
+ continue; //no node, can't edit
if (path.get_subname_count()) {
@@ -235,14 +231,7 @@ void EditorPropertyRootMotion::update_property() {
ERR_FAIL_COND(!target_node);
assign->set_text(target_node->get_name());
-
- Ref<Texture> icon;
- if (has_icon(target_node->get_class(), "EditorIcons"))
- icon = get_icon(target_node->get_class(), "EditorIcons");
- else
- icon = get_icon("Node", "EditorIcons");
-
- assign->set_icon(icon);
+ assign->set_icon(EditorNode::get_singleton()->get_object_icon(target_node, "Node"));
}
void EditorPropertyRootMotion::setup(const NodePath &p_base_hint) {
@@ -314,7 +303,7 @@ bool EditorInspectorRootMotionPlugin::parse_property(Object *p_object, Variant::
return true;
}
- return false; //can be overriden, although it will most likely be last anyway
+ return false; //can be overridden, although it will most likely be last anyway
}
void EditorInspectorRootMotionPlugin::parse_end() {
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index f25ca4786e..c8e7bfb74b 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -59,25 +59,10 @@ void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text")));
}
-static bool _can_open_in_editor(Script *p_script) {
-
+static bool _is_built_in_script(Script *p_script) {
String path = p_script->get_path();
- if (path.find("::") != -1) {
- //refuse handling this if it can't be edited
-
- bool valid = false;
- for (int i = 0; i < EditorNode::get_singleton()->get_editor_data().get_edited_scene_count(); i++) {
- if (path.begins_with(EditorNode::get_singleton()->get_editor_data().get_scene_path(i))) {
- valid = true;
- break;
- }
- }
-
- return valid;
- }
-
- return true;
+ return path.find("::") != -1;
}
class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {
@@ -812,7 +797,7 @@ bool ScriptEditor::_test_script_times_on_disk(RES p_for_script) {
if (se) {
RES edited_res = se->get_edited_resource();
- if (edited_res.is_valid() && p_for_script != edited_res)
+ if (p_for_script.is_valid() && edited_res.is_valid() && p_for_script != edited_res)
continue;
if (edited_res->get_path() == "" || edited_res->get_path().find("local://") != -1 || edited_res->get_path().find("::") != -1)
@@ -2736,7 +2721,7 @@ void ScriptEditor::set_scene_root_script(Ref<Script> p_script) {
if (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")))
return;
- if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) {
+ if (open_dominant && p_script.is_valid()) {
edit(p_script);
}
}
@@ -3148,7 +3133,6 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
error_dialog = memnew(AcceptDialog);
add_child(error_dialog);
- error_dialog->get_ok()->set_text(TTR("OK"));
debugger = memnew(ScriptEditorDebugger(editor));
debugger->connect("goto_script_line", this, "_goto_script_line");
@@ -3232,7 +3216,17 @@ ScriptEditor::~ScriptEditor() {
void ScriptEditorPlugin::edit(Object *p_object) {
if (Object::cast_to<Script>(p_object)) {
- script_editor->edit(Object::cast_to<Script>(p_object));
+
+ Script *p_script = Object::cast_to<Script>(p_object);
+ String scene_path = p_script->get_path().get_slice("::", 0);
+
+ if (_is_built_in_script(p_script) && !EditorNode::get_singleton()->is_scene_open(scene_path)) {
+ EditorNode::get_singleton()->load_scene(scene_path);
+
+ script_editor->call_deferred("edit", p_script);
+ } else {
+ script_editor->edit(p_script);
+ }
}
if (Object::cast_to<TextFile>(p_object)) {
@@ -3247,13 +3241,7 @@ bool ScriptEditorPlugin::handles(Object *p_object) const {
}
if (Object::cast_to<Script>(p_object)) {
-
- bool valid = _can_open_in_editor(Object::cast_to<Script>(p_object));
-
- if (!valid) { //user tried to open it by clicking
- EditorNode::get_singleton()->show_warning(TTR("Built-in scripts can only be edited when the scene they belong to is loaded"));
- }
- return valid;
+ return true;
}
return p_object->is_class("Script");
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 82c2e07940..d4ddaf274f 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -317,6 +317,7 @@ void ScriptTextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY:
_load_theme_settings();
+ _change_syntax_highlighter(EditorSettings::get_singleton()->get_project_metadata("script_text_editor", "syntax_highlighter", 0));
break;
}
}
@@ -1058,6 +1059,7 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
}
// highlighter_menu->set_item_checked(p_idx, true);
set_syntax_highlighter(highlighters[highlighter_menu->get_item_text(p_idx)]);
+ EditorSettings::get_singleton()->set_project_metadata("script_text_editor", "syntax_highlighter", p_idx);
}
void ScriptTextEditor::_bind_methods() {
@@ -1256,7 +1258,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
tx->deselect();
}
}
@@ -1556,7 +1558,7 @@ void ScriptTextEditor::register_editor() {
#endif
ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_T);
ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_Y);
- ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_X);
+ ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_I);
ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I);
#ifdef OSX_ENABLED
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 5ee40dc90a..361271af89 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -426,7 +426,7 @@ void ShaderEditor::ensure_select_current() {
void ShaderEditor::edit(const Ref<Shader> &p_shader) {
- if (p_shader.is_null())
+ if (p_shader.is_null() || !p_shader->is_text_shader())
return;
shader = p_shader;
@@ -480,7 +480,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
tx->deselect();
}
}
@@ -606,7 +606,7 @@ void ShaderEditorPlugin::edit(Object *p_object) {
bool ShaderEditorPlugin::handles(Object *p_object) const {
Shader *shader = Object::cast_to<Shader>(p_object);
- return shader != NULL;
+ return shader != NULL && shader->is_text_shader();
}
void ShaderEditorPlugin::make_visible(bool p_visible) {
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index e86424ee51..3e6a0ae81a 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -847,11 +847,7 @@ void SpatialEditorViewport::_list_select(Ref<InputEventMouseButton> b) {
Spatial *spat = selection_results[i].item;
- Ref<Texture> icon;
- if (spat->has_meta("_editor_icon"))
- icon = spat->get_meta("_editor_icon");
- else
- icon = get_icon(has_icon(spat->get_class(), "EditorIcons") ? spat->get_class() : String("Object"), "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(spat, "Node");
String node_path = "/" + root_name + "/" + root_path.rel_path_to(spat->get_path());
@@ -2316,12 +2312,12 @@ void SpatialEditorViewport::_draw() {
EditorPluginList *over_plugin_list = EditorNode::get_singleton()->get_editor_plugins_over();
if (!over_plugin_list->empty()) {
- over_plugin_list->forward_draw_over_viewport(surface);
+ over_plugin_list->forward_spatial_draw_over_viewport(surface);
}
EditorPluginList *force_over_plugin_list = editor->get_editor_plugins_force_over();
if (!force_over_plugin_list->empty()) {
- force_over_plugin_list->forward_force_draw_over_viewport(surface);
+ force_over_plugin_list->forward_spatial_force_draw_over_viewport(surface);
}
if (surface->has_focus()) {
@@ -2350,7 +2346,6 @@ void SpatialEditorViewport::_draw() {
Point2 center = _point_to_screen(_edit.center);
VisualServer::get_singleton()->canvas_item_add_line(ci, _edit.mouse_pos, center, Color(0.4, 0.7, 1.0, 0.8));
}
-
if (previewing) {
Size2 ss = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height"));
@@ -3271,7 +3266,6 @@ void SpatialEditorViewport::_perform_drop_data() {
files_str += error_files[i].get_file().get_basename() + ",";
}
files_str = files_str.substr(0, files_str.length() - 1);
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(vformat(TTR("Error instancing scene from %s"), files_str.c_str()));
accept->popup_centered_minsize();
}
@@ -3352,7 +3346,6 @@ void SpatialEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p
if (root_node) {
list.push_back(root_node);
} else {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("No parent to instance a child at."));
accept->popup_centered_minsize();
_remove_preview();
@@ -3360,7 +3353,6 @@ void SpatialEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p
}
}
if (list.size() != 1) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation requires a single selected node."));
accept->popup_centered_minsize();
_remove_preview();
@@ -4425,6 +4417,8 @@ void SpatialEditor::_menu_item_pressed(int p_option) {
void SpatialEditor::_init_indicators() {
{
+ origin_enabled = true;
+ grid_enabled = true;
indicator_mat.instance();
indicator_mat->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
@@ -4465,10 +4459,6 @@ void SpatialEditor::_init_indicators() {
VS::get_singleton()->instance_set_layer_mask(origin_instance, 1 << SpatialEditorViewport::GIZMO_GRID_LAYER);
VisualServer::get_singleton()->instance_geometry_set_cast_shadows_setting(origin_instance, VS::SHADOW_CASTING_SETTING_OFF);
-
- origin_enabled = true;
- grid_enabled = true;
- last_grid_snap = 1;
}
{
@@ -5290,6 +5280,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
tool_button[TOOL_MODE_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds);
tool_button[TOOL_MODE_SELECT]->set_tooltip(TTR("Select Mode (Q)") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection"));
+ hbc_menu->add_child(memnew(VSeparator));
+
tool_button[TOOL_MODE_MOVE] = memnew(ToolButton);
hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]);
tool_button[TOOL_MODE_MOVE]->set_toggle_mode(true);
@@ -5314,6 +5306,8 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
tool_button[TOOL_MODE_SCALE]->connect("pressed", this, "_menu_item_pressed", button_binds);
tool_button[TOOL_MODE_SCALE]->set_tooltip(TTR("Scale Mode (R)"));
+ hbc_menu->add_child(memnew(VSeparator));
+
tool_button[TOOL_MODE_LIST_SELECT] = memnew(ToolButton);
hbc_menu->add_child(tool_button[TOOL_MODE_LIST_SELECT]);
tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
@@ -5334,8 +5328,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", this, "_menu_item_pressed", button_binds);
tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock the selected object (can be moved)."));
- VSeparator *vs = memnew(VSeparator);
- hbc_menu->add_child(vs);
+ hbc_menu->add_child(memnew(VSeparator));
tool_option_button[TOOL_OPT_LOCAL_COORDS] = memnew(ToolButton);
hbc_menu->add_child(tool_option_button[TOOL_OPT_LOCAL_COORDS]);
@@ -5357,8 +5350,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
sct = ED_GET_SHORTCUT("spatial_editor/snap").ptr()->get_as_text();
tool_option_button[TOOL_OPT_USE_SNAP]->set_tooltip(vformat(TTR("Snap Mode (%s)"), sct));
- vs = memnew(VSeparator);
- hbc_menu->add_child(vs);
+ hbc_menu->add_child(memnew(VSeparator));
// Drag and drop support;
preview_node = memnew(Spatial);
@@ -5591,7 +5583,6 @@ void SpatialEditorPlugin::make_visible(bool p_visible) {
spatial_editor->show();
spatial_editor->set_process(true);
- spatial_editor->grab_focus();
} else {
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index 0e35ba8517..b7317cd593 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -510,7 +510,6 @@ private:
RID grid[3];
RID grid_instance[3];
bool grid_visible[3]; //currently visible
- float last_grid_snap;
bool grid_enable[3]; //should be always visible if true
bool grid_enabled;
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 16c25f3074..4ff7046a35 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -30,6 +30,8 @@
#include "text_editor.h"
+#include "editor_node.h"
+
void TextEditor::add_syntax_highlighter(SyntaxHighlighter *p_highlighter) {
highlighters[p_highlighter->get_name()] = p_highlighter;
highlighter_menu->add_radio_check_item(p_highlighter->get_name());
@@ -64,6 +66,7 @@ void TextEditor::_change_syntax_highlighter(int p_idx) {
el = el->next();
}
set_syntax_highlighter(highlighters[highlighter_menu->get_item_text(p_idx)]);
+ EditorSettings::get_singleton()->set_project_metadata("text_editor", "syntax_highlighter", p_idx);
}
void TextEditor::_load_theme_settings() {
@@ -158,10 +161,7 @@ String TextEditor::get_name() {
Ref<Texture> TextEditor::get_icon() {
- if (get_parent_control() && get_parent_control()->has_icon(text_file->get_class(), "EditorIcons")) {
- return get_parent_control()->get_icon(text_file->get_class(), "EditorIcons");
- }
- return Ref<Texture>();
+ return EditorNode::get_singleton()->get_object_icon(text_file.operator->(), "");
}
RES TextEditor::get_edited_resource() const {
@@ -299,7 +299,7 @@ void TextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY:
_load_theme_settings();
- set_syntax_highlighter(NULL);
+ _change_syntax_highlighter(EditorSettings::get_singleton()->get_project_metadata("text_editor", "syntax_highlighter", 0));
break;
}
}
@@ -475,7 +475,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
int to_column = tx->get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
tx->deselect();
}
}
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index a0adbfccff..aa4338d775 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -686,7 +686,7 @@ void TileMapEditor::_erase_selection() {
}
}
-void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) {
+void TileMapEditor::_draw_cell(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) {
Ref<Texture> t = node->get_tileset()->tile_get_texture(p_cell);
@@ -783,19 +783,19 @@ void TileMapEditor::_draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h
modulate.a = 0.5;
if (r.has_no_area())
- canvas_item_editor->draw_texture_rect(t, rect, false, modulate, p_transpose);
+ p_viewport->draw_texture_rect(t, rect, false, modulate, p_transpose);
else
- canvas_item_editor->draw_texture_rect_region(t, rect, r, modulate, p_transpose);
+ p_viewport->draw_texture_rect_region(t, rect, r, modulate, p_transpose);
}
-void TileMapEditor::_draw_fill_preview(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) {
+void TileMapEditor::_draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform) {
PoolVector<Vector2> points = _bucket_fill(p_point, false, true);
PoolVector<Vector2>::Read pr = points.read();
int len = points.size();
for (int i = 0; i < len; ++i) {
- _draw_cell(p_cell, pr[i], p_flip_h, p_flip_v, p_transpose, p_xform);
+ _draw_cell(p_viewport, p_cell, pr[i], p_flip_h, p_flip_v, p_transpose, p_xform);
}
}
@@ -1390,17 +1390,17 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
return false;
}
-void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
+void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
if (!node)
return;
Transform2D cell_xf = node->get_cell_transform();
- Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform();
+ Transform2D xform = p_overlay->get_canvas_transform() * node->get_global_transform();
Transform2D xform_inv = xform.affine_inverse();
- Size2 screen_size = canvas_item_editor->get_size();
+ Size2 screen_size = p_overlay->get_size();
{
Rect2 aabb;
aabb.position = node->world_to_map(xform_inv.xform(Vector2()));
@@ -1419,7 +1419,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
Vector2 to = xform.xform(node->map_to_world(Vector2(i, si.position.y + si.size.y + 1)));
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
- canvas_item_editor->draw_line(from, to, col, 1);
+ p_overlay->draw_line(from, to, col, 1);
if (max_lines-- == 0)
break;
}
@@ -1439,7 +1439,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
Vector2 from = xform.xform(node->map_to_world(Vector2(i, j), true) + ofs);
Vector2 to = xform.xform(node->map_to_world(Vector2(i, j + 1), true) + ofs);
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
- canvas_item_editor->draw_line(from, to, col, 1);
+ p_overlay->draw_line(from, to, col, 1);
if (max_lines-- == 0)
break;
@@ -1457,7 +1457,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
Vector2 to = xform.xform(node->map_to_world(Vector2(si.position.x + si.size.x + 1, i)));
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
- canvas_item_editor->draw_line(from, to, col, 1);
+ p_overlay->draw_line(from, to, col, 1);
if (max_lines-- == 0)
break;
@@ -1476,7 +1476,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
Vector2 from = xform.xform(node->map_to_world(Vector2(j, i), true) + ofs);
Vector2 to = xform.xform(node->map_to_world(Vector2(j + 1, i), true) + ofs);
Color col = i == 0 ? Color(1, 0.8, 0.2, 0.5) : Color(1, 0.3, 0.1, 0.2);
- canvas_item_editor->draw_line(from, to, col, 1);
+ p_overlay->draw_line(from, to, col, 1);
if (max_lines-- == 0)
break;
@@ -1493,7 +1493,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
points.push_back(xform.xform(node->map_to_world((rectangle.position + Point2(rectangle.size.x + 1, rectangle.size.y + 1)))));
points.push_back(xform.xform(node->map_to_world((rectangle.position + Point2(0, rectangle.size.y + 1)))));
- canvas_item_editor->draw_colored_polygon(points, Color(0.2, 0.8, 1, 0.4));
+ p_overlay->draw_colored_polygon(points, Color(0.2, 0.8, 1, 0.4));
}
if (mouse_over) {
@@ -1519,7 +1519,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
col = Color(1.0, 0.4, 0.2, 0.8);
for (int i = 0; i < 4; i++)
- canvas_item_editor->draw_line(endpoints[i], endpoints[(i + 1) % 4], col, 2);
+ p_overlay->draw_line(endpoints[i], endpoints[(i + 1) % 4], col, 2);
bool bucket_preview = EditorSettings::get_singleton()->get("editors/tile_map/bucket_fill_preview");
if (tool == TOOL_SELECTING || tool == TOOL_PICKING || !bucket_preview) {
@@ -1538,7 +1538,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
for (Map<Point2i, CellOp>::Element *E = paint_undo.front(); E; E = E->next()) {
- _draw_cell(ids[0], E->key(), flip_h, flip_v, transpose, xform);
+ _draw_cell(p_overlay, ids[0], E->key(), flip_h, flip_v, transpose, xform);
}
} else if (tool == TOOL_RECTANGLE_PAINT) {
@@ -1551,7 +1551,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
for (int i = rectangle.position.y; i <= rectangle.position.y + rectangle.size.y; i++) {
for (int j = rectangle.position.x; j <= rectangle.position.x + rectangle.size.x; j++) {
- _draw_cell(ids[0], Point2i(j, i), flip_h, flip_v, transpose, xform);
+ _draw_cell(p_overlay, ids[0], Point2i(j, i), flip_h, flip_v, transpose, xform);
}
}
} else if (tool == TOOL_PASTING) {
@@ -1573,7 +1573,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
TileData tcd = E->get();
- _draw_cell(tcd.cell, tcd.pos + ofs, tcd.flip_h, tcd.flip_v, tcd.transpose, xform);
+ _draw_cell(p_overlay, tcd.cell, tcd.pos + ofs, tcd.flip_h, tcd.flip_v, tcd.transpose, xform);
}
Rect2i duplicate = rectangle;
@@ -1585,12 +1585,12 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
points.push_back(xform.xform(node->map_to_world((duplicate.position + Point2(duplicate.size.x + 1, duplicate.size.y + 1)))));
points.push_back(xform.xform(node->map_to_world((duplicate.position + Point2(0, duplicate.size.y + 1)))));
- canvas_item_editor->draw_colored_polygon(points, Color(0.2, 1.0, 0.8, 0.2));
+ p_overlay->draw_colored_polygon(points, Color(0.2, 1.0, 0.8, 0.2));
} else if (tool == TOOL_BUCKET) {
Vector<int> tiles = get_selected_tiles();
- _draw_fill_preview(tiles[0], over_tile, flip_h, flip_v, transpose, xform);
+ _draw_fill_preview(p_overlay, tiles[0], over_tile, flip_h, flip_v, transpose, xform);
} else {
@@ -1599,7 +1599,7 @@ void TileMapEditor::forward_draw_over_viewport(Control *p_overlay) {
if (st.size() == 1 && st[0] == TileMap::INVALID_CELL)
return;
- _draw_cell(st[0], over_tile, flip_h, flip_v, transpose, xform);
+ _draw_cell(p_overlay, st[0], over_tile, flip_h, flip_v, transpose, xform);
}
}
}
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index c824824d56..74aece6f47 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -168,8 +168,8 @@ class TileMapEditor : public VBoxContainer {
void _select(const Point2i &p_from, const Point2i &p_to);
void _erase_selection();
- void _draw_cell(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform);
- void _draw_fill_preview(int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform);
+ void _draw_cell(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform);
+ void _draw_fill_preview(Control *p_viewport, int p_cell, const Point2i &p_point, bool p_flip_h, bool p_flip_v, bool p_transpose, const Transform2D &p_xform);
void _clear_bucket_cache();
void _update_copydata();
@@ -206,7 +206,7 @@ public:
HBoxContainer *get_toolbar() const { return toolbar; }
bool forward_gui_input(const Ref<InputEvent> &p_event);
- void forward_draw_over_viewport(Control *p_overlay);
+ void forward_canvas_draw_over_viewport(Control *p_overlay);
void edit(Node *p_tile_map);
@@ -225,7 +225,7 @@ protected:
public:
virtual bool forward_canvas_gui_input(const Ref<InputEvent> &p_event) { return tile_map_editor->forward_gui_input(p_event); }
- virtual void forward_draw_over_viewport(Control *p_overlay) { tile_map_editor->forward_draw_over_viewport(p_overlay); }
+ virtual void forward_canvas_draw_over_viewport(Control *p_overlay) { tile_map_editor->forward_canvas_draw_over_viewport(p_overlay); }
virtual String get_name() const { return "TileMap"; }
bool has_main_screen() const { return false; }
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index cefed193ca..39e50ec7f8 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -510,6 +510,17 @@ void VisualShaderEditor::_connection_request(const String &p_from, int p_from_in
}
undo_redo->create_action("Nodes Connected");
+
+ List<VisualShader::Connection> conns;
+ visual_shader->get_node_connections(type, &conns);
+
+ for (List<VisualShader::Connection>::Element *E = conns.front(); E; E = E->next()) {
+ if (E->get().to_node == to && E->get().to_port == p_to_index) {
+ undo_redo->add_do_method(visual_shader.ptr(), "disconnect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ undo_redo->add_undo_method(visual_shader.ptr(), "connect_nodes", type, E->get().from_node, E->get().from_port, E->get().to_node, E->get().to_port);
+ }
+ }
+
undo_redo->add_do_method(visual_shader.ptr(), "connect_nodes", type, from, p_from_index, to, p_to_index);
undo_redo->add_undo_method(visual_shader.ptr(), "disconnect_nodes", type, from, p_from_index, to, p_to_index);
undo_redo->add_do_method(this, "_update_graph");
@@ -629,7 +640,7 @@ void VisualShaderEditor::_duplicate_nodes() {
int id = String(graph->get_child(i)->get_name()).to_int();
Ref<VisualShaderNode> node = visual_shader->get_node(type, id);
Ref<VisualShaderNodeOutput> output = node;
- if (output.is_valid()) //cant duplicate output
+ if (output.is_valid()) //can't duplicate output
continue;
if (node.is_valid()) {
nodes.push_back(id);
@@ -932,7 +943,10 @@ public:
class VisualShaderNodePluginDefaultEditor : public VBoxContainer {
GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer)
public:
- void _property_changed(const String &prop, const Variant &p_value) {
+ void _property_changed(const String &prop, const Variant &p_value, bool p_changing = false) {
+
+ if (p_changing)
+ return;
UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
@@ -979,7 +993,7 @@ public:
}
static void _bind_methods() {
- ClassDB::bind_method("_property_changed", &VisualShaderNodePluginDefaultEditor::_property_changed);
+ ClassDB::bind_method("_property_changed", &VisualShaderNodePluginDefaultEditor::_property_changed, DEFVAL(false));
ClassDB::bind_method("_node_changed", &VisualShaderNodePluginDefaultEditor::_node_changed);
ClassDB::bind_method("_refresh_request", &VisualShaderNodePluginDefaultEditor::_refresh_request);
}
@@ -1158,7 +1172,7 @@ bool EditorInspectorShaderModePlugin::parse_property(Object *p_object, Variant::
return true;
}
- return false; //can be overriden, although it will most likely be last anyway
+ return false; //can be overridden, although it will most likely be last anyway
}
void EditorInspectorShaderModePlugin::parse_end() {
diff --git a/editor/project_export.cpp b/editor/project_export.cpp
index aba89a87ee..fa6dce1771 100644
--- a/editor/project_export.cpp
+++ b/editor/project_export.cpp
@@ -655,16 +655,9 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
file->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
file->set_text(0, p_dir->get_file(i));
- Ref<Texture> tex;
- if (has_icon(type, editor_icons)) {
- tex = get_icon(type, editor_icons);
- } else {
- tex = get_icon("Object", editor_icons);
- }
-
String path = p_dir->get_file_path(i);
- file->set_icon(0, tex);
+ file->set_icon(0, EditorNode::get_singleton()->get_class_icon(type));
file->set_editable(0, true);
file->set_checked(0, current->has_export_file(path));
file->set_metadata(0, path);
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index f494c84efa..91ab5b4dff 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -41,7 +41,6 @@
#include "core/translation.h"
#include "core/version.h"
#include "core/version_hash.gen.h"
-#include "editor_initialize_ssl.h"
#include "editor_scale.h"
#include "editor_settings.h"
#include "editor_themes.h"
@@ -2059,8 +2058,6 @@ void ProjectListFilter::_bind_methods() {
ProjectListFilter::ProjectListFilter() {
- editor_initialize_certificates(); //for asset sharing
-
_current_filter = FILTER_NAME;
filter_option = memnew(OptionButton);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 1baf606e7b..7a68646f40 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -1840,9 +1840,9 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
input_editor->set_column_title(0, TTR("Action"));
input_editor->set_column_title(1, TTR("Deadzone"));
input_editor->set_column_expand(1, false);
- input_editor->set_column_min_width(1, 80);
+ input_editor->set_column_min_width(1, 80 * EDSCALE);
input_editor->set_column_expand(2, false);
- input_editor->set_column_min_width(2, 50);
+ input_editor->set_column_min_width(2, 50 * EDSCALE);
input_editor->connect("item_edited", this, "_action_edited");
input_editor->connect("item_activated", this, "_action_activated");
input_editor->connect("cell_selected", this, "_action_selected");
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index 1c2eedfc9c..508db2e03f 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -34,6 +34,7 @@
#include "core/io/image_loader.h"
#include "core/io/marshalls.h"
#include "core/io/resource_loader.h"
+#include "core/math/expression.h"
#include "core/os/input.h"
#include "core/os/keyboard.h"
#include "core/pair.h"
@@ -1531,21 +1532,24 @@ void CustomPropertyEditor::_modified(String p_string) {
updating = true;
switch (type) {
case Variant::INT: {
-
- if (evaluator)
- v = evaluator->eval(value_editor[0]->get_text());
- else
+ String text = value_editor[0]->get_text();
+ Ref<Expression> expr;
+ expr.instance();
+ Error err = expr->parse(text);
+ if (err != OK) {
v = value_editor[0]->get_text().to_int();
+ return;
+ } else {
+ v = expr->execute(Array(), NULL, false);
+ }
emit_signal("variant_changed");
} break;
case Variant::REAL: {
if (hint != PROPERTY_HINT_EXP_EASING) {
- if (evaluator)
- v = evaluator->eval(value_editor[0]->get_text());
- else
- v = value_editor[0]->get_text().to_double();
+ String text = value_editor[0]->get_text();
+ v = _parse_real_expression(text);
emit_signal("variant_changed");
}
@@ -1558,13 +1562,8 @@ void CustomPropertyEditor::_modified(String p_string) {
case Variant::VECTOR2: {
Vector2 vec;
- if (evaluator) {
- vec.x = evaluator->eval(value_editor[0]->get_text());
- vec.y = evaluator->eval(value_editor[1]->get_text());
- } else {
- vec.x = value_editor[0]->get_text().to_double();
- vec.y = value_editor[1]->get_text().to_double();
- }
+ vec.x = _parse_real_expression(value_editor[0]->get_text());
+ vec.y = _parse_real_expression(value_editor[1]->get_text());
v = vec;
_emit_changed_whole_or_field();
@@ -1572,17 +1571,11 @@ void CustomPropertyEditor::_modified(String p_string) {
case Variant::RECT2: {
Rect2 r2;
- if (evaluator) {
- r2.position.x = evaluator->eval(value_editor[0]->get_text());
- r2.position.y = evaluator->eval(value_editor[1]->get_text());
- r2.size.x = evaluator->eval(value_editor[2]->get_text());
- r2.size.y = evaluator->eval(value_editor[3]->get_text());
- } else {
- r2.position.x = value_editor[0]->get_text().to_double();
- r2.position.y = value_editor[1]->get_text().to_double();
- r2.size.x = value_editor[2]->get_text().to_double();
- r2.size.y = value_editor[3]->get_text().to_double();
- }
+
+ r2.position.x = _parse_real_expression(value_editor[0]->get_text());
+ r2.position.y = _parse_real_expression(value_editor[1]->get_text());
+ r2.size.x = _parse_real_expression(value_editor[2]->get_text());
+ r2.size.y = _parse_real_expression(value_editor[3]->get_text());
v = r2;
_emit_changed_whole_or_field();
@@ -1591,15 +1584,9 @@ void CustomPropertyEditor::_modified(String p_string) {
case Variant::VECTOR3: {
Vector3 vec;
- if (evaluator) {
- vec.x = evaluator->eval(value_editor[0]->get_text());
- vec.y = evaluator->eval(value_editor[1]->get_text());
- vec.z = evaluator->eval(value_editor[2]->get_text());
- } else {
- vec.x = value_editor[0]->get_text().to_double();
- vec.y = value_editor[1]->get_text().to_double();
- vec.z = value_editor[2]->get_text().to_double();
- }
+ vec.x = _parse_real_expression(value_editor[0]->get_text());
+ vec.y = _parse_real_expression(value_editor[1]->get_text());
+ vec.z = _parse_real_expression(value_editor[2]->get_text());
v = vec;
_emit_changed_whole_or_field();
@@ -1607,17 +1594,10 @@ void CustomPropertyEditor::_modified(String p_string) {
case Variant::PLANE: {
Plane pl;
- if (evaluator) {
- pl.normal.x = evaluator->eval(value_editor[0]->get_text());
- pl.normal.y = evaluator->eval(value_editor[1]->get_text());
- pl.normal.z = evaluator->eval(value_editor[2]->get_text());
- pl.d = evaluator->eval(value_editor[3]->get_text());
- } else {
- pl.normal.x = value_editor[0]->get_text().to_double();
- pl.normal.y = value_editor[1]->get_text().to_double();
- pl.normal.z = value_editor[2]->get_text().to_double();
- pl.d = value_editor[3]->get_text().to_double();
- }
+ pl.normal.x = _parse_real_expression(value_editor[0]->get_text());
+ pl.normal.y = _parse_real_expression(value_editor[1]->get_text());
+ pl.normal.z = _parse_real_expression(value_editor[2]->get_text());
+ pl.d = _parse_real_expression(value_editor[3]->get_text());
v = pl;
_emit_changed_whole_or_field();
@@ -1625,17 +1605,10 @@ void CustomPropertyEditor::_modified(String p_string) {
case Variant::QUAT: {
Quat q;
- if (evaluator) {
- q.x = evaluator->eval(value_editor[0]->get_text());
- q.y = evaluator->eval(value_editor[1]->get_text());
- q.z = evaluator->eval(value_editor[2]->get_text());
- q.w = evaluator->eval(value_editor[3]->get_text());
- } else {
- q.x = value_editor[0]->get_text().to_double();
- q.y = value_editor[1]->get_text().to_double();
- q.z = value_editor[2]->get_text().to_double();
- q.w = value_editor[3]->get_text().to_double();
- }
+ q.x = _parse_real_expression(value_editor[0]->get_text());
+ q.y = _parse_real_expression(value_editor[1]->get_text());
+ q.z = _parse_real_expression(value_editor[2]->get_text());
+ q.w = _parse_real_expression(value_editor[3]->get_text());
v = q;
_emit_changed_whole_or_field();
@@ -1645,21 +1618,12 @@ void CustomPropertyEditor::_modified(String p_string) {
Vector3 pos;
Vector3 size;
- if (evaluator) {
- pos.x = evaluator->eval(value_editor[0]->get_text());
- pos.y = evaluator->eval(value_editor[1]->get_text());
- pos.z = evaluator->eval(value_editor[2]->get_text());
- size.x = evaluator->eval(value_editor[3]->get_text());
- size.y = evaluator->eval(value_editor[4]->get_text());
- size.z = evaluator->eval(value_editor[5]->get_text());
- } else {
- pos.x = value_editor[0]->get_text().to_double();
- pos.y = value_editor[1]->get_text().to_double();
- pos.z = value_editor[2]->get_text().to_double();
- size.x = value_editor[3]->get_text().to_double();
- size.y = value_editor[4]->get_text().to_double();
- size.z = value_editor[5]->get_text().to_double();
- }
+ pos.x = _parse_real_expression(value_editor[0]->get_text());
+ pos.y = _parse_real_expression(value_editor[1]->get_text());
+ pos.z = _parse_real_expression(value_editor[2]->get_text());
+ size.x = _parse_real_expression(value_editor[3]->get_text());
+ size.y = _parse_real_expression(value_editor[4]->get_text());
+ size.z = _parse_real_expression(value_editor[5]->get_text());
v = AABB(pos, size);
_emit_changed_whole_or_field();
@@ -1668,11 +1632,7 @@ void CustomPropertyEditor::_modified(String p_string) {
Transform2D m;
for (int i = 0; i < 6; i++) {
- if (evaluator) {
- m.elements[i / 2][i % 2] = evaluator->eval(value_editor[i]->get_text());
- } else {
- m.elements[i / 2][i % 2] = value_editor[i]->get_text().to_double();
- }
+ m.elements[i / 2][i % 2] = _parse_real_expression(value_editor[i]->get_text());
}
v = m;
@@ -1683,12 +1643,7 @@ void CustomPropertyEditor::_modified(String p_string) {
Basis m;
for (int i = 0; i < 9; i++) {
-
- if (evaluator) {
- m.elements[i / 3][i % 3] = evaluator->eval(value_editor[i]->get_text());
- } else {
- m.elements[i / 3][i % 3] = value_editor[i]->get_text().to_double();
- }
+ m.elements[i / 3][i % 3] = _parse_real_expression(value_editor[i]->get_text());
}
v = m;
@@ -1699,25 +1654,14 @@ void CustomPropertyEditor::_modified(String p_string) {
Basis basis;
for (int i = 0; i < 9; i++) {
-
- if (evaluator) {
- basis.elements[i / 3][i % 3] = evaluator->eval(value_editor[(i / 3) * 4 + i % 3]->get_text());
- } else {
- basis.elements[i / 3][i % 3] = value_editor[(i / 3) * 4 + i % 3]->get_text().to_double();
- }
+ basis.elements[i / 3][i % 3] = _parse_real_expression(value_editor[(i / 3) * 4 + i % 3]->get_text());
}
Vector3 origin;
- if (evaluator) {
- origin.x = evaluator->eval(value_editor[3]->get_text());
- origin.y = evaluator->eval(value_editor[7]->get_text());
- origin.z = evaluator->eval(value_editor[11]->get_text());
- } else {
- origin.x = value_editor[3]->get_text().to_double();
- origin.y = value_editor[7]->get_text().to_double();
- origin.z = value_editor[11]->get_text().to_double();
- }
+ origin.x = _parse_real_expression(value_editor[3]->get_text());
+ origin.y = _parse_real_expression(value_editor[7]->get_text());
+ origin.z = _parse_real_expression(value_editor[11]->get_text());
v = Transform(basis, origin);
_emit_changed_whole_or_field();
@@ -1759,6 +1703,19 @@ void CustomPropertyEditor::_modified(String p_string) {
updating = false;
}
+real_t CustomPropertyEditor::_parse_real_expression(String text) {
+ Ref<Expression> expr;
+ expr.instance();
+ Error err = expr->parse(text);
+ real_t out;
+ if (err != OK) {
+ out = value_editor[0]->get_text().to_double();
+ } else {
+ out = expr->execute(Array(), NULL, false);
+ }
+ return out;
+}
+
void CustomPropertyEditor::_emit_changed_whole_or_field() {
if (!Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 7d7ab912ea..ee3a56d857 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -135,6 +135,9 @@ class CustomPropertyEditor : public Popup {
void _text_edit_changed();
void _file_selected(String p_file);
void _modified(String p_string);
+
+ real_t _parse_real_expression(String text);
+
void _range_modified(double p_value);
void _focus_enter();
void _focus_exit();
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index c9eba33f35..9042bdc7c1 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -31,6 +31,7 @@
#include "property_selector.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor_scale.h"
void PropertySelector::_text_changed(const String &p_newtext) {
@@ -161,10 +162,8 @@ void PropertySelector::_update_search() {
Ref<Texture> icon;
if (E->get().name == "Script Variables") {
icon = get_icon("Script", "EditorIcons");
- } else if (has_icon(E->get().name, "EditorIcons")) {
- icon = get_icon(E->get().name, "EditorIcons");
} else {
- icon = get_icon("Object", "EditorIcons");
+ icon = EditorNode::get_singleton()->get_class_icon(E->get().name);
}
category->set_icon(0, icon);
continue;
@@ -241,10 +240,8 @@ void PropertySelector::_update_search() {
if (E->get().name == "*Script Methods") {
icon = get_icon("Script", "EditorIcons");
script_methods = true;
- } else if (has_icon(rep, "EditorIcons")) {
- icon = get_icon(rep, "EditorIcons");
} else {
- icon = get_icon("Object", "EditorIcons");
+ icon = EditorNode::get_singleton()->get_class_icon(rep);
}
category->set_icon(0, icon);
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 9461f39aeb..ff6832177e 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -119,7 +119,6 @@ void SceneTreeDock::instance(const String &p_file) {
if (!edited_scene) {
current_option = -1;
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("No parent to instance a child at."));
accept->popup_centered_minsize();
return;
@@ -142,7 +141,6 @@ void SceneTreeDock::instance_scenes(const Vector<String> &p_files, Node *p_paren
if (!parent || !edited_scene) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("No parent to instance the scenes at."));
accept->popup_centered_minsize();
return;
@@ -164,7 +162,6 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
Ref<PackedScene> sdata = ResourceLoader::load(p_files[i]);
if (!sdata.is_valid()) {
current_option = -1;
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(vformat(TTR("Error loading scene from %s"), p_files[i]));
accept->popup_centered_minsize();
error = true;
@@ -174,7 +171,6 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
Node *instanced_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
if (!instanced_scene) {
current_option = -1;
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(vformat(TTR("Error instancing scene from %s"), p_files[i]));
accept->popup_centered_minsize();
error = true;
@@ -185,7 +181,6 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) {
- accept->get_ok()->set_text(TTR("Ok"));
accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i]));
accept->popup_centered_minsize();
error = true;
@@ -233,7 +228,6 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node
void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) {
Ref<PackedScene> sdata = ResourceLoader::load(p_file);
if (!sdata.is_valid()) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(vformat(TTR("Error loading scene from %s"), p_file));
accept->popup_centered_minsize();
return;
@@ -241,7 +235,6 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base)
Node *instanced_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
if (!instanced_scene) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(vformat(TTR("Error instancing scene from %s"), p_file));
accept->popup_centered_minsize();
return;
@@ -399,11 +392,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
const RefPtr empty;
editor_data->get_undo_redo().add_do_method(E->get(), "set_script", empty);
editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing);
-
- if (E->get()->has_meta("_editor_icon")) {
- editor_data->get_undo_redo().add_do_method(E->get(), "set_meta", "_editor_icon", get_icon(E->get()->get_class(), "EditorIcons"));
- editor_data->get_undo_redo().add_undo_method(E->get(), "set_meta", "_editor_icon", E->get()->get_meta("_editor_icon"));
- }
}
}
@@ -421,7 +409,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (scene_tree->get_selected() == edited_scene) {
current_option = -1;
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
break;
@@ -482,7 +469,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (editor_selection->is_selected(edited_scene)) {
current_option = -1;
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
break;
@@ -552,7 +538,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (editor_selection->is_selected(edited_scene)) {
current_option = -1;
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation can't be done on the tree root."));
accept->popup_centered_minsize();
break;
@@ -639,7 +624,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *scene = editor_data->get_edited_scene_root();
if (!scene) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation can't be done without a scene."));
accept->popup_centered_minsize();
break;
@@ -648,7 +632,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.size() != 1) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation requires a single selected node."));
accept->popup_centered_minsize();
break;
@@ -657,14 +640,12 @@ 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("OK"));
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("OK"));
accept->set_text(TTR("This operation can't be done on instanced scenes."));
accept->popup_centered_minsize();
break;
@@ -849,6 +830,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", (Object *)NULL);
editor_data->get_undo_redo().commit_action();
+ editor->edit_node(new_node);
+
} break;
default: {
@@ -1309,7 +1292,6 @@ bool SceneTreeDock::_validate_no_foreign() {
if (E->get() != edited_scene && E->get()->get_owner() != edited_scene) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("Can't operate on nodes from a foreign scene!"));
accept->popup_centered_minsize();
return false;
@@ -1317,7 +1299,6 @@ bool SceneTreeDock::_validate_no_foreign() {
if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get())) >= 0) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("Can't operate on nodes the current scene inherits from!"));
accept->popup_centered_minsize();
return false;
@@ -1501,19 +1482,6 @@ void SceneTreeDock::_script_created(Ref<Script> p_script) {
Ref<Script> existing = E->get()->get_script();
editor_data->get_undo_redo().add_do_method(E->get(), "set_script", p_script.get_ref_ptr());
editor_data->get_undo_redo().add_undo_method(E->get(), "set_script", existing);
-
- String icon_path;
- String name = p_script->get_language()->get_global_class_name(p_script->get_path(), NULL, &icon_path);
- if (ScriptServer::is_global_class(name)) {
- RES icon = ResourceLoader::load(icon_path);
- editor_data->get_undo_redo().add_do_method(E->get(), "set_meta", "_editor_icon", icon);
- String existing_name = existing.is_valid() ? existing->get_language()->get_global_class_name(existing->get_path()) : String();
- if (existing.is_null() || !ScriptServer::is_global_class(existing_name)) {
- editor_data->get_undo_redo().add_undo_method(E->get(), "set_meta", "_editor_icon", get_icon(E->get()->get_class(), "EditorIcons"));
- } else {
- editor_data->get_undo_redo().add_undo_method(E->get(), "set_meta", "_editor_icon", editor_data->script_class_get_icon_path(existing_name));
- }
- }
}
editor_data->get_undo_redo().commit_action();
@@ -1810,14 +1778,12 @@ void SceneTreeDock::_new_scene_from(String p_file) {
List<Node *> selection = editor_selection->get_selected_node_list();
if (selection.size() != 1) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("This operation requires a single selected node."));
accept->popup_centered_minsize();
return;
}
if (EditorNode::get_singleton()->is_scene_open(p_file)) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("Can't overwrite scene that is still open!"));
accept->popup_centered_minsize();
return;
@@ -1835,7 +1801,6 @@ void SceneTreeDock::_new_scene_from(String p_file) {
memdelete(copy);
if (err != OK) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("Couldn't save new scene. Likely dependencies (instances) couldn't be satisfied."));
accept->popup_centered_minsize();
return;
@@ -1847,14 +1812,12 @@ void SceneTreeDock::_new_scene_from(String p_file) {
err = ResourceSaver::save(p_file, sdata, flg);
if (err != OK) {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("Error saving scene."));
accept->popup_centered_minsize();
return;
}
_replace_with_branch_scene(p_file, base);
} else {
- accept->get_ok()->set_text(TTR("OK"));
accept->set_text(TTR("Error duplicating scene to save it."));
accept->popup_centered_minsize();
return;
@@ -2029,12 +1992,7 @@ void SceneTreeDock::_add_children_to_popup(Object *p_obj, int p_depth) {
if (!obj)
continue;
- Ref<Texture> icon;
-
- if (has_icon(obj->get_class(), "EditorIcons"))
- icon = get_icon(obj->get_class(), "EditorIcons");
- else
- icon = get_icon("Object", "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);
if (menu->get_item_count() == 0) {
menu->add_submenu_item(TTR("Sub-Resources"), "Sub-Resources");
@@ -2264,7 +2222,7 @@ void SceneTreeDock::_update_create_root_dialog() {
String name = l.get_slicec(' ', 0);
if (ScriptServer::is_global_class(name))
name = ScriptServer::get_global_class_base(name);
- button->set_icon(get_icon(name, "EditorIcons"));
+ button->set_icon(EditorNode::get_singleton()->get_class_icon(name));
button->connect("pressed", this, "_favorite_root_selected", make_binds(l));
}
}
@@ -2445,7 +2403,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
add_child(create_dialog);
create_dialog->connect("create", this, "_create");
create_dialog->connect("favorites_updated", this, "_update_create_root_dialog");
- EditorFileSystem::get_singleton()->connect("script_classes_updated", create_dialog, "_save_and_update_favorite_list");
rename_dialog = memnew(RenameDialog(scene_tree, &editor_data->get_undo_redo()));
add_child(rename_dialog);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index a45773003a..07670bb420 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -186,11 +186,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
item->set_collapsed(true);
}
- Ref<Texture> icon;
- if (p_node->has_meta("_editor_icon"))
- icon = p_node->get_meta("_editor_icon");
- else
- icon = get_icon((has_icon(p_node->get_class(), "EditorIcons") ? p_node->get_class() : String("Object")), "EditorIcons");
+ Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(p_node, "Node");
item->set_icon(0, icon);
item->set_metadata(0, p_node->get_path());
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp
index be255ba4aa..d8de775d36 100644
--- a/editor/script_create_dialog.cpp
+++ b/editor/script_create_dialog.cpp
@@ -164,7 +164,6 @@ void ScriptCreateDialog::_create_new() {
if (script_template != "") {
scr = ResourceLoader::load(script_template);
if (scr.is_null()) {
- alert->get_ok()->set_text(TTR("OK"));
alert->set_text(vformat(TTR("Error loading template '%s'"), script_template));
alert->popup_centered();
return;
@@ -201,7 +200,6 @@ void ScriptCreateDialog::_load_exist() {
String path = file_path->get_text();
RES p_script = ResourceLoader::load(path, "Script");
if (p_script.is_null()) {
- alert->get_ok()->set_text(TTR("OK"));
alert->set_text(vformat(TTR("Error loading script from %s"), path));
alert->popup_centered();
return;
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index c07220d42c..cc477314e9 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -428,8 +428,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
ObjectID id = ObjectID(p_data[i + 3]);
it->set_text(0, p_data[i + 1]);
- if (has_icon(p_data[i + 2], "EditorIcons"))
- it->set_icon(0, get_icon(p_data[i + 2], "EditorIcons"));
+ Ref<Texture> icon = EditorNode::get_singleton()->get_class_icon(p_data[i + 2], "");
+ if (icon.is_valid())
+ it->set_icon(0, icon);
it->set_metadata(0, id);
if (id == inspected_object_id) {
@@ -491,17 +492,19 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
pinfo.usage = PropertyUsageFlags(int(prop[4]));
Variant var = prop[5];
- String hint_string = pinfo.hint_string;
- if (hint_string.begins_with("RES:") && hint_string != "RES:") {
- String path = hint_string.substr(4, hint_string.length());
- var = ResourceLoader::load(path);
- }
-
if (is_new_object) {
//don't update.. it's the same, instead refresh
debugObj->prop_list.push_back(pinfo);
}
+ if (var.get_type() == Variant::STRING) {
+ String str = var;
+ var = str.substr(4, str.length());
+
+ if (str.begins_with("PATH"))
+ var = ResourceLoader::load(var);
+ }
+
debugObj->prop_values[pinfo.name] = var;
}
@@ -572,9 +575,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
PropertyHint h = PROPERTY_HINT_NONE;
String hs = String();
- if (n.begins_with("*")) {
-
- n = n.substr(1, n.length());
+ if (v.get_type() == Variant::OBJECT) {
h = PROPERTY_HINT_OBJECT_ID;
String s = v;
s = s.replace("[", "");
@@ -595,9 +596,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
PropertyHint h = PROPERTY_HINT_NONE;
String hs = String();
- if (n.begins_with("*")) {
-
- n = n.substr(1, n.length());
+ if (v.get_type() == Variant::OBJECT) {
h = PROPERTY_HINT_OBJECT_ID;
String s = v;
s = s.replace("[", "");
@@ -618,9 +617,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
PropertyHint h = PROPERTY_HINT_NONE;
String hs = String();
- if (n.begins_with("*")) {
-
- n = n.substr(1, n.length());
+ if (v.get_type() == Variant::OBJECT) {
h = PROPERTY_HINT_OBJECT_ID;
String s = v;
s = s.replace("[", "");
@@ -1717,6 +1714,32 @@ void ScriptEditorDebugger::_error_selected() {
emit_signal("goto_script_line", s, int(meta[1]) - 1);
}
+void ScriptEditorDebugger::_expand_errors_list() {
+
+ TreeItem *root = error_tree->get_root();
+ if (!root)
+ return;
+
+ TreeItem *item = root->get_children();
+ while (item) {
+ item->set_collapsed(false);
+ item = item->get_next();
+ }
+}
+
+void ScriptEditorDebugger::_collapse_errors_list() {
+
+ TreeItem *root = error_tree->get_root();
+ if (!root)
+ return;
+
+ TreeItem *item = root->get_children();
+ while (item) {
+ item->set_collapsed(true);
+ item = item->get_next();
+ }
+}
+
void ScriptEditorDebugger::set_hide_on_stop(bool p_hide) {
hide_on_stop = p_hide;
@@ -1861,6 +1884,8 @@ void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_error_selected"), &ScriptEditorDebugger::_error_selected);
ClassDB::bind_method(D_METHOD("_error_activated"), &ScriptEditorDebugger::_error_activated);
+ ClassDB::bind_method(D_METHOD("_expand_errors_list"), &ScriptEditorDebugger::_expand_errors_list);
+ ClassDB::bind_method(D_METHOD("_collapse_errors_list"), &ScriptEditorDebugger::_collapse_errors_list);
ClassDB::bind_method(D_METHOD("_profiler_activate"), &ScriptEditorDebugger::_profiler_activate);
ClassDB::bind_method(D_METHOD("_profiler_seeked"), &ScriptEditorDebugger::_profiler_seeked);
ClassDB::bind_method(D_METHOD("_clear_errors_list"), &ScriptEditorDebugger::_clear_errors_list);
@@ -1999,8 +2024,31 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
}
{ //errors
+ VBoxContainer *errvb = memnew(VBoxContainer);
+ errvb->set_name(TTR("Errors"));
+
HBoxContainer *errhb = memnew(HBoxContainer);
- errhb->set_name(TTR("Errors"));
+ errvb->add_child(errhb);
+
+ Button *expand_all = memnew(Button);
+ expand_all->set_text(TTR("Expand All"));
+ expand_all->connect("pressed", this, "_expand_errors_list");
+ errhb->add_child(expand_all);
+
+ Button *collapse_all = memnew(Button);
+ collapse_all->set_text(TTR("Collapse All"));
+ collapse_all->connect("pressed", this, "_collapse_errors_list");
+ errhb->add_child(collapse_all);
+
+ Control *space = memnew(Control);
+ space->set_h_size_flags(SIZE_EXPAND_FILL);
+ errhb->add_child(space);
+
+ clearbutton = memnew(Button);
+ clearbutton->set_text(TTR("Clear"));
+ clearbutton->set_h_size_flags(0);
+ clearbutton->connect("pressed", this, "_clear_errors_list");
+ errhb->add_child(clearbutton);
error_tree = memnew(Tree);
error_tree->set_columns(2);
@@ -2012,22 +2060,16 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
error_tree->set_select_mode(Tree::SELECT_ROW);
error_tree->set_hide_root(true);
- error_tree->set_h_size_flags(SIZE_EXPAND_FILL);
+ error_tree->set_v_size_flags(SIZE_EXPAND_FILL);
error_tree->set_allow_rmb_select(true);
error_tree->connect("item_rmb_selected", this, "_error_tree_item_rmb_selected");
- errhb->add_child(error_tree);
+ errvb->add_child(error_tree);
item_menu = memnew(PopupMenu);
item_menu->connect("id_pressed", this, "_item_menu_id_pressed");
error_tree->add_child(item_menu);
- clearbutton = memnew(Button);
- clearbutton->set_text(TTR("Clear"));
- clearbutton->set_v_size_flags(0);
- clearbutton->connect("pressed", this, "_clear_errors_list");
- errhb->add_child(clearbutton);
-
- tabs->add_child(errhb);
+ tabs->add_child(errvb);
}
{ // remote scene tree
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index 017619e56f..cebf6d785e 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -181,6 +181,9 @@ class ScriptEditorDebugger : public Control {
void _error_activated();
void _error_selected();
+ void _expand_errors_list();
+ void _collapse_errors_list();
+
void _profiler_activate(bool p_enable);
void _profiler_seeked();
diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp
index 97cdd43fee..fe384da75b 100644
--- a/editor/settings_config_dialog.cpp
+++ b/editor/settings_config_dialog.cpp
@@ -56,11 +56,7 @@ void EditorSettingsDialog::_settings_property_edited(const String &p_name) {
String full_name = inspector->get_full_item_path(p_name);
- // Small usability workaround to update the text color settings when the
- // color theme is changed
- if (full_name == "text_editor/theme/color_theme") {
- inspector->get_inspector()->update_tree();
- } else if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") {
+ if (full_name == "interface/theme/accent_color" || full_name == "interface/theme/base_color" || full_name == "interface/theme/contrast") {
EditorSettings::get_singleton()->set_manually("interface/theme/preset", "Custom"); // set preset to Custom
} else if (full_name.begins_with("text_editor/highlighting")) {
EditorSettings::get_singleton()->set_manually("text_editor/theme/color_theme", "Custom");
diff --git a/editor/translations/extract.py b/editor/translations/extract.py
index 0dee1819dd..ebb032fd6f 100755
--- a/editor/translations/extract.py
+++ b/editor/translations/extract.py
@@ -88,7 +88,7 @@ def process_file(f, fname):
unique_str.append(msg)
unique_loc[msg] = [location]
elif (not location in unique_loc[msg]):
- # Add additional location to previous occurence too
+ # Add additional location to previous occurrence too
msg_pos = main_po.find('\nmsgid "' + msg + '"')
if (msg_pos == -1):
print("Someone apparently thought writing Python was as easy as GDScript. Ping Akien.")
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 2efbb3f849..10be291b8d 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -598,7 +598,13 @@ Input::CursorShape InputDefault::get_default_cursor_shape() {
void InputDefault::set_default_cursor_shape(CursorShape p_shape) {
default_shape = p_shape;
- OS::get_singleton()->set_cursor_shape((OS::CursorShape)p_shape);
+ // The default shape is set in Viewport::_gui_input_event. To instantly
+ // see the shape in the viewport we need to trigger a mouse motion event.
+ Ref<InputEventMouseMotion> mm;
+ mm.instance();
+ mm->set_position(mouse_pos);
+ mm->set_global_position(mouse_pos);
+ parse_input_event(mm);
}
void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
diff --git a/main/main.cpp b/main/main.cpp
index 34aca032da..dac646ba70 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -73,66 +73,99 @@
#include "editor/doc/doc_data.h"
#include "editor/doc/doc_data_class_path.gen.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "editor/project_manager.h"
#endif
-static ProjectSettings *globals = NULL;
+/* Static members */
+
+// Singletons
+
+// Initialized in setup()
static Engine *engine = NULL;
+static ProjectSettings *globals = NULL;
static InputMap *input_map = NULL;
-static bool _start_success = false;
-static ScriptDebugger *script_debugger = NULL;
-AudioServer *audio_server = NULL;
-ARVRServer *arvr_server = NULL;
-PhysicsServer *physics_server = NULL;
-Physics2DServer *physics_2d_server = NULL;
-
-static MessageQueue *message_queue = NULL;
+static TranslationServer *translation_server = NULL;
static Performance *performance = NULL;
-
static PackedData *packed_data = NULL;
#ifdef MINIZIP_ENABLED
static ZipArchive *zip_packed_data = NULL;
#endif
static FileAccessNetworkClient *file_access_network_client = NULL;
-static TranslationServer *translation_server = NULL;
+static ScriptDebugger *script_debugger = NULL;
+static MessageQueue *message_queue = NULL;
+
+// Initialized in setup2()
+static AudioServer *audio_server = NULL;
+static ARVRServer *arvr_server = NULL;
+static PhysicsServer *physics_server = NULL;
+static Physics2DServer *physics_2d_server = NULL;
+// We error out if setup2() doesn't turn this true
+static bool _start_success = false;
+
+// Drivers
+
+static int video_driver_idx = -1;
+static int audio_driver_idx = -1;
+
+// Engine config/tools
+
+static bool editor = false;
+static bool project_manager = false;
+static String locale;
+static bool show_help = false;
+static bool auto_build_solutions = false;
+static bool auto_quit = false;
+static OS::ProcessID allow_focus_steal_pid = 0;
+
+// Display
static OS::VideoMode video_mode;
+static int init_screen = -1;
+static bool init_fullscreen = false;
static bool init_maximized = false;
static bool init_windowed = false;
-static bool init_fullscreen = false;
static bool init_always_on_top = false;
static bool init_use_custom_pos = false;
+static Vector2 init_custom_pos;
+static bool force_lowdpi = false;
+static bool use_vsync = true;
+
+// Debug
+
+static bool use_debug_profiler = false;
#ifdef DEBUG_ENABLED
static bool debug_collisions = false;
static bool debug_navigation = false;
#endif
static int frame_delay = 0;
-static Vector2 init_custom_pos;
-static int video_driver_idx = -1;
-static int audio_driver_idx = -1;
-static String locale;
-static bool use_debug_profiler = false;
-static bool force_lowdpi = false;
-static int init_screen = -1;
-static bool use_vsync = true;
-static bool editor = false;
-static bool show_help = false;
static bool disable_render_loop = false;
static int fixed_fps = -1;
-static bool auto_build_solutions = false;
-static bool auto_quit = false;
static bool print_fps = false;
-static OS::ProcessID allow_focus_steal_pid = 0;
-
-static bool project_manager = false;
+/* Helper methods */
+// Used by Mono module, should likely be registered in Engine singleton instead
+// FIXME: This is also not 100% accurate, `project_manager` is only true when it was requested,
+// but not if e.g. we fail to load and project and fallback to the manager.
bool Main::is_project_manager() {
return project_manager;
}
-void initialize_physics() {
+static String unescape_cmdline(const String &p_str) {
+ return p_str.replace("%20", " ");
+}
+
+static String get_full_version_string() {
+ String hash = String(VERSION_HASH);
+ if (hash.length() != 0)
+ hash = "." + hash.left(7);
+ return String(VERSION_FULL_BUILD) + hash;
+}
+// FIXME: Could maybe be moved to PhysicsServerManager and Physics2DServerManager directly
+// to have less code in main.cpp.
+void initialize_physics() {
/// 3D Physics Server
physics_server = PhysicsServerManager::new_server(ProjectSettings::get_singleton()->get(PhysicsServerManager::setting_property_name));
if (!physics_server) {
@@ -160,19 +193,6 @@ void finalize_physics() {
memdelete(physics_2d_server);
}
-static String unescape_cmdline(const String &p_str) {
-
- return p_str.replace("%20", " ");
-}
-
-static String get_full_version_string() {
-
- String hash = String(VERSION_HASH);
- if (hash.length() != 0)
- hash = "." + hash.left(7);
- return String(VERSION_FULL_BUILD) + hash;
-}
-
//#define DEBUG_INIT
#ifdef DEBUG_INIT
#define MAIN_PRINT(m_txt) print_line(m_txt)
@@ -277,6 +297,32 @@ void Main::print_help(const char *p_binary) {
#endif
}
+/* Engine initialization
+ *
+ * Consists of several methods that are called by each platform's specific main(argc, argv).
+ * To fully understand engine init, one should therefore start from the platform's main and
+ * see how it calls into the Main class' methods.
+ *
+ * The initialization is typically done in 3 steps (with the setup2 step triggered either
+ * automatically by setup, or manually in the platform's main).
+ *
+ * - setup(execpath, argc, argv, p_second_phase) is the main entry point for all platforms,
+ * responsible for the initialization of all low level singletons and core types, and parsing
+ * command line arguments to configure things accordingly.
+ * If p_second_phase is true, it will chain into setup2() (default behaviour). This is
+ * disabled on some platforms (Android, iOS, UWP) which trigger the second step in their
+ * own time.
+ *
+ * - setup2(p_main_tid_override) registers high level servers and singletons, displays the
+ * boot splash, then registers higher level types (scene, editor, etc.).
+ *
+ * - start() is the last step and that's where command line tools can run, or the main loop
+ * can be created eventually and the project settings put into action. That's also where
+ * the editor node is created, if relevant.
+ * start() does it own argument parsing for a subset of the command line arguments described
+ * in help, it's a bit messy and should be globalized with the setup() parsing somehow.
+ */
+
Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) {
RID_OwnerBase::init_rid();
@@ -756,7 +802,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (editor) {
packed_data->set_disabled(true);
globals->set_disable_feature_overrides(true);
- StreamPeerSSL::initialize_certs = false; //will be initialized by editor
}
#endif
@@ -1003,15 +1048,6 @@ error:
if (file_access_network_client)
memdelete(file_access_network_client);
- // Note 1: *zip_packed_data live into *packed_data
- // Note 2: PackedData::~PackedData destroy this.
- /*
-#ifdef MINIZIP_ENABLED
- if (zip_packed_data)
- memdelete( zip_packed_data );
-#endif
-*/
-
unregister_core_driver_types();
unregister_core_types();
@@ -1096,30 +1132,24 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
ERR_PRINTS("Non-existing or invalid boot splash at: " + boot_logo_path + ". Loading default splash.");
}
+ Color boot_bg_color = GLOBAL_DEF("application/boot_splash/bg_color", boot_splash_bg_color);
if (boot_logo.is_valid()) {
OS::get_singleton()->_msec_splash = OS::get_singleton()->get_ticks_msec();
- Color boot_bg = GLOBAL_DEF("application/boot_splash/bg_color", clear);
- VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg, boot_logo_scale);
-#ifndef TOOLS_ENABLED
-//no tools, so free the boot logo (no longer needed)
-//ProjectSettings::get_singleton()->set("application/boot_logo",Image());
-#endif
+ VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale);
} else {
#ifndef NO_DEFAULT_BOOT_LOGO
-
MAIN_PRINT("Main: Create bootsplash");
#if defined(TOOLS_ENABLED) && !defined(NO_EDITOR_SPLASH)
-
Ref<Image> splash = (editor || project_manager) ? memnew(Image(boot_splash_editor_png)) : memnew(Image(boot_splash_png));
#else
Ref<Image> splash = memnew(Image(boot_splash_png));
#endif
MAIN_PRINT("Main: ClearColor");
- VisualServer::get_singleton()->set_default_clear_color(boot_splash_bg_color);
+ VisualServer::get_singleton()->set_default_clear_color(boot_bg_color);
MAIN_PRINT("Main: Image");
- VisualServer::get_singleton()->set_boot_image(splash, boot_splash_bg_color, false);
+ VisualServer::get_singleton()->set_boot_image(splash, boot_bg_color, false);
#endif
}
@@ -1216,7 +1246,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
// everything the main loop needs to know about frame timings
-
static MainTimerSync main_timer_sync;
bool Main::start() {
@@ -1601,6 +1630,7 @@ bool Main::start() {
sml->set_use_font_oversampling(font_oversampling);
} else {
+
GLOBAL_DEF("display/window/stretch/mode", "disabled");
ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
GLOBAL_DEF("display/window/stretch/aspect", "ignore");
@@ -1660,6 +1690,10 @@ bool Main::start() {
}
if (!project_manager && !editor) { // game
+
+ // Load SSL Certificates from Project Settings (or builtin)
+ StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
+
if (game_path != "") {
Node *scene = NULL;
Ref<PackedScene> scenedata = ResourceLoader::load(local_game_path);
@@ -1692,6 +1726,15 @@ bool Main::start() {
sml->get_root()->add_child(pmanager);
OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN);
}
+
+ if (project_manager || editor) {
+ // Load SSL Certificates from Editor Settings (or builtin)
+ String certs = EditorSettings::get_singleton()->get_setting("network/ssl/editor_ssl_certificates").operator String();
+ if (certs != "")
+ StreamPeerSSL::load_certs_from_file(certs);
+ else
+ StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
+ }
#endif
}
@@ -1705,13 +1748,23 @@ bool Main::start() {
return true;
}
+/* Main iteration
+ *
+ * This is the iteration of the engine's game loop, advancing the state of physics,
+ * rendering and audio.
+ * It's called directly by the platform's OS::run method, where the loop is created
+ * and monitored.
+ *
+ * The OS implementation can impact its draw step with the Main::force_redraw() method.
+ */
+
uint64_t Main::last_ticks = 0;
uint64_t Main::target_ticks = 0;
uint32_t Main::frames = 0;
uint32_t Main::frame = 0;
bool Main::force_redraw_requested = false;
-//for performance metrics
+// For performance metrics
static uint64_t physics_process_max = 0;
static uint64_t idle_process_max = 0;
@@ -1735,11 +1788,6 @@ bool Main::iteration() {
Engine::get_singleton()->_frame_step = step;
- /*
- if (time_accum+step < frame_slice)
- return false;
- */
-
uint64_t physics_process_ticks = 0;
uint64_t idle_process_ticks = 0;
@@ -1883,9 +1931,15 @@ bool Main::iteration() {
}
void Main::force_redraw() {
-
force_redraw_requested = true;
-};
+}
+
+/* Engine deinitialization
+ *
+ * Responsible for freeing all the memory allocated by previous setup steps,
+ * so that the engine closes cleanly without leaking memory or crashing.
+ * The order matters as some of those steps are linked with each other.
+ */
void Main::cleanup() {
diff --git a/main/main.h b/main/main.h
index bd56e21d94..23a19dddec 100644
--- a/main/main.h
+++ b/main/main.h
@@ -49,13 +49,16 @@ class Main {
static bool force_redraw_requested;
public:
+ static bool is_project_manager();
+
static Error setup(const char *execpath, int argc, char *argv[], bool p_second_phase = true);
static Error setup2(Thread::ID p_main_tid_override = 0);
static bool start();
+
static bool iteration();
- static void cleanup();
static void force_redraw();
- static bool is_project_manager();
+
+ static void cleanup();
};
-#endif
+#endif // MAIN_H
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index 9b08ac4937..d25eedbf6f 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -235,7 +235,7 @@ public:
richtext->push_meta("http://www.scrollingcapabilities.xz");
richtext->add_text("This allows to test for the scrolling capabilities ");
richtext->pop();
- richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, althogh it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains...");
+ richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, although it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains...");
TabContainer *tabc = memnew(TabContainer);
diff --git a/main/timer_sync.cpp b/main/timer_sync.cpp
index 9f4f6ed271..275465914e 100644
--- a/main/timer_sync.cpp
+++ b/main/timer_sync.cpp
@@ -83,7 +83,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_
int min_typical_steps = typical_physics_steps[0];
int max_typical_steps = min_typical_steps + 1;
- // given the past recorded steps and typcial steps to match, calculate bounds for this
+ // given the past recorded steps and typical steps to match, calculate bounds for this
// step to be typical
bool update_typical = false;
diff --git a/methods.py b/methods.py
index 1bc10954ba..00c477635e 100644
--- a/methods.py
+++ b/methods.py
@@ -578,6 +578,9 @@ def generate_vs_project(env, num_jobs):
release_targets = ['bin\\godot.windows.opt.32.exe'] + ['bin\\godot.windows.opt.64.exe']
release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe'] + ['bin\\godot.windows.opt.tools.64.exe']
targets = debug_targets + release_targets + release_debug_targets
+ if not env.get('MSVS'):
+ env['MSVS']['PROJECTSUFFIX'] = '.vcxproj'
+ env['MSVS']['SOLUTIONSUFFIX'] = '.sln'
env.MSVSProject(
target=['#godot' + env['MSVSPROJECTSUFFIX']],
incs=env.vs_incs,
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp
index 08d8b8c6f6..3b44ab838e 100644
--- a/modules/bullet/godot_result_callbacks.cpp
+++ b/modules/bullet/godot_result_callbacks.cpp
@@ -164,9 +164,11 @@ bool GodotClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0)
}
btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) {
- btScalar res = btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
- m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
- return res;
+ if (convexResult.m_localShapeInfo)
+ m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
+ else
+ m_shapeId = 0;
+ return btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
}
bool GodotAllContactResultCallback::needsCollision(btBroadphaseProxy *proxy0) const {
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 2d0e74eb6f..f24c8670a3 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -351,7 +351,7 @@ void RigidBodyBullet::set_space(SpaceBullet *p_space) {
void RigidBodyBullet::dispatch_callbacks() {
/// The check isTransformChanged is necessary in order to call integrated forces only when the first transform is sent
- if ((btBody->isActive() || previousActiveState != btBody->isActive()) && force_integration_callback && isTransformChanged) {
+ if ((btBody->isKinematicObject() || btBody->isActive() || previousActiveState != btBody->isActive()) && force_integration_callback && isTransformChanged) {
if (omit_forces_integration)
btBody->clearForces();
@@ -774,10 +774,13 @@ Vector3 RigidBodyBullet::get_angular_velocity() const {
void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transform) {
if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
+ if (space)
+ btBody->setLinearVelocity((p_global_transform.getOrigin() - btBody->getWorldTransform().getOrigin()) / space->get_delta_time());
// The kinematic use MotionState class
godotMotionState->moveBody(p_global_transform);
}
btBody->setWorldTransform(p_global_transform);
+ scratch();
}
const btTransform &RigidBodyBullet::get_transform__bullet() const {
@@ -849,7 +852,7 @@ void RigidBodyBullet::on_exit_area(AreaBullet *p_area) {
bool wasTheAreaFound = false;
for (int i = 0; i < areaWhereIamCount; ++i) {
if (p_area == areasWhereIam[i]) {
- // The area was fount, just shift down all elements
+ // The area was found, just shift down all elements
for (int j = i; j < areaWhereIamCount; ++j) {
areasWhereIam.write[j] = areasWhereIam[j + 1];
}
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 5b220e1039..404cb8e37b 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -786,30 +786,32 @@ void SpaceBullet::check_body_collision() {
if (numContacts) {
btManifoldPoint &pt = contactManifold->getContactPoint(0);
#endif
- Vector3 collisionWorldPosition;
- Vector3 collisionLocalPosition;
- Vector3 normalOnB;
- float appliedImpulse = pt.m_appliedImpulse;
- B_TO_G(pt.m_normalWorldOnB, normalOnB);
-
- if (bodyA->can_add_collision()) {
- B_TO_G(pt.getPositionWorldOnB(), collisionWorldPosition);
- /// pt.m_localPointB Doesn't report the exact point in local space
- B_TO_G(pt.getPositionWorldOnB() - contactManifold->getBody1()->getWorldTransform().getOrigin(), collisionLocalPosition);
- bodyA->add_collision_object(bodyB, collisionWorldPosition, collisionLocalPosition, normalOnB, appliedImpulse, pt.m_index1, pt.m_index0);
- }
- if (bodyB->can_add_collision()) {
- B_TO_G(pt.getPositionWorldOnA(), collisionWorldPosition);
- /// pt.m_localPointA Doesn't report the exact point in local space
- B_TO_G(pt.getPositionWorldOnA() - contactManifold->getBody0()->getWorldTransform().getOrigin(), collisionLocalPosition);
- bodyB->add_collision_object(bodyA, collisionWorldPosition, collisionLocalPosition, normalOnB * -1, appliedImpulse * -1, pt.m_index0, pt.m_index1);
- }
+ if (pt.getDistance() <= 0.0) {
+ Vector3 collisionWorldPosition;
+ Vector3 collisionLocalPosition;
+ Vector3 normalOnB;
+ float appliedImpulse = pt.m_appliedImpulse;
+ B_TO_G(pt.m_normalWorldOnB, normalOnB);
+
+ if (bodyA->can_add_collision()) {
+ B_TO_G(pt.getPositionWorldOnB(), collisionWorldPosition);
+ /// pt.m_localPointB Doesn't report the exact point in local space
+ B_TO_G(pt.getPositionWorldOnB() - contactManifold->getBody1()->getWorldTransform().getOrigin(), collisionLocalPosition);
+ bodyA->add_collision_object(bodyB, collisionWorldPosition, collisionLocalPosition, normalOnB, appliedImpulse, pt.m_index1, pt.m_index0);
+ }
+ if (bodyB->can_add_collision()) {
+ B_TO_G(pt.getPositionWorldOnA(), collisionWorldPosition);
+ /// pt.m_localPointA Doesn't report the exact point in local space
+ B_TO_G(pt.getPositionWorldOnA() - contactManifold->getBody0()->getWorldTransform().getOrigin(), collisionLocalPosition);
+ bodyB->add_collision_object(bodyA, collisionWorldPosition, collisionLocalPosition, normalOnB * -1, appliedImpulse * -1, pt.m_index0, pt.m_index1);
+ }
#ifdef DEBUG_ENABLED
- if (is_debugging_contacts()) {
- add_debug_contact(collisionWorldPosition);
- }
+ if (is_debugging_contacts()) {
+ add_debug_contact(collisionWorldPosition);
+ }
#endif
+ }
}
}
}
diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp
index 0184018274..567485c2c7 100644
--- a/modules/csg/csg.cpp
+++ b/modules/csg/csg.cpp
@@ -292,12 +292,12 @@ void CSGBrushOperation::BuildPoly::_clip_segment(const CSGBrush *p_brush, int p_
for (int j = 0; j < 2; j++) {
if (edges[i].points[0] == segment_idx[0] || edges[i].points[1] == segment_idx[1] || edges[i].points[0] == segment_idx[1] || edges[i].points[1] == segment_idx[0]) {
- edge_valid = false; //segment has this point, cant check against this
+ edge_valid = false; //segment has this point, can't check against this
break;
}
}
- if (!edge_valid) //already hit a point in this edge, so dont test it
+ if (!edge_valid) //already hit a point in this edge, so don't test it
continue;
//see if either points are within the edge isntead of crossing it
@@ -573,7 +573,7 @@ void CSGBrushOperation::_collision_callback(const CSGBrush *A, int p_face_a, Map
}
}
- //if we are still here, it means they most likely intersect, so create BuildPolys if they dont existy
+ //if we are still here, it means they most likely intersect, so create BuildPolys if they don't exist
BuildPoly *poly_a = NULL;
@@ -896,7 +896,7 @@ void CSGBrushOperation::_merge_poly(MeshMerge &mesh, int p_face_idx, const Build
Vector2 to = p_poly.points[to_idx].point;
with_outline_vertex = l;
- //try agaisnt outline (other points) first
+ //try against outline (other points) first
valid = true;
@@ -915,7 +915,7 @@ void CSGBrushOperation::_merge_poly(MeshMerge &mesh, int p_face_idx, const Build
if (!valid)
continue;
- //try agaisnt all holes including self
+ //try against all holes including self
for (int m = 0; m < polys[i].holes.size(); m++) {
diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
index fab4b05da9..76c551e8d7 100644
--- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
+++ b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml
@@ -36,7 +36,7 @@
<argument index="4" name="client_port" type="int" default="0">
</argument>
<description>
- Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain nome (e.g. [code]www.example.com[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]192.168.1.1[/code]). The [code]port[/code] is the port the server is listening on. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [code]OK[/code] if a client was created, [code]ERR_ALREADY_IN_USE[/code] if this NetworkedMultiplayerEnet instance already has an open connection (in which case you need to call [method close_connection] first) or [code]ERR_CANT_CREATE[/code] if the client could not be created. If [code]client_port[/code] is specified, the client will also listen to the given port, this is useful in some NAT traveral technique.
+ Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain nome (e.g. [code]www.example.com[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]192.168.1.1[/code]). The [code]port[/code] is the port the server is listening on. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [code]OK[/code] if a client was created, [code]ERR_ALREADY_IN_USE[/code] if this NetworkedMultiplayerEnet instance already has an open connection (in which case you need to call [method close_connection] first) or [code]ERR_CANT_CREATE[/code] if the client could not be created. If [code]client_port[/code] is specified, the client will also listen to the given port, this is useful in some NAT traversal technique.
</description>
</method>
<method name="create_server">
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index d99b28d178..0a1061f92e 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -100,8 +100,8 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
host = enet_host_create(&address /* the address to bind the server host to */,
p_max_clients /* allow up to 32 clients and/or outgoing connections */,
channel_count /* allow up to channel_count to be used */,
- p_in_bandwidth /* limit incoming bandwith if > 0 */,
- p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ p_in_bandwidth /* limit incoming bandwidth if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
ERR_FAIL_COND_V(!host, ERR_CANT_CREATE);
@@ -144,14 +144,14 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
host = enet_host_create(&c_client /* create a client host */,
1 /* only allow 1 outgoing connection */,
channel_count /* allow up to channel_count to be used */,
- p_in_bandwidth /* limit incoming bandwith if > 0 */,
- p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ p_in_bandwidth /* limit incoming bandwidth if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
} else {
host = enet_host_create(NULL /* create a client host */,
1 /* only allow 1 outgoing connection */,
channel_count /* allow up to channel_count to be used */,
- p_in_bandwidth /* limit incoming bandwith if > 0 */,
- p_out_bandwidth /* limit outgoing bandwith if > 0 */);
+ p_in_bandwidth /* limit incoming bandwidth if > 0 */,
+ p_out_bandwidth /* limit outgoing bandwidth if > 0 */);
}
ERR_FAIL_COND_V(!host, ERR_CANT_CREATE);
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index 301f218361..c86e78ccee 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -62,7 +62,7 @@ if env['builtin_freetype']:
env.Append(CCFLAGS=['/FI', '"modules/freetype/uwpdef.h"'])
elif env['platform'] == 'javascript':
# Forcibly undefine this macro so SIMD is not used in this file,
- # since currently unsuported in WASM
+ # since currently unsupported in WASM
sfnt = env.Object(sfnt, CPPFLAGS=['-U__OPTIMIZE__'])
thirdparty_sources += [sfnt]
diff --git a/modules/gdnative/arvr/config.py b/modules/gdnative/arvr/config.py
index 4d1bdfe4d1..53bc827027 100644
--- a/modules/gdnative/arvr/config.py
+++ b/modules/gdnative/arvr/config.py
@@ -1,4 +1,4 @@
-def can_build(platform):
+def can_build(env, platform):
return True
def configure(env):
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 2a980c2dc8..ecde73ae1c 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -390,7 +390,7 @@ bool GDNative::terminate() {
if (library->should_load_once()) {
Vector<Ref<GDNative> > *gdnatives = &(*GDNativeLibrary::loaded_libraries)[library->get_current_library_path()];
if (gdnatives->size() > 1) {
- // there are other GDNative's still using this library, so we actually don't terminte
+ // there are other GDNative's still using this library, so we actually don't terminate
gdnatives->erase(Ref<GDNative>(this));
initialized = false;
return true;
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 423f3312e1..fd6babfc3a 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -489,6 +489,24 @@ void GDAPI godot_variant_destroy(godot_variant *p_self) {
self->~Variant();
}
+// GDNative core 1.1
+
+godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_op) {
+ Variant::Operator op = (Variant::Operator)p_op;
+ godot_string raw_dest;
+ String *dest = (String *)&raw_dest;
+ memnew_placement(dest, String(Variant::get_operator_name(op))); // operator = is overloaded by String
+ return raw_dest;
+}
+
+void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid) {
+ Variant::Operator op = (Variant::Operator)p_op;
+ const Variant *a = (const Variant *)p_a;
+ const Variant *b = (const Variant *)p_b;
+ Variant *ret = (Variant *)r_ret;
+ Variant::evaluate(op, a, b, *ret, *r_valid);
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index dce3d7e96b..16a34a9a33 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -94,6 +94,24 @@
["godot_transform *", "r_dest"],
["const godot_quat *", "p_quat"]
]
+ },
+ {
+ "name": "godot_variant_get_operator_name",
+ "return_type": "godot_string",
+ "arguments": [
+ ["godot_variant_operator", "p_op"]
+ ]
+ },
+ {
+ "name": "godot_variant_evaluate",
+ "return_type": "void",
+ "arguments": [
+ ["godot_variant_operator", "p_op"],
+ ["const godot_variant *", "p_a"],
+ ["const godot_variant *", "p_b"],
+ ["godot_variant *", "r_ret"],
+ ["godot_bool *", "r_valid"]
+ ]
}
]
},
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 6779dc4092..5e71aa9f11 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -100,6 +100,45 @@ typedef struct godot_variant_call_error {
godot_variant_type expected;
} godot_variant_call_error;
+typedef enum godot_variant_operator {
+ // comparison
+ GODOT_VARIANT_OP_EQUAL,
+ GODOT_VARIANT_OP_NOT_EQUAL,
+ GODOT_VARIANT_OP_LESS,
+ GODOT_VARIANT_OP_LESS_EQUAL,
+ GODOT_VARIANT_OP_GREATER,
+ GODOT_VARIANT_OP_GREATER_EQUAL,
+
+ // mathematic
+ GODOT_VARIANT_OP_ADD,
+ GODOT_VARIANT_OP_SUBTRACT,
+ GODOT_VARIANT_OP_MULTIPLY,
+ GODOT_VARIANT_OP_DIVIDE,
+ GODOT_VARIANT_OP_NEGATE,
+ GODOT_VARIANT_OP_POSITIVE,
+ GODOT_VARIANT_OP_MODULE,
+ GODOT_VARIANT_OP_STRING_CONCAT,
+
+ // bitwise
+ GODOT_VARIANT_OP_SHIFT_LEFT,
+ GODOT_VARIANT_OP_SHIFT_RIGHT,
+ GODOT_VARIANT_OP_BIT_AND,
+ GODOT_VARIANT_OP_BIT_OR,
+ GODOT_VARIANT_OP_BIT_XOR,
+ GODOT_VARIANT_OP_BIT_NEGATE,
+
+ // logic
+ GODOT_VARIANT_OP_AND,
+ GODOT_VARIANT_OP_OR,
+ GODOT_VARIANT_OP_XOR,
+ GODOT_VARIANT_OP_NOT,
+
+ // containment
+ GODOT_VARIANT_OP_IN,
+
+ GODOT_VARIANT_OP_MAX,
+} godot_variant_operator;
+
// reduce extern "C" nesting for VS2013
#ifdef __cplusplus
}
@@ -204,6 +243,11 @@ godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self);
void GDAPI godot_variant_destroy(godot_variant *p_self);
+// GDNative core 1.1
+
+godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_op);
+void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid);
+
#ifdef __cplusplus
}
#endif
diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h
index d6a729be47..ba044117e2 100644
--- a/modules/gdnative/include/nativescript/godot_nativescript.h
+++ b/modules/gdnative/include/nativescript/godot_nativescript.h
@@ -40,12 +40,13 @@ extern "C" {
typedef enum {
GODOT_METHOD_RPC_MODE_DISABLED,
GODOT_METHOD_RPC_MODE_REMOTE,
- GODOT_METHOD_RPC_MODE_SYNC,
GODOT_METHOD_RPC_MODE_MASTER,
- GODOT_METHOD_RPC_MODE_SLAVE,
+ GODOT_METHOD_RPC_MODE_PUPPET,
+ GODOT_METHOD_RPC_MODE_SLAVE = GODOT_METHOD_RPC_MODE_PUPPET,
GODOT_METHOD_RPC_MODE_REMOTESYNC,
+ GODOT_METHOD_RPC_MODE_SYNC = GODOT_METHOD_RPC_MODE_REMOTESYNC,
GODOT_METHOD_RPC_MODE_MASTERSYNC,
- GODOT_METHOD_RPC_MODE_SLAVESYNC,
+ GODOT_METHOD_RPC_MODE_PUPPETSYNC,
} godot_method_rpc_mode;
typedef enum {
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index ea968fb0b1..641e4021d8 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -810,18 +810,16 @@ MultiplayerAPI::RPCMode NativeScriptInstance::get_rpc_mode(const StringName &p_m
return MultiplayerAPI::RPC_MODE_DISABLED;
case GODOT_METHOD_RPC_MODE_REMOTE:
return MultiplayerAPI::RPC_MODE_REMOTE;
- case GODOT_METHOD_RPC_MODE_SYNC:
- return MultiplayerAPI::RPC_MODE_SYNC;
case GODOT_METHOD_RPC_MODE_MASTER:
return MultiplayerAPI::RPC_MODE_MASTER;
- case GODOT_METHOD_RPC_MODE_SLAVE:
- return MultiplayerAPI::RPC_MODE_SLAVE;
+ case GODOT_METHOD_RPC_MODE_PUPPET:
+ return MultiplayerAPI::RPC_MODE_PUPPET;
case GODOT_METHOD_RPC_MODE_REMOTESYNC:
return MultiplayerAPI::RPC_MODE_REMOTESYNC;
case GODOT_METHOD_RPC_MODE_MASTERSYNC:
return MultiplayerAPI::RPC_MODE_MASTERSYNC;
- case GODOT_METHOD_RPC_MODE_SLAVESYNC:
- return MultiplayerAPI::RPC_MODE_SLAVESYNC;
+ case GODOT_METHOD_RPC_MODE_PUPPETSYNC:
+ return MultiplayerAPI::RPC_MODE_PUPPETSYNC;
default:
return MultiplayerAPI::RPC_MODE_DISABLED;
}
@@ -846,12 +844,16 @@ MultiplayerAPI::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_
return MultiplayerAPI::RPC_MODE_DISABLED;
case GODOT_METHOD_RPC_MODE_REMOTE:
return MultiplayerAPI::RPC_MODE_REMOTE;
- case GODOT_METHOD_RPC_MODE_SYNC:
- return MultiplayerAPI::RPC_MODE_SYNC;
case GODOT_METHOD_RPC_MODE_MASTER:
return MultiplayerAPI::RPC_MODE_MASTER;
- case GODOT_METHOD_RPC_MODE_SLAVE:
- return MultiplayerAPI::RPC_MODE_SLAVE;
+ case GODOT_METHOD_RPC_MODE_PUPPET:
+ return MultiplayerAPI::RPC_MODE_PUPPET;
+ case GODOT_METHOD_RPC_MODE_REMOTESYNC:
+ return MultiplayerAPI::RPC_MODE_REMOTESYNC;
+ case GODOT_METHOD_RPC_MODE_MASTERSYNC:
+ return MultiplayerAPI::RPC_MODE_MASTERSYNC;
+ case GODOT_METHOD_RPC_MODE_PUPPETSYNC:
+ return MultiplayerAPI::RPC_MODE_PUPPETSYNC;
default:
return MultiplayerAPI::RPC_MODE_DISABLED;
}
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 737374af4b..b0d5422afe 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -126,10 +126,7 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
GDScriptLanguage::singleton->lock->unlock();
#endif
- if (r_error.error != Variant::CallError::CALL_OK) {
- memdelete(instance);
- ERR_FAIL_COND_V(r_error.error != Variant::CallError::CALL_OK, NULL); //error constructing
- }
+ ERR_FAIL_COND_V(r_error.error != Variant::CallError::CALL_OK, NULL); //error constructing
}
//@TODO make thread safe
@@ -1779,10 +1776,11 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
"remote",
"sync",
"master",
+ "puppet",
"slave",
"remotesync",
"mastersync",
- "slavesync",
+ "puppetsync",
0
};
@@ -1973,14 +1971,18 @@ String GDScriptWarning::get_message() const {
} break;
case UNSAFE_CAST: {
CHECK_SYMBOLS(1);
- return "The value is cast to '" + symbols[0] + "' but has an unkown type.";
+ return "The value is cast to '" + symbols[0] + "' but has an unknown type.";
} break;
case UNSAFE_CALL_ARGUMENT: {
CHECK_SYMBOLS(4);
return "The argument '" + symbols[0] + "' of the function '" + symbols[1] + "' requires a the subtype '" + symbols[2] + "' but the supertype '" + symbols[3] + "' was provided";
} break;
+ case DEPRECATED_KEYWORD: {
+ CHECK_SYMBOLS(2);
+ return "The '" + symbols[0] + "' keyword is deprecated and will be removed in a future release, please replace its uses by '" + symbols[1] + "'.";
+ } break;
}
- ERR_EXPLAIN("Invalid GDScript waring code: " + get_name_from_code(code));
+ ERR_EXPLAIN("Invalid GDScript warning code: " + get_name_from_code(code));
ERR_FAIL_V(String());
#undef CHECK_SYMBOLS
@@ -2018,6 +2020,7 @@ String GDScriptWarning::get_name_from_code(Code p_code) {
"UNSAFE_METHOD_ACCESS",
"UNSAFE_CAST",
"UNSAFE_CALL_ARGUMENT",
+ "DEPRECATED_KEYWORD",
NULL
};
@@ -2031,7 +2034,7 @@ GDScriptWarning::Code GDScriptWarning::get_code_from_name(const String &p_name)
}
}
- ERR_EXPLAIN("Invalid GDScript waring name: " + p_name);
+ ERR_EXPLAIN("Invalid GDScript warning name: " + p_name);
ERR_FAIL_V(WARNING_MAX);
}
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 85379a8902..d795500265 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -286,9 +286,10 @@ struct GDScriptWarning {
FUNCTION_USED_AS_PROPERTY, // Property not found, but there's a function with the same name
INTEGER_DIVISION, // Integer divide by integer, decimal part is discarded
UNSAFE_PROPERTY_ACCESS, // Property not found in the detected type (but can be in subtypes)
- UNSAFE_METHOD_ACCESS, // Fucntion not found in the detected type (but can be in subtypes)
+ UNSAFE_METHOD_ACCESS, // Function not found in the detected type (but can be in subtypes)
UNSAFE_CAST, // Cast used in an unknown type
UNSAFE_CALL_ARGUMENT, // Function call argument is of a supertype of the require argument
+ DEPRECATED_KEYWORD, // The keyword is deprecated and should be replaced
WARNING_MAX,
} code;
Vector<String> symbols;
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 006fbece53..310c4e21f2 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/modules/gdscript/gdscript_compiler.cpp
@@ -388,7 +388,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
int ret = _parse_expression(codegen, an->elements[i], slevel);
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -419,7 +419,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
int ret = _parse_expression(codegen, dn->elements[i].key, slevel);
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -429,7 +429,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
ret = _parse_expression(codegen, dn->elements[i].value, slevel);
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -518,7 +518,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
}
}
- codegen.opcodes.push_back(src_addr); // source adddress
+ codegen.opcodes.push_back(src_addr); // source address
int dst_addr = (p_stack_level) | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS);
codegen.opcodes.push_back(dst_addr); // append the stack level as destination address of the opcode
codegen.alloc_stack(p_stack_level);
@@ -545,7 +545,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
int ret = _parse_expression(codegen, on->arguments[i], slevel);
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -578,7 +578,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
int ret = _parse_expression(codegen, on->arguments[i], slevel);
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -606,7 +606,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -655,7 +655,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
ret = _parse_expression(codegen, on->arguments[i], slevel);
if (ret < 0)
return ret;
- if (ret & GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
@@ -681,7 +681,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
int ret = _parse_expression(codegen, on->arguments[i], slevel);
if (ret < 0)
return ret;
- if (ret & (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS)) {
+ if ((ret >> GDScriptFunction::ADDR_BITS & GDScriptFunction::ADDR_TYPE_STACK) == GDScriptFunction::ADDR_TYPE_STACK) {
slevel++;
codegen.alloc_stack(slevel);
}
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 59b0c4d492..a9b641de50 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1189,6 +1189,7 @@ static bool _guess_identifier_type(const GDScriptCompletionContext &p_context, c
c.line = op->line;
c.block = blk;
if (_guess_expression_type(p_context, op->arguments[1], r_type)) {
+ r_type.type.is_meta_type = false;
return true;
}
}
@@ -1221,7 +1222,7 @@ static bool _guess_identifier_type(const GDScriptCompletionContext &p_context, c
int def_from = p_context.function->arguments.size() - p_context.function->default_values.size();
if (i >= def_from) {
- int def_idx = def_from - i;
+ int def_idx = i - def_from;
if (p_context.function->default_values[def_idx]->type == GDScriptParser::Node::TYPE_OPERATOR) {
const GDScriptParser::OperatorNode *op = static_cast<const GDScriptParser::OperatorNode *>(p_context.function->default_values[def_idx]);
if (op->arguments.size() < 2) {
@@ -1376,11 +1377,11 @@ static bool _guess_identifier_type_from_base(const GDScriptCompletionContext &p_
for (int i = 0; i < base_type.class_type->variables.size(); i++) {
GDScriptParser::ClassNode::Member m = base_type.class_type->variables[i];
if (m.identifier == p_identifier) {
- if (m.data_type.has_type) {
- r_type.type = m.data_type;
- return true;
- }
if (m.expression) {
+ if (p_context.line == m.expression->line) {
+ // Variable used in the same expression
+ return false;
+ }
if (_guess_expression_type(p_context, m.expression, r_type)) {
return true;
}
@@ -1389,6 +1390,10 @@ static bool _guess_identifier_type_from_base(const GDScriptCompletionContext &p_
return true;
}
}
+ if (m.data_type.has_type) {
+ r_type.type = m.data_type;
+ return true;
+ }
return false;
}
}
@@ -2109,8 +2114,8 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p
"and", "in", "not", "or", "false", "PI", "TAU", "INF", "NAN", "self", "true", "as", "assert",
"breakpoint", "class", "extends", "is", "func", "preload", "setget", "signal", "tool", "yield",
"const", "enum", "export", "onready", "static", "var", "break", "continue", "if", "elif",
- "else", "for", "pass", "return", "match", "while", "remote", "sync", "master", "slave",
- "remotesync", "mastersync", "slavesync",
+ "else", "for", "pass", "return", "match", "while", "remote", "sync", "master", "puppet", "slave",
+ "remotesync", "mastersync", "puppetsync",
0
};
@@ -3304,7 +3309,7 @@ Error GDScriptLanguage::lookup_code(const String &p_code, const String &p_symbol
}
} else {
/*
- // Because get_integer_constant_enum and get_integer_constant dont work on @GlobalScope
+ // Because get_integer_constant_enum and get_integer_constant don't work on @GlobalScope
// We cannot determine the exact nature of the identifier here
// Otherwise these codes would work
StringName enumName = ClassDB::get_integer_constant_enum("@GlobalScope", p_symbol, true);
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index c469defb01..5af9bbc05f 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -1458,7 +1458,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
return mi;
} break;
case MATH_ATAN2: {
- MethodInfo mi("atan2", PropertyInfo(Variant::REAL, "x"), PropertyInfo(Variant::REAL, "y"));
+ MethodInfo mi("atan2", PropertyInfo(Variant::REAL, "y"), PropertyInfo(Variant::REAL, "x"));
mi.return_val.type = Variant::REAL;
return mi;
} break;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 9182e42c90..ea1287374b 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -81,8 +81,11 @@ bool GDScriptParser::_enter_indent_block(BlockNode *p_block) {
}
tokenizer->advance();
- if (tokenizer->get_token() != GDScriptTokenizer::TK_NEWLINE) {
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_EOF) {
+ return false;
+ }
+ if (tokenizer->get_token() != GDScriptTokenizer::TK_NEWLINE) {
// be more python-like
int current = tab_level.back()->get();
tab_level.push_back(current);
@@ -92,10 +95,11 @@ bool GDScriptParser::_enter_indent_block(BlockNode *p_block) {
}
while (true) {
-
if (tokenizer->get_token() != GDScriptTokenizer::TK_NEWLINE) {
return false; //wtf
+ } else if (tokenizer->get_token(1) == GDScriptTokenizer::TK_EOF) {
+ return false;
} else if (tokenizer->get_token(1) != GDScriptTokenizer::TK_NEWLINE) {
int indent = tokenizer->get_token_line_indent();
@@ -637,9 +641,21 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
expr = op;
} else {
-
- _set_error("Static constant '" + identifier.operator String() + "' not present in built-in type " + Variant::get_type_name(bi_type) + ".");
- return NULL;
+ // Object is a special case
+ bool valid = false;
+ if (bi_type == Variant::OBJECT) {
+ int object_constant = ClassDB::get_integer_constant("Object", identifier, &valid);
+ if (valid) {
+ ConstantNode *cn = alloc_node<ConstantNode>();
+ cn->value = object_constant;
+ cn->datatype = _type_from_variant(cn->value);
+ expr = cn;
+ }
+ }
+ if (!valid) {
+ _set_error("Static constant '" + identifier.operator String() + "' not present in built-in type " + Variant::get_type_name(bi_type) + ".");
+ return NULL;
+ }
}
} else {
@@ -2478,7 +2494,7 @@ void GDScriptParser::_generate_pattern(PatternNode *p_pattern, Node *p_node_to_m
Node *condition = NULL;
- // chech for has, then for pattern
+ // check for has, then for pattern
IdentifierNode *has = alloc_node<IdentifierNode>();
has->name = "has";
@@ -4382,10 +4398,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
tokenizer->advance();
}
- if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_ONREADY && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTER && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTESYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTERSYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVESYNC) {
+ if (tokenizer->get_token() != GDScriptTokenizer::TK_PR_VAR && tokenizer->get_token() != GDScriptTokenizer::TK_PR_ONREADY && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTE && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTER && tokenizer->get_token() != GDScriptTokenizer::TK_PR_PUPPET && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_REMOTESYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_MASTERSYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_PUPPETSYNC && tokenizer->get_token() != GDScriptTokenizer::TK_PR_SLAVE) {
current_export = PropertyInfo();
- _set_error("Expected 'var', 'onready', 'remote', 'master', 'slave', 'sync', 'remotesync', 'mastersync', 'slavesync'.");
+ _set_error("Expected 'var', 'onready', 'remote', 'master', 'puppet', 'sync', 'remotesync', 'mastersync', 'puppetsync'.");
return;
}
@@ -4442,7 +4458,11 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
rpc_mode = MultiplayerAPI::RPC_MODE_MASTER;
continue;
} break;
- case GDScriptTokenizer::TK_PR_SLAVE: {
+ case GDScriptTokenizer::TK_PR_SLAVE:
+#ifdef DEBUG_ENABLED
+ _add_warning(GDScriptWarning::DEPRECATED_KEYWORD, tokenizer->get_token_line(), "slave", "puppet");
+#endif
+ case GDScriptTokenizer::TK_PR_PUPPET: {
//may be fallthrough from export, ignore if so
tokenizer->advance();
@@ -4459,7 +4479,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
}
- rpc_mode = MultiplayerAPI::RPC_MODE_SLAVE;
+ rpc_mode = MultiplayerAPI::RPC_MODE_PUPPET;
continue;
} break;
case GDScriptTokenizer::TK_PR_REMOTESYNC:
@@ -4475,7 +4495,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
- rpc_mode = MultiplayerAPI::RPC_MODE_SYNC;
+ rpc_mode = MultiplayerAPI::RPC_MODE_REMOTESYNC;
continue;
} break;
case GDScriptTokenizer::TK_PR_MASTERSYNC: {
@@ -4493,7 +4513,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
rpc_mode = MultiplayerAPI::RPC_MODE_MASTERSYNC;
continue;
} break;
- case GDScriptTokenizer::TK_PR_SLAVESYNC: {
+ case GDScriptTokenizer::TK_PR_PUPPETSYNC: {
//may be fallthrough from export, ignore if so
tokenizer->advance();
@@ -4505,7 +4525,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
return;
}
- rpc_mode = MultiplayerAPI::RPC_MODE_SLAVESYNC;
+ rpc_mode = MultiplayerAPI::RPC_MODE_PUPPETSYNC;
continue;
} break;
case GDScriptTokenizer::TK_PR_VAR: {
@@ -4535,14 +4555,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
member.rpc_mode = rpc_mode;
if (current_class->constant_expressions.has(member.identifier)) {
- _set_error("A constant named '" + String(member.identifier) + "' alread exists in this class (at line: " +
+ _set_error("A constant named '" + String(member.identifier) + "' already exists in this class (at line: " +
itos(current_class->constant_expressions[member.identifier].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == member.identifier) {
- _set_error("Variable '" + String(member.identifier) + "' alread exists in this class (at line: " +
+ _set_error("Variable '" + String(member.identifier) + "' already exists in this class (at line: " +
itos(current_class->variables[i].line) + ").");
return;
}
@@ -4749,14 +4769,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
int line = tokenizer->get_token_line();
if (current_class->constant_expressions.has(const_id)) {
- _set_error("Constant '" + String(const_id) + "' alread exists in this class (at line: " +
+ _set_error("Constant '" + String(const_id) + "' already exists in this class (at line: " +
itos(current_class->constant_expressions[const_id].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == const_id) {
- _set_error("A variable named '" + String(const_id) + "' alread exists in this class (at line: " +
+ _set_error("A variable named '" + String(const_id) + "' already exists in this class (at line: " +
itos(current_class->variables[i].line) + ").");
return;
}
@@ -4810,7 +4830,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
case GDScriptTokenizer::TK_PR_ENUM: {
//multiple constant declarations..
- int last_assign = -1; // Incremented by 1 right before the assingment.
+ int last_assign = -1; // Incremented by 1 right before the assignment.
String enum_name;
Dictionary enum_dict;
@@ -4847,6 +4867,20 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
StringName const_id = tokenizer->get_token_literal();
+ if (current_class->constant_expressions.has(const_id)) {
+ _set_error("A constant named '" + String(const_id) + "' already exists in this class (at line: " +
+ itos(current_class->constant_expressions[const_id].expression->line) + ").");
+ return;
+ }
+
+ for (int i = 0; i < current_class->variables.size(); i++) {
+ if (current_class->variables[i].identifier == const_id) {
+ _set_error("A variable named '" + String(const_id) + "' already exists in this class (at line: " +
+ itos(current_class->variables[i].line) + ").");
+ return;
+ }
+ }
+
tokenizer->advance();
if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
@@ -7200,6 +7234,12 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
expr.is_constant = true;
c.type = expr;
c.expression->set_datatype(expr);
+
+ DataType tmp;
+ if (_get_member_type(p_class->base_type, E->key(), tmp)) {
+ _set_error("Member '" + String(E->key()) + "' already exists in parent class.", c.expression->line);
+ return;
+ }
}
// Function declarations
@@ -7242,7 +7282,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
return;
}
- // Replace assigment with implict conversion
+ // Replace assignment with implict conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = v.line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
@@ -7620,7 +7660,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
lv->line);
return;
}
- // Replace assigment with implict conversion
+ // Replace assignment with implict conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = lv->line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
@@ -7748,7 +7788,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
op->line);
return;
}
- // Replace assigment with implict conversion
+ // Replace assignment with implict conversion
BuiltInFunctionNode *convert = alloc_node<BuiltInFunctionNode>();
convert->line = op->line;
convert->function = GDScriptFunctions::TYPE_CONVERT;
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 941f5dbecc..77e1b7290e 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -112,10 +112,11 @@ const char *GDScriptTokenizer::token_names[TK_MAX] = {
"rpc",
"sync",
"master",
+ "puppet",
"slave",
"remotesync",
"mastersync",
- "slavesync",
+ "puppetsync",
"'['",
"']'",
"'{'",
@@ -210,10 +211,11 @@ static const _kws _keyword_list[] = {
{ GDScriptTokenizer::TK_PR_REMOTE, "remote" },
{ GDScriptTokenizer::TK_PR_MASTER, "master" },
{ GDScriptTokenizer::TK_PR_SLAVE, "slave" },
+ { GDScriptTokenizer::TK_PR_PUPPET, "puppet" },
{ GDScriptTokenizer::TK_PR_SYNC, "sync" },
{ GDScriptTokenizer::TK_PR_REMOTESYNC, "remotesync" },
{ GDScriptTokenizer::TK_PR_MASTERSYNC, "mastersync" },
- { GDScriptTokenizer::TK_PR_SLAVESYNC, "slavesync" },
+ { GDScriptTokenizer::TK_PR_PUPPETSYNC, "puppetsync" },
{ GDScriptTokenizer::TK_PR_CONST, "const" },
{ GDScriptTokenizer::TK_PR_ENUM, "enum" },
//controlflow
@@ -258,11 +260,11 @@ bool GDScriptTokenizer::is_token_literal(int p_offset, bool variable_safe) const
case TK_PR_SIGNAL:
case TK_PR_REMOTE:
case TK_PR_MASTER:
- case TK_PR_SLAVE:
+ case TK_PR_PUPPET:
case TK_PR_SYNC:
case TK_PR_REMOTESYNC:
case TK_PR_MASTERSYNC:
- case TK_PR_SLAVESYNC:
+ case TK_PR_PUPPETSYNC:
return true;
// Literal for non-variables only:
diff --git a/modules/gdscript/gdscript_tokenizer.h b/modules/gdscript/gdscript_tokenizer.h
index 01b1ac5bf2..cc894fb101 100644
--- a/modules/gdscript/gdscript_tokenizer.h
+++ b/modules/gdscript/gdscript_tokenizer.h
@@ -119,9 +119,10 @@ public:
TK_PR_SYNC,
TK_PR_MASTER,
TK_PR_SLAVE,
+ TK_PR_PUPPET,
TK_PR_REMOTESYNC,
TK_PR_MASTERSYNC,
- TK_PR_SLAVESYNC,
+ TK_PR_PUPPETSYNC,
TK_BRACKET_OPEN,
TK_BRACKET_CLOSE,
TK_CURLY_BRACKET_OPEN,
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml
index 09e8e39796..f13479940d 100644
--- a/modules/gridmap/doc_classes/GridMap.xml
+++ b/modules/gridmap/doc_classes/GridMap.xml
@@ -65,7 +65,7 @@
<argument index="2" name="z" type="int">
</argument>
<description>
- The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is retuned if the cell is empty.
+ The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is returned if the cell is empty.
</description>
</method>
<method name="get_collision_layer_bit" qualifiers="const">
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index e6eaabd9ce..5fdb6a5196 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -645,7 +645,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
}
set_items.clear();
input_action = INPUT_NONE;
- return true;
+ return set_items.size() > 0;
}
if (mb->get_button_index() == BUTTON_LEFT && input_action != INPUT_NONE) {
diff --git a/modules/mbedtls/stream_peer_mbed_tls.cpp b/modules/mbedtls/stream_peer_mbed_tls.cpp
index 3398957775..3c04254fd4 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.cpp
+++ b/modules/mbedtls/stream_peer_mbed_tls.cpp
@@ -317,15 +317,13 @@ void StreamPeerMbedTLS::initialize_ssl() {
mbedtls_debug_set_threshold(1);
#endif
- PoolByteArray cert_array = StreamPeerSSL::get_project_cert_array();
-
- if (cert_array.size() > 0)
- _load_certs(cert_array);
-
available = true;
}
void StreamPeerMbedTLS::finalize_ssl() {
+ available = false;
+ _create = NULL;
+ load_certs_func = NULL;
mbedtls_x509_crt_free(&cacert);
}
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index b3a2d26e4a..1d5c145027 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -134,6 +134,7 @@ def find_msbuild_unix(filename):
def find_msbuild_windows():
import mono_reg_utils as monoreg
+ mono_root = ''
bits = env['bits']
if bits == '32':
diff --git a/modules/mono/config.py b/modules/mono/config.py
index 70fd1a35f1..01649a972e 100644
--- a/modules/mono/config.py
+++ b/modules/mono/config.py
@@ -99,6 +99,8 @@ def configure(env):
if not mono_root:
raise RuntimeError('Mono installation directory not found')
+ print('Found Mono root directory: ' + mono_root)
+
mono_version = mono_root_try_find_mono_version(mono_root)
configure_for_mono_version(env, mono_version)
@@ -164,6 +166,14 @@ def configure(env):
if os.getenv('MONO64_PREFIX'):
mono_root = os.getenv('MONO64_PREFIX')
+ if not mono_root and sys.platform == 'darwin':
+ # Try with some known directories under OSX
+ hint_dirs = ['/Library/Frameworks/Mono.framework/Versions/Current', '/usr/local/var/homebrew/linked/mono']
+ for hint_dir in hint_dirs:
+ if os.path.isdir(hint_dir):
+ mono_root = hint_dir
+ break
+
# We can't use pkg-config to link mono statically,
# but we can still use it to find the mono root directory
if not mono_root and mono_static:
@@ -172,6 +182,8 @@ def configure(env):
raise RuntimeError('Building with mono_static=yes, but failed to find the mono prefix with pkg-config. Specify one manually')
if mono_root:
+ print('Found Mono root directory: ' + mono_root)
+
mono_version = mono_root_try_find_mono_version(mono_root)
configure_for_mono_version(env, mono_version)
@@ -216,6 +228,9 @@ def configure(env):
else:
assert not mono_static
+ # TODO: Add option to force using pkg-config
+ print('Mono root directory not found. Using pkg-config instead')
+
mono_version = pkgconfig_try_find_mono_version()
configure_for_mono_version(env, mono_version)
@@ -248,7 +263,7 @@ def configure(env):
def configure_for_mono_version(env, mono_version):
if mono_version is None:
raise RuntimeError('Mono JIT compiler version not found')
- print('Mono JIT compiler version: ' + str(mono_version))
+ print('Found Mono JIT compiler version: ' + str(mono_version))
if mono_version >= LooseVersion("5.12.0"):
env.Append(CPPFLAGS=['-DHAS_PENDING_EXCEPTIONS'])
@@ -282,7 +297,14 @@ def pkgconfig_try_find_mono_version():
def mono_root_try_find_mono_version(mono_root):
from compat import decode_utf8
- output = subprocess.check_output([os.path.join(mono_root, 'bin', 'mono'), '--version'])
+ mono_bin = os.path.join(mono_root, 'bin')
+ if os.path.isfile(os.path.join(mono_bin, 'mono')):
+ mono_binary = os.path.join(mono_bin, 'mono')
+ elif os.path.isfile(os.path.join(mono_bin, 'mono.exe')):
+ mono_binary = os.path.join(mono_bin, 'mono.exe')
+ else:
+ return None
+ output = subprocess.check_output([mono_binary, '--version'])
first_line = decode_utf8(output.splitlines()[0])
try:
return LooseVersion(first_line.split()[len('Mono JIT compiler version'.split())])
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index b9209fce92..c013c232d4 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1541,18 +1541,20 @@ MultiplayerAPI::RPCMode CSharpInstance::_member_get_rpc_mode(GDMonoClassMember *
if (p_member->has_attribute(CACHED_CLASS(RemoteAttribute)))
return MultiplayerAPI::RPC_MODE_REMOTE;
- if (p_member->has_attribute(CACHED_CLASS(SyncAttribute)))
- return MultiplayerAPI::RPC_MODE_SYNC;
if (p_member->has_attribute(CACHED_CLASS(MasterAttribute)))
return MultiplayerAPI::RPC_MODE_MASTER;
+ if (p_member->has_attribute(CACHED_CLASS(PuppetAttribute)))
+ return MultiplayerAPI::RPC_MODE_PUPPET;
if (p_member->has_attribute(CACHED_CLASS(SlaveAttribute)))
- return MultiplayerAPI::RPC_MODE_SLAVE;
+ return MultiplayerAPI::RPC_MODE_PUPPET;
if (p_member->has_attribute(CACHED_CLASS(RemoteSyncAttribute)))
return MultiplayerAPI::RPC_MODE_REMOTESYNC;
+ if (p_member->has_attribute(CACHED_CLASS(SyncAttribute)))
+ return MultiplayerAPI::RPC_MODE_REMOTESYNC;
if (p_member->has_attribute(CACHED_CLASS(MasterSyncAttribute)))
return MultiplayerAPI::RPC_MODE_MASTERSYNC;
- if (p_member->has_attribute(CACHED_CLASS(SlaveSyncAttribute)))
- return MultiplayerAPI::RPC_MODE_SLAVESYNC;
+ if (p_member->has_attribute(CACHED_CLASS(PuppetSyncAttribute)))
+ return MultiplayerAPI::RPC_MODE_PUPPETSYNC;
return MultiplayerAPI::RPC_MODE_DISABLED;
}
diff --git a/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs b/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
index 303be3b732..fba4a8f65c 100644
--- a/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
+++ b/modules/mono/editor/GodotSharpTools/Editor/MonoDevelopInstance.cs
@@ -2,13 +2,23 @@ using System;
using System.IO;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
namespace GodotSharpTools.Editor
{
public class MonoDevelopInstance
{
- private Process process;
- private string solutionFile;
+ public enum EditorId
+ {
+ MonoDevelop = 0,
+ VisualStudioForMac = 1
+ }
+
+ readonly string solutionFile;
+ readonly EditorId editorId;
+
+ Process process;
public void Execute(string[] files)
{
@@ -16,6 +26,35 @@ namespace GodotSharpTools.Editor
List<string> args = new List<string>();
+ string command;
+
+ if (Utils.OS.IsOSX())
+ {
+ string bundleId = codeEditorBundleIds[editorId];
+
+ if (IsApplicationBundleInstalled(bundleId))
+ {
+ command = "open";
+
+ args.Add("-b");
+ args.Add(bundleId);
+
+ // The 'open' process must wait until the application finishes
+ if (newWindow)
+ args.Add("--wait-apps");
+
+ args.Add("--args");
+ }
+ else
+ {
+ command = codeEditorPaths[editorId];
+ }
+ }
+ else
+ {
+ command = codeEditorPaths[editorId];
+ }
+
args.Add("--ipc-tcp");
if (newWindow)
@@ -33,25 +72,73 @@ namespace GodotSharpTools.Editor
if (newWindow)
{
- ProcessStartInfo startInfo = new ProcessStartInfo(MonoDevelopFile, string.Join(" ", args));
- process = Process.Start(startInfo);
+ process = Process.Start(new ProcessStartInfo()
+ {
+ FileName = command,
+ Arguments = string.Join(" ", args),
+ UseShellExecute = false
+ });
}
else
{
- Process.Start(MonoDevelopFile, string.Join(" ", args));
+ Process.Start(new ProcessStartInfo()
+ {
+ FileName = command,
+ Arguments = string.Join(" ", args),
+ UseShellExecute = false
+ });
}
}
- public MonoDevelopInstance(string solutionFile)
+ public MonoDevelopInstance(string solutionFile, EditorId editorId)
{
+ if (editorId == EditorId.VisualStudioForMac && !Utils.OS.IsOSX())
+ throw new InvalidOperationException($"{nameof(EditorId.VisualStudioForMac)} not supported on this platform");
+
this.solutionFile = solutionFile;
+ this.editorId = editorId;
}
- private static string MonoDevelopFile
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern static bool IsApplicationBundleInstalled(string bundleId);
+
+ static readonly IReadOnlyDictionary<EditorId, string> codeEditorPaths;
+ static readonly IReadOnlyDictionary<EditorId, string> codeEditorBundleIds;
+
+ static MonoDevelopInstance()
{
- get
+ if (Utils.OS.IsOSX())
+ {
+ codeEditorPaths = new Dictionary<EditorId, string>
+ {
+ // Rely on PATH
+ { EditorId.MonoDevelop, "monodevelop" },
+ { EditorId.VisualStudioForMac, "VisualStudio" }
+ };
+ codeEditorBundleIds = new Dictionary<EditorId, string>
+ {
+ // TODO EditorId.MonoDevelop
+ { EditorId.VisualStudioForMac, "com.microsoft.visual-studio" }
+ };
+ }
+ else if (Utils.OS.IsWindows())
+ {
+ codeEditorPaths = new Dictionary<EditorId, string>
+ {
+ // XamarinStudio is no longer a thing, and the latest version is quite old
+ // MonoDevelop is available from source only on Windows. The recommendation
+ // is to use Visual Studio instead. Since there are no official builds, we
+ // will rely on custom MonoDevelop builds being added to PATH.
+ { EditorId.MonoDevelop, "MonoDevelop.exe" }
+ };
+ }
+ else if (Utils.OS.IsUnix())
{
- return "monodevelop";
+ codeEditorPaths = new Dictionary<EditorId, string>
+ {
+ // Rely on PATH
+ { EditorId.MonoDevelop, "monodevelop" }
+ };
}
}
}
diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
index 1c8714e31d..773e8196f7 100644
--- a/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
+++ b/modules/mono/editor/GodotSharpTools/GodotSharpTools.csproj
@@ -40,6 +40,7 @@
<Compile Include="Project\ProjectGenerator.cs" />
<Compile Include="Project\ProjectUtils.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Utils\OS.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs b/modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs
deleted file mode 100644
index 0cbafdc20d..0000000000
--- a/modules/mono/editor/GodotSharpTools/GodotSharpTools.userprefs
+++ /dev/null
@@ -1,14 +0,0 @@
-<Properties StartupItem="GodotSharpTools.csproj">
- <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
- <MonoDevelop.Ide.Workbench ActiveDocument="Build/BuildSystem.cs">
- <Files>
- <File FileName="Build/ProjectExtensions.cs" Line="1" Column="1" />
- <File FileName="Build/ProjectGenerator.cs" Line="1" Column="1" />
- <File FileName="Build/BuildSystem.cs" Line="37" Column="14" />
- </Files>
- </MonoDevelop.Ide.Workbench>
- <MonoDevelop.Ide.DebuggingService.Breakpoints>
- <BreakpointStore />
- </MonoDevelop.Ide.DebuggingService.Breakpoints>
- <MonoDevelop.Ide.DebuggingService.PinnedWatches />
-</Properties> \ No newline at end of file
diff --git a/modules/mono/editor/GodotSharpTools/Utils/OS.cs b/modules/mono/editor/GodotSharpTools/Utils/OS.cs
new file mode 100644
index 0000000000..148e954e77
--- /dev/null
+++ b/modules/mono/editor/GodotSharpTools/Utils/OS.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Linq;
+using System.Runtime.CompilerServices;
+
+namespace GodotSharpTools.Utils
+{
+ public static class OS
+ {
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ extern static string GetPlatformName();
+
+ const string HaikuName = "Haiku";
+ const string OSXName = "OSX";
+ const string ServerName = "Server";
+ const string UWPName = "UWP";
+ const string WindowsName = "Windows";
+ const string X11Name = "X11";
+
+ public static bool IsHaiku()
+ {
+ return HaikuName.Equals(GetPlatformName(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ public static bool IsOSX()
+ {
+ return OSXName.Equals(GetPlatformName(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ public static bool IsServer()
+ {
+ return ServerName.Equals(GetPlatformName(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ public static bool IsUWP()
+ {
+ return UWPName.Equals(GetPlatformName(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ public static bool IsWindows()
+ {
+ return WindowsName.Equals(GetPlatformName(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ public static bool IsX11()
+ {
+ return X11Name.Equals(GetPlatformName(), StringComparison.OrdinalIgnoreCase);
+ }
+
+ static bool? IsUnixCache = null;
+ static readonly string[] UnixPlatforms = new string[] { HaikuName, OSXName, ServerName, X11Name };
+
+ public static bool IsUnix()
+ {
+ if (IsUnixCache.HasValue)
+ return IsUnixCache.Value;
+
+ string osName = GetPlatformName();
+ IsUnixCache = UnixPlatforms.Any(p => p.Equals(osName, StringComparison.OrdinalIgnoreCase));
+ return IsUnixCache.Value;
+ }
+ }
+}
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index b01f8e66c3..d397814fa7 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -94,7 +94,12 @@ MonoString *godot_icall_BuildInstance_get_MSBuildPath() {
#if defined(WINDOWS_ENABLED)
switch (build_tool) {
case GodotSharpBuilds::MSBUILD_VS: {
- static String msbuild_tools_path = MonoRegUtils::find_msbuild_tools_path();
+ static String msbuild_tools_path;
+
+ if (msbuild_tools_path.empty() || !FileAccess::exists(msbuild_tools_path)) {
+ // Try to search it again if it wasn't found last time or if it was removed from its location
+ msbuild_tools_path = MonoRegUtils::find_msbuild_tools_path();
+ }
if (msbuild_tools_path.length()) {
if (!msbuild_tools_path.ends_with("\\"))
@@ -128,15 +133,25 @@ MonoString *godot_icall_BuildInstance_get_MSBuildPath() {
CRASH_NOW();
}
#elif defined(UNIX_ENABLED)
- static String msbuild_path = _find_build_engine_on_unix("msbuild");
- static String xbuild_path = _find_build_engine_on_unix("xbuild");
+ static String msbuild_path;
+ static String xbuild_path;
if (build_tool == GodotSharpBuilds::XBUILD) {
+ if (xbuild_path.empty() || !FileAccess::exists(xbuild_path)) {
+ // Try to search it again if it wasn't found last time or if it was removed from its location
+ xbuild_path = _find_build_engine_on_unix("msbuild");
+ }
+
if (xbuild_path.empty()) {
WARN_PRINT("Cannot find binary for '" PROP_NAME_XBUILD "'");
return NULL;
}
} else {
+ if (msbuild_path.empty() || !FileAccess::exists(msbuild_path)) {
+ // Try to search it again if it wasn't found last time or if it was removed from its location
+ msbuild_path = _find_build_engine_on_unix("msbuild");
+ }
+
if (msbuild_path.empty()) {
WARN_PRINT("Cannot find binary for '" PROP_NAME_MSBUILD_MONO "'");
return NULL;
@@ -192,7 +207,11 @@ MonoBoolean godot_icall_BuildInstance_get_UsingMonoMSBuildOnWindows() {
#endif
}
-void GodotSharpBuilds::_register_internal_calls() {
+void GodotSharpBuilds::register_internal_calls() {
+
+ static bool registered = false;
+ ERR_FAIL_COND(registered);
+ registered = true;
mono_add_internal_call("GodotSharpTools.Build.BuildSystem::godot_icall_BuildInstance_ExitCallback", (void *)godot_icall_BuildInstance_ExitCallback);
mono_add_internal_call("GodotSharpTools.Build.BuildInstance::godot_icall_BuildInstance_get_MSBuildPath", (void *)godot_icall_BuildInstance_get_MSBuildPath);
diff --git a/modules/mono/editor/godotsharp_builds.h b/modules/mono/editor/godotsharp_builds.h
index 4afc284d45..c6dc6b6236 100644
--- a/modules/mono/editor/godotsharp_builds.h
+++ b/modules/mono/editor/godotsharp_builds.h
@@ -61,9 +61,6 @@ private:
static GodotSharpBuilds *singleton;
- friend class GDMono;
- static void _register_internal_calls();
-
public:
enum BuildTool {
MSBUILD_MONO,
@@ -75,6 +72,8 @@ public:
_FORCE_INLINE_ static GodotSharpBuilds *get_singleton() { return singleton; }
+ static void register_internal_calls();
+
static void show_build_error_dialog(const String &p_message);
void build_exit_callback(const MonoBuildInfo &p_build_info, int p_exit_code);
diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp
index faeb58e5a7..3ee38515bf 100644
--- a/modules/mono/editor/godotsharp_editor.cpp
+++ b/modules/mono/editor/godotsharp_editor.cpp
@@ -38,12 +38,17 @@
#include "../csharp_script.h"
#include "../godotsharp_dirs.h"
#include "../mono_gd/gd_mono.h"
+#include "../mono_gd/gd_mono_marshal.h"
#include "../utils/path_utils.h"
#include "bindings_generator.h"
#include "csharp_project.h"
#include "godotsharp_export.h"
#include "net_solution.h"
+#ifdef OSX_ENABLED
+#include "../utils/osx_utils.h"
+#endif
+
#ifdef WINDOWS_ENABLED
#include "../utils/mono_reg_utils.h"
#endif
@@ -169,6 +174,31 @@ void GodotSharpEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_menu_option_pressed", "id"), &GodotSharpEditor::_menu_option_pressed);
}
+MonoBoolean godot_icall_MonoDevelopInstance_IsApplicationBundleInstalled(MonoString *p_bundle_id) {
+#ifdef OSX_ENABLED
+ return (MonoBoolean)osx_is_app_bundle_installed(GDMonoMarshal::mono_string_to_godot(p_bundle_id));
+#else
+ (void)p_bundle_id; // UNUSED
+ ERR_FAIL_V(false);
+#endif
+}
+
+MonoString *godot_icall_Utils_OS_GetPlatformName() {
+ return GDMonoMarshal::mono_string_from_godot(OS::get_singleton()->get_name());
+}
+
+void GodotSharpEditor::register_internal_calls() {
+
+ static bool registered = false;
+ ERR_FAIL_COND(registered);
+ registered = true;
+
+ mono_add_internal_call("GodotSharpTools.Editor.MonoDevelopInstance::IsApplicationBundleInstalled", (void *)godot_icall_MonoDevelopInstance_IsApplicationBundleInstalled);
+ mono_add_internal_call("GodotSharpTools.Utils.OS::GetPlatformName", (void *)godot_icall_Utils_OS_GetPlatformName);
+
+ GodotSharpBuilds::register_internal_calls();
+}
+
void GodotSharpEditor::show_error_dialog(const String &p_message, const String &p_title) {
error_dialog->set_title(p_title);
@@ -181,8 +211,36 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int
ExternalEditor editor = ExternalEditor(int(EditorSettings::get_singleton()->get("mono/editor/external_editor")));
switch (editor) {
- case EDITOR_CODE: {
+ case EDITOR_VSCODE: {
+ static String vscode_path;
+
+ if (vscode_path.empty() || !FileAccess::exists(vscode_path)) {
+ // Try to search it again if it wasn't found last time or if it was removed from its location
+ vscode_path = path_which("code");
+ }
+
List<String> args;
+
+#ifdef OSX_ENABLED
+ // The package path is '/Applications/Visual Studio Code.app'
+ static const String vscode_bundle_id = "com.microsoft.VSCode";
+ static bool osx_app_bundle_installed = osx_is_app_bundle_installed(vscode_bundle_id);
+
+ if (osx_app_bundle_installed) {
+ args.push_back("-b");
+ args.push_back(vscode_bundle_id);
+
+ // The reusing of existing windows made by the 'open' command might not choose a wubdiw that is
+ // editing our folder. It's better to ask for a new window and let VSCode do the window management.
+ args.push_back("-n");
+
+ // The open process must wait until the application finishes (which is instant in VSCode's case)
+ args.push_back("--wait-apps");
+
+ args.push_back("--args");
+ }
+#endif
+
args.push_back(ProjectSettings::get_singleton()->get_resource_path());
String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
@@ -194,18 +252,47 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int
args.push_back(script_path);
}
- static String program = path_which("code");
+#ifdef OSX_ENABLED
+ ERR_EXPLAIN("Cannot find code editor: VSCode");
+ ERR_FAIL_COND_V(!osx_app_bundle_installed && vscode_path.empty(), ERR_FILE_NOT_FOUND);
- Error err = OS::get_singleton()->execute(program.length() ? program : "code", args, false);
+ String command = osx_app_bundle_installed ? "/usr/bin/open" : vscode_path;
+#else
+ ERR_EXPLAIN("Cannot find code editor: VSCode");
+ ERR_FAIL_COND_V(vscode_path.empty(), ERR_FILE_NOT_FOUND);
+
+ String command = vscode_path;
+#endif
+
+ Error err = OS::get_singleton()->execute(command, args, false);
if (err != OK) {
- ERR_PRINT("GodotSharp: Could not execute external editor");
+ ERR_PRINT("Error when trying to execute code editor: VSCode");
return err;
}
} break;
+#ifdef OSX_ENABLED
+ case EDITOR_VISUALSTUDIO_MAC:
+ // [[fallthrough]];
+#endif
case EDITOR_MONODEVELOP: {
- if (!monodevel_instance)
- monodevel_instance = memnew(MonoDevelopInstance(GodotSharpDirs::get_project_sln_path()));
+#ifdef OSX_ENABLED
+ bool is_visualstudio = editor == EDITOR_VISUALSTUDIO_MAC;
+
+ MonoDevelopInstance **instance = is_visualstudio ?
+ &visualstudio_mac_instance :
+ &monodevelop_instance;
+
+ MonoDevelopInstance::EditorId editor_id = is_visualstudio ?
+ MonoDevelopInstance::VISUALSTUDIO_FOR_MAC :
+ MonoDevelopInstance::MONODEVELOP;
+#else
+ MonoDevelopInstance **instance = &monodevelop_instance;
+ MonoDevelopInstance::EditorId editor_id = MonoDevelopInstance::MONODEVELOP;
+#endif
+
+ if (!*instance)
+ *instance = memnew(MonoDevelopInstance(GodotSharpDirs::get_project_sln_path(), editor_id));
String script_path = ProjectSettings::get_singleton()->globalize_path(p_script->get_path());
@@ -213,7 +300,7 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int
script_path += ";" + itos(p_line + 1) + ";" + itos(p_col);
}
- monodevel_instance->execute(script_path);
+ (*instance)->execute(script_path);
} break;
default:
return ERR_UNAVAILABLE;
@@ -231,7 +318,10 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
singleton = this;
- monodevel_instance = NULL;
+ monodevelop_instance = NULL;
+#ifdef OSX_ENABLED
+ visualstudio_mac_instance = NULL;
+#endif
editor = p_editor;
@@ -314,7 +404,18 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) {
// External editor settings
EditorSettings *ed_settings = EditorSettings::get_singleton();
EDITOR_DEF("mono/editor/external_editor", EDITOR_NONE);
- ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, "None,MonoDevelop,Visual Studio Code"));
+
+ String settings_hint_str = "None";
+
+#ifdef WINDOWS_ENABLED
+ settings_hint_str += ",MonoDevelop,Visual Studio Code";
+#elif OSX_ENABLED
+ settings_hint_str += ",Visual Studio,MonoDevelop,Visual Studio Code";
+#elif UNIX_ENABLED
+ settings_hint_str += ",MonoDevelop,Visual Studio Code";
+#endif
+
+ ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, settings_hint_str));
// Export plugin
Ref<GodotSharpExport> godotsharp_export;
@@ -328,9 +429,9 @@ GodotSharpEditor::~GodotSharpEditor() {
memdelete(godotsharp_builds);
- if (monodevel_instance) {
- memdelete(monodevel_instance);
- monodevel_instance = NULL;
+ if (monodevelop_instance) {
+ memdelete(monodevelop_instance);
+ monodevelop_instance = NULL;
}
}
diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h
index 66da814c8b..46b6bd5ebf 100644
--- a/modules/mono/editor/godotsharp_editor.h
+++ b/modules/mono/editor/godotsharp_editor.h
@@ -50,7 +50,10 @@ class GodotSharpEditor : public Node {
GodotSharpBuilds *godotsharp_builds;
- MonoDevelopInstance *monodevel_instance;
+ MonoDevelopInstance *monodevelop_instance;
+#ifdef OSX_ENABLED
+ MonoDevelopInstance *visualstudio_mac_instance;
+#endif
bool _create_project_solution();
@@ -74,12 +77,24 @@ public:
enum ExternalEditor {
EDITOR_NONE,
+#ifdef WINDOWS_ENABLED
+ //EDITOR_VISUALSTUDIO, // TODO
EDITOR_MONODEVELOP,
- EDITOR_CODE,
+ EDITOR_VSCODE
+#elif OSX_ENABLED
+ EDITOR_VISUALSTUDIO_MAC,
+ EDITOR_MONODEVELOP,
+ EDITOR_VSCODE
+#elif UNIX_ENABLED
+ EDITOR_MONODEVELOP,
+ EDITOR_VSCODE
+#endif
};
_FORCE_INLINE_ static GodotSharpEditor *get_singleton() { return singleton; }
+ static void register_internal_calls();
+
void show_error_dialog(const String &p_message, const String &p_title = "Error");
Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col);
diff --git a/modules/mono/editor/monodevelop_instance.cpp b/modules/mono/editor/monodevelop_instance.cpp
index 9f05711fd6..1d858d80bf 100644
--- a/modules/mono/editor/monodevelop_instance.cpp
+++ b/modules/mono/editor/monodevelop_instance.cpp
@@ -47,7 +47,7 @@ void MonoDevelopInstance::execute(const Vector<String> &p_files) {
execute_method->invoke(gc_handle->get_target(), args, &exc);
if (exc) {
- GDMonoUtils::debug_unhandled_exception(exc);
+ GDMonoUtils::debug_print_unhandled_exception(exc);
ERR_FAIL();
}
}
@@ -59,7 +59,7 @@ void MonoDevelopInstance::execute(const String &p_file) {
execute(files);
}
-MonoDevelopInstance::MonoDevelopInstance(const String &p_solution) {
+MonoDevelopInstance::MonoDevelopInstance(const String &p_solution, EditorId p_editor_id) {
_GDMONO_SCOPE_DOMAIN_(TOOLS_DOMAIN)
@@ -67,15 +67,16 @@ MonoDevelopInstance::MonoDevelopInstance(const String &p_solution) {
MonoObject *obj = mono_object_new(TOOLS_DOMAIN, klass->get_mono_ptr());
- GDMonoMethod *ctor = klass->get_method(".ctor", 1);
+ GDMonoMethod *ctor = klass->get_method(".ctor", 2);
MonoException *exc = NULL;
Variant solution = p_solution;
- const Variant *args[1] = { &solution };
+ Variant editor_id = p_editor_id;
+ const Variant *args[2] = { &solution, &editor_id };
ctor->invoke(obj, args, &exc);
if (exc) {
- GDMonoUtils::debug_unhandled_exception(exc);
+ GDMonoUtils::debug_print_unhandled_exception(exc);
ERR_FAIL();
}
diff --git a/modules/mono/editor/monodevelop_instance.h b/modules/mono/editor/monodevelop_instance.h
index 73cf0f54cc..29de4a4735 100644
--- a/modules/mono/editor/monodevelop_instance.h
+++ b/modules/mono/editor/monodevelop_instance.h
@@ -42,10 +42,15 @@ class MonoDevelopInstance {
GDMonoMethod *execute_method;
public:
+ enum EditorId {
+ MONODEVELOP = 0,
+ VISUALSTUDIO_FOR_MAC = 1
+ };
+
void execute(const Vector<String> &p_files);
void execute(const String &p_file);
- MonoDevelopInstance(const String &p_solution);
+ MonoDevelopInstance(const String &p_solution, EditorId p_editor_id);
};
#endif // MONODEVELOP_INSTANCE_H
diff --git a/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs b/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs
index 6bf9560bfa..2398e10135 100644
--- a/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs
+++ b/modules/mono/glue/Managed/Files/Attributes/RPCAttributes.cs
@@ -12,6 +12,9 @@ namespace Godot
public class MasterAttribute : Attribute {}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
+ public class PuppetAttribute : Attribute {}
+
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
public class SlaveAttribute : Attribute {}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
@@ -21,5 +24,5 @@ namespace Godot
public class MasterSyncAttribute : Attribute {}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Field)]
- public class SlaveSyncAttribute : Attribute {}
+ public class PuppetSyncAttribute : Attribute {}
}
diff --git a/modules/mono/glue/Managed/Files/Basis.cs b/modules/mono/glue/Managed/Files/Basis.cs
index ec96a9e2fa..a5618cb28d 100644
--- a/modules/mono/glue/Managed/Files/Basis.cs
+++ b/modules/mono/glue/Managed/Files/Basis.cs
@@ -165,6 +165,38 @@ namespace Godot
);
}
+ internal Quat RotationQuat()
+ {
+ Basis orthonormalizedBasis = Orthonormalized();
+ real_t det = orthonormalizedBasis.Determinant();
+ if (det < 0)
+ {
+ // Ensure that the determinant is 1, such that result is a proper rotation matrix which can be represented by Euler angles.
+ orthonormalizedBasis = orthonormalizedBasis.Scaled(Vector3.NegOne);
+ }
+
+ return orthonormalizedBasis.Quat();
+ }
+
+ internal void SetQuantScale(Quat quat, Vector3 scale)
+ {
+ SetDiagonal(scale);
+ Rotate(quat);
+ }
+
+ private void Rotate(Quat quat)
+ {
+ this *= new Basis(quat);
+ }
+
+ private void SetDiagonal(Vector3 diagonal)
+ {
+ _x = new Vector3(diagonal.x, 0, 0);
+ _y = new Vector3(0, diagonal.y, 0);
+ _z = new Vector3(0, 0, diagonal.z);
+
+ }
+
public real_t Determinant()
{
return this[0, 0] * (this[1, 1] * this[2, 2] - this[2, 1] * this[1, 2]) -
diff --git a/modules/mono/glue/Managed/Files/Transform.cs b/modules/mono/glue/Managed/Files/Transform.cs
index e432d5b52c..068007d7f0 100644
--- a/modules/mono/glue/Managed/Files/Transform.cs
+++ b/modules/mono/glue/Managed/Files/Transform.cs
@@ -20,6 +20,25 @@ namespace Godot
return new Transform(basisInv, basisInv.Xform(-origin));
}
+ public Transform InterpolateWith(Transform transform, real_t c)
+ {
+ /* not sure if very "efficient" but good enough? */
+
+ Vector3 sourceScale = basis.Scale;
+ Quat sourceRotation = basis.RotationQuat();
+ Vector3 sourceLocation = origin;
+
+ Vector3 destinationScale = transform.basis.Scale;
+ Quat destinationRotation = transform.basis.RotationQuat();
+ Vector3 destinationLocation = transform.origin;
+
+ var interpolated = new Transform();
+ interpolated.basis.SetQuantScale(sourceRotation.Slerp(destinationRotation, c).Normalized(), sourceScale.LinearInterpolate(destinationScale, c));
+ interpolated.origin = sourceLocation.LinearInterpolate(destinationLocation, c);
+
+ return interpolated;
+ }
+
public Transform Inverse()
{
Basis basisTr = basis.Transposed();
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index b2b5a90507..2fed6064b7 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -264,7 +264,7 @@ void GDMono::initialize() {
_load_project_assembly();
} else {
#ifdef TOOLS_ENABLED
- // The assembly was successfuly loaded, but the full api could not be cached.
+ // The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the metadata,
// so we invalidate the version in the metadata and unload the script domain.
@@ -319,7 +319,7 @@ void GDMono::_register_internal_calls() {
#endif
#ifdef TOOLS_ENABLED
- GodotSharpBuilds::_register_internal_calls();
+ GodotSharpEditor::register_internal_calls();
#endif
}
@@ -715,7 +715,7 @@ Error GDMono::reload_scripts_domain() {
// Everything is fine with the api assemblies, load the project assembly
_load_project_assembly();
} else {
- // The assembly was successfuly loaded, but the full api could not be cached.
+ // The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the metadata,
// so we invalidate the version in the metadata and unload the script domain.
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 8fbaca0992..b97a24b09c 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -126,10 +126,11 @@ void MonoCache::clear_members() {
class_RemoteAttribute = NULL;
class_SyncAttribute = NULL;
class_MasterAttribute = NULL;
+ class_PuppetAttribute = NULL;
class_SlaveAttribute = NULL;
class_RemoteSyncAttribute = NULL;
class_MasterSyncAttribute = NULL;
- class_SlaveSyncAttribute = NULL;
+ class_PuppetSyncAttribute = NULL;
class_GodotMethodAttribute = NULL;
field_GodotMethodAttribute_methodName = NULL;
@@ -225,10 +226,11 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(RemoteAttribute, GODOT_API_CLASS(RemoteAttribute));
CACHE_CLASS_AND_CHECK(SyncAttribute, GODOT_API_CLASS(SyncAttribute));
CACHE_CLASS_AND_CHECK(MasterAttribute, GODOT_API_CLASS(MasterAttribute));
+ CACHE_CLASS_AND_CHECK(PuppetAttribute, GODOT_API_CLASS(PuppetAttribute));
CACHE_CLASS_AND_CHECK(SlaveAttribute, GODOT_API_CLASS(SlaveAttribute));
CACHE_CLASS_AND_CHECK(RemoteSyncAttribute, GODOT_API_CLASS(RemoteSyncAttribute));
CACHE_CLASS_AND_CHECK(MasterSyncAttribute, GODOT_API_CLASS(MasterSyncAttribute));
- CACHE_CLASS_AND_CHECK(SlaveSyncAttribute, GODOT_API_CLASS(SlaveSyncAttribute));
+ CACHE_CLASS_AND_CHECK(PuppetSyncAttribute, GODOT_API_CLASS(PuppetSyncAttribute));
CACHE_CLASS_AND_CHECK(GodotMethodAttribute, GODOT_API_CLASS(GodotMethodAttribute));
CACHE_FIELD_AND_CHECK(GodotMethodAttribute, methodName, CACHED_CLASS(GodotMethodAttribute)->get_field("methodName"));
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index 96ff3e8116..ec3a57eb46 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -131,8 +131,9 @@ struct MonoCache {
GDMonoClass *class_SyncAttribute;
GDMonoClass *class_RemoteSyncAttribute;
GDMonoClass *class_MasterSyncAttribute;
- GDMonoClass *class_SlaveSyncAttribute;
+ GDMonoClass *class_PuppetSyncAttribute;
GDMonoClass *class_MasterAttribute;
+ GDMonoClass *class_PuppetAttribute;
GDMonoClass *class_SlaveAttribute;
GDMonoClass *class_GodotMethodAttribute;
GDMonoField *field_GodotMethodAttribute_methodName;
diff --git a/modules/mono/utils/osx_utils.cpp b/modules/mono/utils/osx_utils.cpp
new file mode 100644
index 0000000000..f520706a0c
--- /dev/null
+++ b/modules/mono/utils/osx_utils.cpp
@@ -0,0 +1,62 @@
+/*************************************************************************/
+/* osx_utils.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "osx_utils.h"
+
+#include "core/print_string.h"
+
+#ifdef OSX_ENABLED
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <CoreServices/CoreServices.h>
+
+bool osx_is_app_bundle_installed(const String &p_bundle_id) {
+
+ CFURLRef app_url = NULL;
+ CFStringRef bundle_id = CFStringCreateWithCString(NULL, p_bundle_id.utf8(), kCFStringEncodingUTF8);
+ OSStatus result = LSFindApplicationForInfo(kLSUnknownCreator, bundle_id, NULL, NULL, &app_url);
+ CFRelease(bundle_id);
+
+ if (app_url)
+ CFRelease(app_url);
+
+ switch (result) {
+ case noErr:
+ return true;
+ case kLSApplicationNotFoundErr:
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+#endif
diff --git a/modules/mono/utils/osx_utils.h b/modules/mono/utils/osx_utils.h
new file mode 100644
index 0000000000..68479b4f44
--- /dev/null
+++ b/modules/mono/utils/osx_utils.h
@@ -0,0 +1,41 @@
+/*************************************************************************/
+/* osx_utils.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "core/ustring.h"
+
+#ifndef OSX_UTILS_H
+
+#ifdef OSX_ENABLED
+
+bool osx_is_app_bundle_installed(const String &p_bundle_id);
+
+#endif
+
+#endif // OSX_UTILS_H
diff --git a/modules/opensimplex/SCsub b/modules/opensimplex/SCsub
new file mode 100644
index 0000000000..be9c8b091f
--- /dev/null
+++ b/modules/opensimplex/SCsub
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+
+Import('env')
+env.add_source_files(env.modules_sources, ["register_types.cpp", "simplex_noise.cpp", "noise_texture.cpp", "#thirdparty/misc/open-simplex-noise.c"])
diff --git a/modules/opensimplex/config.py b/modules/opensimplex/config.py
new file mode 100644
index 0000000000..c91c9e5c80
--- /dev/null
+++ b/modules/opensimplex/config.py
@@ -0,0 +1,14 @@
+def can_build(env, platform):
+ return True
+
+def configure(env):
+ pass
+
+def get_doc_classes():
+ return [
+ "NoiseTexture",
+ "SimplexNoise"
+ ]
+
+def get_doc_path():
+ return "doc_classes"
diff --git a/modules/opensimplex/doc_classes/NoiseTexture.xml b/modules/opensimplex/doc_classes/NoiseTexture.xml
new file mode 100644
index 0000000000..c7dc373f59
--- /dev/null
+++ b/modules/opensimplex/doc_classes/NoiseTexture.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="NoiseTexture" inherits="Texture" category="Core" version="3.1">
+ <brief_description>
+ [SimplexNoise] filled texture.
+ </brief_description>
+ <description>
+ Uses a [SimplexNoise] to fill the texture data. You can specify the texture size but keep in mind that larger textures will take longer to generate and seamless noise only works with square sized textures.
+ NoiseTexture can also generate normalmap textures.
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="set_height">
+ <return type="void">
+ </return>
+ <argument index="0" name="height" type="int">
+ </argument>
+ <description>
+ Set texture height.
+ </description>
+ </method>
+ <method name="set_width">
+ <return type="void">
+ </return>
+ <argument index="0" name="width" type="int">
+ </argument>
+ <description>
+ Set texture width.
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="as_normalmap" type="bool" setter="set_as_normalmap" getter="is_normalmap">
+ If true, the resulting texture contains a normal map created from the original noise interpreted as a bump map.
+ </member>
+ <member name="noise" type="SimplexNoise" setter="set_noise" getter="get_noise">
+ The [SimplexNoise] instance used to generate the noise.
+ </member>
+ <member name="seamless" type="bool" setter="set_seamless" getter="get_seamless">
+ Whether the texture can be tiled without visible seams or not. Seamless textures take longer to generate.
+ </member>
+ <member name="size" type="Vector2" setter="set_size" getter="get_size">
+ Size of the generated texture.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/opensimplex/doc_classes/SimplexNoise.xml b/modules/opensimplex/doc_classes/SimplexNoise.xml
new file mode 100644
index 0000000000..de29ff874c
--- /dev/null
+++ b/modules/opensimplex/doc_classes/SimplexNoise.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="SimplexNoise" inherits="Resource" category="Core" version="3.1">
+ <brief_description>
+ Noise generator based on Open Simplex.
+ </brief_description>
+ <description>
+ This resource allows you to configure and sample a fractal noise space.
+
+ Here is a brief usage example that configures a SimplexNoise and gets samples at various positions and dimensions:
+ [codeblock]
+ var noise = SimplexNoise.new()
+
+ # Configure
+ noise.seed = randi()
+ noise.octaves = 4
+ noise.period = 20.0
+ noise.persistance = 0.8
+
+ # Sample
+ print("Values:")
+ print(noise.get_noise_2d(1.0, 1.0))
+ print(noise.get_noise_3d(0.5, 3.0, 15.0))
+ print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))
+ [/codeblock]
+ </description>
+ <tutorials>
+ </tutorials>
+ <demos>
+ </demos>
+ <methods>
+ <method name="get_image">
+ <return type="Image">
+ </return>
+ <argument index="0" name="width" type="int">
+ </argument>
+ <argument index="1" name="height" type="int">
+ </argument>
+ <description>
+ Generate a noise image with the requested [code]width[/code] and [code]height[/code], based on the current noise parameters.
+ </description>
+ </method>
+ <method name="get_noise_2d">
+ <return type="float">
+ </return>
+ <argument index="0" name="x" type="float">
+ </argument>
+ <argument index="1" name="y" type="float">
+ </argument>
+ <description>
+ Returns the 2D noise value [code][-1,1][/code] at the given position.
+ </description>
+ </method>
+ <method name="get_noise_2dv">
+ <return type="float">
+ </return>
+ <argument index="0" name="pos" type="Vector2">
+ </argument>
+ <description>
+ Returns the 2D noise value [code][-1,1][/code] at the given position.
+ </description>
+ </method>
+ <method name="get_noise_3d">
+ <return type="float">
+ </return>
+ <argument index="0" name="x" type="float">
+ </argument>
+ <argument index="1" name="y" type="float">
+ </argument>
+ <argument index="2" name="z" type="float">
+ </argument>
+ <description>
+ Returns the 3D noise value [code][-1,1][/code] at the given position.
+ </description>
+ </method>
+ <method name="get_noise_3dv">
+ <return type="float">
+ </return>
+ <argument index="0" name="pos" type="Vector3">
+ </argument>
+ <description>
+ Returns the 3D noise value [code][-1,1][/code] at the given position.
+ </description>
+ </method>
+ <method name="get_noise_4d">
+ <return type="float">
+ </return>
+ <argument index="0" name="x" type="float">
+ </argument>
+ <argument index="1" name="y" type="float">
+ </argument>
+ <argument index="2" name="z" type="float">
+ </argument>
+ <argument index="3" name="w" type="float">
+ </argument>
+ <description>
+ Returns the 4D noise value [code][-1,1][/code] at the given position.
+ </description>
+ </method>
+ <method name="get_seamless_image">
+ <return type="Image">
+ </return>
+ <argument index="0" name="size" type="int">
+ </argument>
+ <description>
+ Generate a tileable noise image, based on the current noise parameters.
+ Generated seamless images are always square ([code]size[/code] x [code]size[/code]).
+ </description>
+ </method>
+ </methods>
+ <members>
+ <member name="lacunarity" type="float" setter="set_lacunarity" getter="get_lacunarity">
+ Difference in period between [member octaves].
+ </member>
+ <member name="octaves" type="int" setter="set_octaves" getter="get_octaves">
+ Number of Simplex noise layers that are sampled to get the fractal noise.
+ </member>
+ <member name="period" type="float" setter="set_period" getter="get_period">
+ Period of the base octave.
+ A lower period results in a higher-frequency noise (more value changes across the same distance).
+ </member>
+ <member name="persistance" type="float" setter="set_persistance" getter="get_persistance">
+ Contribution factor of the different octaves.
+ A [code]persistance[/code] value of 1 means all the octaves have the same contribution, a value of 0.5 means each octave contributes half as much as the previous one.
+ </member>
+ <member name="seed" type="int" setter="set_seed" getter="get_seed">
+ Seed used to generate random values, different seeds will generate different noise maps.
+ </member>
+ </members>
+ <constants>
+ </constants>
+</class>
diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp
new file mode 100644
index 0000000000..b82b0b453f
--- /dev/null
+++ b/modules/opensimplex/noise_texture.cpp
@@ -0,0 +1,244 @@
+/*************************************************************************/
+/* noise_texture.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "noise_texture.h"
+
+#include "core/core_string_names.h"
+
+NoiseTexture::NoiseTexture() {
+ update_queued = false;
+ noise_thread = NULL;
+ regen_queued = false;
+ first_time = true;
+
+ size = Vector2i(512, 512);
+ seamless = false;
+ as_normalmap = false;
+ flags = FLAGS_DEFAULT;
+
+ noise = Ref<SimplexNoise>();
+
+ texture = VS::get_singleton()->texture_create();
+
+ _queue_update();
+}
+
+NoiseTexture::~NoiseTexture() {
+ VS::get_singleton()->free(texture);
+}
+
+void NoiseTexture::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("set_width", "width"), &NoiseTexture::set_width);
+ ClassDB::bind_method(D_METHOD("set_height", "height"), &NoiseTexture::set_height);
+ ClassDB::bind_method(D_METHOD("set_size", "size"), &NoiseTexture::set_size);
+
+ ClassDB::bind_method(D_METHOD("set_noise", "noise"), &NoiseTexture::set_noise);
+ ClassDB::bind_method(D_METHOD("get_noise"), &NoiseTexture::get_noise);
+
+ ClassDB::bind_method(D_METHOD("set_seamless", "seamless"), &NoiseTexture::set_seamless);
+ ClassDB::bind_method(D_METHOD("get_seamless"), &NoiseTexture::get_seamless);
+
+ ClassDB::bind_method(D_METHOD("set_as_normalmap", "as_normalmap"), &NoiseTexture::set_as_normalmap);
+ ClassDB::bind_method(D_METHOD("is_normalmap"), &NoiseTexture::is_normalmap);
+
+ ClassDB::bind_method(D_METHOD("_update_texture"), &NoiseTexture::_update_texture);
+ ClassDB::bind_method(D_METHOD("_generate_texture"), &NoiseTexture::_generate_texture);
+ ClassDB::bind_method(D_METHOD("_thread_done", "image"), &NoiseTexture::_thread_done);
+
+ ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "size"), "set_size", "get_size");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "seamless"), "set_seamless", "get_seamless");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap");
+ ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "SimplexNoise"), "set_noise", "get_noise");
+}
+
+void NoiseTexture::_set_texture_data(const Ref<Image> &p_image) {
+ data = p_image;
+ if (data.is_valid()) {
+ VS::get_singleton()->texture_allocate(texture, size.x, size.y, 0, Image::FORMAT_RGBA8, VS::TEXTURE_TYPE_2D, flags);
+ VS::get_singleton()->texture_set_data(texture, p_image);
+ }
+ emit_changed();
+}
+
+void NoiseTexture::_thread_done(const Ref<Image> &p_image) {
+
+ _set_texture_data(p_image);
+ Thread::wait_to_finish(noise_thread);
+ memdelete(noise_thread);
+ noise_thread = NULL;
+ if (regen_queued) {
+ noise_thread = Thread::create(_thread_function, this);
+ regen_queued = false;
+ }
+}
+
+void NoiseTexture::_thread_function(void *p_ud) {
+ NoiseTexture *tex = (NoiseTexture *)p_ud;
+ tex->call_deferred("_thread_done", tex->_generate_texture());
+}
+
+void NoiseTexture::_queue_update() {
+
+ if (update_queued)
+ return;
+
+ update_queued = true;
+ call_deferred("_update_texture");
+}
+
+Ref<Image> NoiseTexture::_generate_texture() {
+
+ update_queued = false;
+
+ if (noise.is_null()) return Ref<Image>();
+
+ Ref<Image> image;
+
+ if (seamless) {
+ image = noise->get_seamless_image(size.x);
+ } else {
+ image = noise->get_image(size.x, size.y);
+ }
+
+ if (as_normalmap) {
+ image->bumpmap_to_normalmap();
+ }
+
+ return image;
+}
+
+void NoiseTexture::_update_texture() {
+ bool use_thread = true;
+ if (first_time) {
+ use_thread = false;
+ first_time = false;
+ }
+#ifdef NO_THREADS
+ use_thread = false;
+#endif
+ if (use_thread) {
+
+ if (!noise_thread) {
+ noise_thread = Thread::create(_thread_function, this);
+ regen_queued = false;
+ } else {
+ regen_queued = true;
+ }
+
+ } else {
+ Ref<Image> image = _generate_texture();
+ _set_texture_data(image);
+ }
+}
+
+void NoiseTexture::set_noise(Ref<SimplexNoise> p_noise) {
+ if (p_noise == noise)
+ return;
+ if (noise.is_valid()) {
+ noise->disconnect(CoreStringNames::get_singleton()->changed, this, "_update_texture");
+ }
+ noise = p_noise;
+ if (noise.is_valid()) {
+ noise->connect(CoreStringNames::get_singleton()->changed, this, "_update_texture");
+ }
+ _queue_update();
+}
+
+Ref<SimplexNoise> NoiseTexture::get_noise() {
+ return noise;
+}
+
+void NoiseTexture::set_width(int p_width) {
+ if (p_width == size.x) return;
+ size.x = p_width;
+ _queue_update();
+}
+
+void NoiseTexture::set_height(int p_height) {
+ if (p_height == size.y) return;
+ size.y = p_height;
+ _queue_update();
+}
+
+void NoiseTexture::set_seamless(bool p_seamless) {
+ if (p_seamless == seamless) return;
+ seamless = p_seamless;
+ _queue_update();
+}
+
+bool NoiseTexture::get_seamless() {
+ return seamless;
+}
+
+void NoiseTexture::set_as_normalmap(bool p_as_normalmap) {
+ if (p_as_normalmap == as_normalmap) return;
+ as_normalmap = p_as_normalmap;
+ _queue_update();
+}
+
+bool NoiseTexture::is_normalmap() {
+ return as_normalmap;
+}
+
+void NoiseTexture::set_size(Vector2 p_size) {
+ if (p_size == size) return;
+ size = p_size;
+ _queue_update();
+}
+
+Vector2 NoiseTexture::get_size() {
+
+ return size;
+}
+
+int NoiseTexture::get_width() const {
+
+ return size.x;
+}
+
+int NoiseTexture::get_height() const {
+
+ return size.y;
+}
+
+void NoiseTexture::set_flags(uint32_t p_flags) {
+ flags = p_flags;
+ VS::get_singleton()->texture_set_flags(texture, flags);
+}
+
+uint32_t NoiseTexture::get_flags() const {
+ return flags;
+}
+
+Ref<Image> NoiseTexture::get_data() const {
+
+ return data;
+}
diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h
new file mode 100644
index 0000000000..108e471fc1
--- /dev/null
+++ b/modules/opensimplex/noise_texture.h
@@ -0,0 +1,104 @@
+/*************************************************************************/
+/* noise_texture.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef NOISE_TEXTURE_H
+#define NOISE_TEXTURE_H
+
+#include "simplex_noise.h"
+
+#include "core/image.h"
+#include "core/reference.h"
+#include "editor/editor_node.h"
+#include "editor/editor_plugin.h"
+#include "editor/property_editor.h"
+
+class NoiseTexture : public Texture {
+ GDCLASS(NoiseTexture, Texture)
+
+private:
+ Ref<Image> data;
+
+ Thread *noise_thread;
+
+ bool first_time;
+ bool update_queued;
+ bool regen_queued;
+
+ RID texture;
+ uint32_t flags;
+
+ Ref<SimplexNoise> noise;
+ Vector2i size;
+ bool seamless;
+ bool as_normalmap;
+
+ void _thread_done(const Ref<Image> &p_image);
+ static void _thread_function(void *p_ud);
+
+ void _queue_update();
+ Ref<Image> _generate_texture();
+ void _update_texture();
+ void _set_texture_data(const Ref<Image> &p_image);
+
+protected:
+ static void _bind_methods();
+
+public:
+ void set_noise(Ref<SimplexNoise> p_noise);
+ Ref<SimplexNoise> get_noise();
+
+ void set_width(int p_width);
+ void set_height(int p_hieght);
+
+ void set_seamless(bool p_seamless);
+ bool get_seamless();
+
+ void set_as_normalmap(bool p_seamless);
+ bool is_normalmap();
+
+ void set_size(Vector2 p_size);
+ Vector2 get_size();
+
+ int get_width() const;
+ int get_height() const;
+
+ virtual void set_flags(uint32_t p_flags);
+ virtual uint32_t get_flags() const;
+
+ virtual RID get_rid() const { return texture; }
+ virtual bool has_alpha() const { return false; }
+
+ virtual Ref<Image> get_data() const;
+
+ NoiseTexture();
+ virtual ~NoiseTexture();
+};
+
+#endif // NOISE_TEXTURE_H
diff --git a/editor/editor_initialize_ssl.cpp b/modules/opensimplex/register_types.cpp
index 9f7537cc9a..9e4af99651 100644
--- a/editor/editor_initialize_ssl.cpp
+++ b/modules/opensimplex/register_types.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_initialize_ssl.cpp */
+/* register_types.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,21 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "editor_initialize_ssl.h"
+#include "register_types.h"
+#include "noise_texture.h"
+#include "simplex_noise.h"
-#include "certs_compressed.gen.h"
-#include "core/io/compression.h"
-#include "core/io/stream_peer_ssl.h"
+void register_opensimplex_types() {
-void editor_initialize_certificates() {
-
- PoolByteArray data;
- data.resize(_certs_uncompressed_size + 1);
- {
- PoolByteArray::Write w = data.write();
- Compression::decompress(w.ptr(), _certs_uncompressed_size, _certs_compressed, _certs_compressed_size, Compression::MODE_DEFLATE);
- w[_certs_uncompressed_size] = 0; //make sure it ends at zero
- }
+ ClassDB::register_class<SimplexNoise>();
+ ClassDB::register_class<NoiseTexture>();
+}
- StreamPeerSSL::load_certs_from_memory(data);
+void unregister_opensimplex_types() {
}
diff --git a/editor/editor_initialize_ssl.h b/modules/opensimplex/register_types.h
index 71d16b8c53..5e71a30ea6 100644
--- a/editor/editor_initialize_ssl.h
+++ b/modules/opensimplex/register_types.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_initialize_ssl.h */
+/* register_types.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,9 +28,5 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITOR_INITIALIZE_SSL_H
-#define EDITOR_INITIALIZE_SSL_H
-
-void editor_initialize_certificates();
-
-#endif // EDITOR_INITIALIZE_SSL_H
+void register_opensimplex_types();
+void unregister_opensimplex_types();
diff --git a/modules/opensimplex/simplex_noise.cpp b/modules/opensimplex/simplex_noise.cpp
new file mode 100644
index 0000000000..e489b7f6f0
--- /dev/null
+++ b/modules/opensimplex/simplex_noise.cpp
@@ -0,0 +1,257 @@
+/*************************************************************************/
+/* simplex_noise.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "simplex_noise.h"
+
+#include "core/core_string_names.h"
+
+SimplexNoise::SimplexNoise() {
+
+ seed = 0;
+ persistence = 0.5;
+ octaves = 3;
+ period = 64;
+ lacunarity = 2.0;
+
+ _init_seeds();
+}
+
+SimplexNoise::~SimplexNoise() {
+}
+
+void SimplexNoise::_init_seeds() {
+ for (int i = 0; i < 6; ++i) {
+ open_simplex_noise(seed + i * 2, &(contexts[i]));
+ }
+}
+
+void SimplexNoise::set_seed(int p_seed) {
+
+ if (seed == p_seed)
+ return;
+
+ seed = p_seed;
+
+ _init_seeds();
+
+ emit_changed();
+}
+
+int SimplexNoise::get_seed() {
+
+ return seed;
+}
+
+void SimplexNoise::set_octaves(int p_octaves) {
+ if (p_octaves == octaves) return;
+ octaves = CLAMP(p_octaves, 1, 6);
+ emit_changed();
+}
+
+void SimplexNoise::set_period(float p_period) {
+ if (p_period == period) return;
+ period = p_period;
+ emit_changed();
+}
+
+void SimplexNoise::set_persistence(float p_persistence) {
+ if (p_persistence == persistence) return;
+ persistence = p_persistence;
+ emit_changed();
+}
+
+void SimplexNoise::set_lacunarity(float p_lacunarity) {
+ if (p_lacunarity == lacunarity) return;
+ lacunarity = p_lacunarity;
+ emit_changed();
+}
+
+Ref<Image> SimplexNoise::get_image(int p_width, int p_height) {
+
+ PoolVector<uint8_t> data;
+ data.resize(p_width * p_height * 4);
+
+ PoolVector<uint8_t>::Write wd8 = data.write();
+
+ for (int i = 0; i < p_height; i++) {
+ for (int j = 0; j < p_width; j++) {
+ float v = get_noise_2d(i, j);
+ v = v * 0.5 + 0.5; // Normalize [0..1]
+ uint8_t value = uint8_t(CLAMP(v * 255.0, 0, 255));
+ wd8[(i * p_width + j) * 4 + 0] = value;
+ wd8[(i * p_width + j) * 4 + 1] = value;
+ wd8[(i * p_width + j) * 4 + 2] = value;
+ wd8[(i * p_width + j) * 4 + 3] = 255;
+ }
+ }
+
+ Ref<Image> image = memnew(Image(p_width, p_height, false, Image::FORMAT_RGBA8, data));
+ return image;
+}
+
+Ref<Image> SimplexNoise::get_seamless_image(int p_size) {
+
+ PoolVector<uint8_t> data;
+ data.resize(p_size * p_size * 4);
+
+ PoolVector<uint8_t>::Write wd8 = data.write();
+
+ for (int i = 0; i < p_size; i++) {
+ for (int j = 0; j < p_size; j++) {
+
+ float ii = (float)i / (float)p_size;
+ float jj = (float)j / (float)p_size;
+
+ ii *= 2.0 * Math_PI;
+ jj *= 2.0 * Math_PI;
+
+ float radius = p_size / (2.0 * Math_PI);
+
+ float x = radius * Math::sin(jj);
+ float y = radius * Math::cos(jj);
+ float z = radius * Math::sin(ii);
+ float w = radius * Math::cos(ii);
+ float v = get_noise_4d(x, y, z, w);
+
+ v = v * 0.5 + 0.5; // Normalize [0..1]
+ uint8_t value = uint8_t(CLAMP(v * 255.0, 0, 255));
+ wd8[(i * p_size + j) * 4 + 0] = value;
+ wd8[(i * p_size + j) * 4 + 1] = value;
+ wd8[(i * p_size + j) * 4 + 2] = value;
+ wd8[(i * p_size + j) * 4 + 3] = 255;
+ }
+ }
+
+ Ref<Image> image = memnew(Image(p_size, p_size, false, Image::FORMAT_RGBA8, data));
+ return image;
+}
+
+void SimplexNoise::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("get_seed"), &SimplexNoise::get_seed);
+ ClassDB::bind_method(D_METHOD("set_seed", "seed"), &SimplexNoise::set_seed);
+
+ ClassDB::bind_method(D_METHOD("set_octaves", "octave_count"), &SimplexNoise::set_octaves);
+ ClassDB::bind_method(D_METHOD("get_octaves"), &SimplexNoise::get_octaves);
+
+ ClassDB::bind_method(D_METHOD("set_period", "period"), &SimplexNoise::set_period);
+ ClassDB::bind_method(D_METHOD("get_period"), &SimplexNoise::get_period);
+
+ ClassDB::bind_method(D_METHOD("set_persistence", "persistence"), &SimplexNoise::set_persistence);
+ ClassDB::bind_method(D_METHOD("get_persistence"), &SimplexNoise::get_persistence);
+
+ ClassDB::bind_method(D_METHOD("set_lacunarity", "lacunarity"), &SimplexNoise::set_lacunarity);
+ ClassDB::bind_method(D_METHOD("get_lacunarity"), &SimplexNoise::get_lacunarity);
+
+ ClassDB::bind_method(D_METHOD("get_image", "width", "height"), &SimplexNoise::get_image);
+ ClassDB::bind_method(D_METHOD("get_seamless_image", "size"), &SimplexNoise::get_seamless_image);
+
+ ClassDB::bind_method(D_METHOD("get_noise_2d", "x", "y"), &SimplexNoise::get_noise_2d);
+ ClassDB::bind_method(D_METHOD("get_noise_3d", "x", "y", "z"), &SimplexNoise::get_noise_3d);
+ ClassDB::bind_method(D_METHOD("get_noise_4d", "x", "y", "z", "w"), &SimplexNoise::get_noise_4d);
+
+ ClassDB::bind_method(D_METHOD("get_noise_2dv", "pos"), &SimplexNoise::get_noise_2dv);
+ ClassDB::bind_method(D_METHOD("get_noise_3dv", "pos"), &SimplexNoise::get_noise_3dv);
+
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "octaves", PROPERTY_HINT_RANGE, "1,6,1"), "set_octaves", "get_octaves");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "period", PROPERTY_HINT_RANGE, "0.1,256.0,0.1"), "set_period", "get_period");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "persistence", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_persistence", "get_persistence");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "lacunarity", PROPERTY_HINT_RANGE, "0.1,4.0,0.01"), "set_lacunarity", "get_lacunarity");
+}
+
+float SimplexNoise::get_noise_2d(float x, float y) {
+
+ x /= period;
+ y /= period;
+
+ float amp = 1.0;
+ float max = 1.0;
+ float sum = _get_octave_noise_2d(0, x, y);
+
+ unsigned int i = 0;
+ while (++i < octaves) {
+ x *= lacunarity;
+ y *= lacunarity;
+ amp *= persistence;
+ max += amp;
+ sum += _get_octave_noise_2d(i, x, y) * amp;
+ }
+
+ return sum / max;
+}
+
+float SimplexNoise::get_noise_3d(float x, float y, float z) {
+
+ x /= period;
+ y /= period;
+ z /= period;
+
+ float amp = 1.0;
+ float max = 1.0;
+ float sum = _get_octave_noise_3d(0, x, y, z);
+
+ unsigned int i = 0;
+ while (++i < octaves) {
+ x *= lacunarity;
+ y *= lacunarity;
+ z *= lacunarity;
+ amp *= persistence;
+ max += amp;
+ sum += _get_octave_noise_3d(i, x, y, z) * amp;
+ }
+
+ return sum / max;
+}
+
+float SimplexNoise::get_noise_4d(float x, float y, float z, float w) {
+
+ x /= period;
+ y /= period;
+ z /= period;
+ w /= period;
+
+ float amp = 1.0;
+ float max = 1.0;
+ float sum = _get_octave_noise_4d(0, x, y, z, w);
+
+ unsigned int i = 0;
+ while (++i < octaves) {
+ x *= lacunarity;
+ y *= lacunarity;
+ z *= lacunarity;
+ w *= lacunarity;
+ amp *= persistence;
+ max += amp;
+ sum += _get_octave_noise_4d(i, x, y, z, w) * amp;
+ }
+
+ return sum / max;
+}
diff --git a/modules/opensimplex/simplex_noise.h b/modules/opensimplex/simplex_noise.h
new file mode 100644
index 0000000000..9a48dbf809
--- /dev/null
+++ b/modules/opensimplex/simplex_noise.h
@@ -0,0 +1,93 @@
+/*************************************************************************/
+/* simplex_noise.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#ifndef SIMPLEX_NOISE_H
+#define SIMPLEX_NOISE_H
+
+#include "core/image.h"
+#include "core/reference.h"
+#include "scene/resources/texture.h"
+
+#include "thirdparty/misc/open-simplex-noise.h"
+
+class SimplexNoise : public Resource {
+ GDCLASS(SimplexNoise, Resource)
+ OBJ_SAVE_TYPE(SimplexNoise);
+
+ osn_context contexts[6];
+
+ int seed;
+ float persistence; // Controls details, value in [0,1]. Higher increases grain, lower increases smoothness.
+ int octaves; // Number of noise layers
+ float period; // Distance above which we start to see similarities. The higher, the longer "hills" will be on a terrain.
+ float lacunarity; // Controls period change across octaves. 2 is usually a good value to address all detail levels.
+
+public:
+ SimplexNoise();
+ ~SimplexNoise();
+
+ void _init_seeds();
+
+ void set_seed(int seed);
+ int get_seed();
+
+ void set_octaves(int p_octaves);
+ int get_octaves() const { return octaves; }
+
+ void set_period(float p_period);
+ float get_period() const { return period; }
+
+ void set_persistence(float p_persistence);
+ float get_persistence() const { return persistence; }
+
+ void set_lacunarity(float p_lacunarity);
+ float get_lacunarity() const { return lacunarity; }
+
+ Ref<Image> get_image(int p_width, int p_height);
+ Ref<Image> get_seamless_image(int p_size);
+
+ float get_noise_2d(float x, float y);
+ float get_noise_3d(float x, float y, float z);
+ float get_noise_4d(float x, float y, float z, float w);
+
+ _FORCE_INLINE_ float _get_octave_noise_2d(int octave, float x, float y) { return open_simplex_noise2(&(contexts[octave]), x, y); }
+ _FORCE_INLINE_ float _get_octave_noise_3d(int octave, float x, float y, float z) { return open_simplex_noise3(&(contexts[octave]), x, y, z); }
+ _FORCE_INLINE_ float _get_octave_noise_4d(int octave, float x, float y, float z, float w) { return open_simplex_noise4(&(contexts[octave]), x, y, z, w); }
+
+ // Convenience
+
+ _FORCE_INLINE_ float get_noise_2dv(Vector2 v) { return get_noise_2d(v.x, v.y); }
+ _FORCE_INLINE_ float get_noise_3dv(Vector3 v) { return get_noise_3d(v.x, v.y, v.z); }
+
+protected:
+ static void _bind_methods();
+};
+
+#endif // OPENSIMPLEX_NOISE_H
diff --git a/modules/opus/audio_stream_opus.cpp b/modules/opus/audio_stream_opus.cpp
index 8323ff33ac..3920b3cd6e 100644
--- a/modules/opus/audio_stream_opus.cpp
+++ b/modules/opus/audio_stream_opus.cpp
@@ -142,7 +142,7 @@ Error AudioStreamPlaybackOpus::_load_stream() {
} break;
case OP_EBADLINK: // - Failed to find old data after seeking.
case OP_EBADTIMESTAMP: // - Timestamp failed the validity checks.
- case OP_EBADHEADER: { // - Invalid or mising Opus bitstream header.
+ case OP_EBADHEADER: { // - Invalid or missing Opus bitstream header.
memdelete(f);
f = NULL;
ERR_FAIL_V(ERR_FILE_CORRUPT);
@@ -208,7 +208,7 @@ Error AudioStreamPlaybackOpus::set_file(const String &p_file) {
} break;
case OP_EBADLINK: // - Failed to find old data after seeking.
case OP_EBADTIMESTAMP: // - Timestamp failed the validity checks.
- case OP_EBADHEADER: { // - Invalid or mising Opus bitstream header.
+ case OP_EBADHEADER: { // - Invalid or missing Opus bitstream header.
memdelete(f);
f = NULL;
ERR_FAIL_V(ERR_FILE_CORRUPT);
diff --git a/modules/upnp/doc_classes/UPNP.xml b/modules/upnp/doc_classes/UPNP.xml
index 30be9c836b..b98327c60d 100644
--- a/modules/upnp/doc_classes/UPNP.xml
+++ b/modules/upnp/doc_classes/UPNP.xml
@@ -69,7 +69,7 @@
</argument>
<description>
Discovers local [UPNPDevice]s. Clears the list of previously discovered devices.
- Filters for IGD (InternetGatewayDevice) type devices by default, as those manage port forwarding. [code]timeout[/code] is the time to wait for responses in miliseconds. [code]ttl[/code] is the time-to-live; only touch this if you know what you're doing.
+ Filters for IGD (InternetGatewayDevice) type devices by default, as those manage port forwarding. [code]timeout[/code] is the time to wait for responses in milliseconds. [code]ttl[/code] is the time-to-live; only touch this if you know what you're doing.
See [enum UPNPResult] for possible return values.
</description>
</method>
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index e7a4e0c31f..60bc54afe4 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -260,7 +260,12 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const
case MATH_SQRT: {
return PropertyInfo(Variant::REAL, "s");
} break;
- case MATH_ATAN2:
+ case MATH_ATAN2: {
+ if (p_idx == 0)
+ return PropertyInfo(Variant::REAL, "y");
+ else
+ return PropertyInfo(Variant::REAL, "x");
+ } break;
case MATH_FMOD:
case MATH_FPOSMOD: {
if (p_idx == 0)
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index c9b52a221a..1027c74f34 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -2343,7 +2343,7 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot,
int from_port;
if (!_get_out_slot(from_node, p_from_slot, from_port, from_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
Ref<VisualScriptNode> to_node = script->get_node(edited_func, p_to.to_int());
ERR_FAIL_COND(!to_node.is_valid());
@@ -2352,7 +2352,7 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot,
int to_port;
if (!_get_in_slot(to_node, p_to_slot, to_port, to_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
ERR_FAIL_COND(from_seq != to_seq);
@@ -2363,7 +2363,7 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot,
undo_redo->add_undo_method(script.ptr(), "sequence_disconnect", edited_func, p_from.to_int(), from_port, p_to.to_int());
} else {
- // disconect current, and connect the new one
+ // disconnect current, and connect the new one
if (script->is_input_value_port_connected(edited_func, p_to.to_int(), to_port)) {
int conn_from;
int conn_port;
@@ -2396,7 +2396,7 @@ void VisualScriptEditor::_graph_disconnected(const String &p_from, int p_from_sl
int from_port;
if (!_get_out_slot(from_node, p_from_slot, from_port, from_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
Ref<VisualScriptNode> to_node = script->get_node(edited_func, p_to.to_int());
ERR_FAIL_COND(!to_node.is_valid());
@@ -2405,7 +2405,7 @@ void VisualScriptEditor::_graph_disconnected(const String &p_from, int p_from_sl
int to_port;
if (!_get_in_slot(to_node, p_to_slot, to_port, to_seq))
- return; //can't connect this, it' s invalid
+ return; //can't connect this, it's invalid
ERR_FAIL_COND(from_seq != to_seq);
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 99f242e974..5c880f48d1 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -167,7 +167,7 @@ void VisualScriptFunction::_get_property_list(List<PropertyInfo> *p_list) const
p_list->push_back(PropertyInfo(Variant::INT, "stack/size", PROPERTY_HINT_RANGE, "1,100000"));
}
p_list->push_back(PropertyInfo(Variant::BOOL, "stack/stackless"));
- p_list->push_back(PropertyInfo(Variant::INT, "rpc/mode", PROPERTY_HINT_ENUM, "Disabled,Remote,Sync,Master,Slave"));
+ p_list->push_back(PropertyInfo(Variant::INT, "rpc/mode", PROPERTY_HINT_ENUM, "Disabled,Remote,Master,Puppet,Remote Sync,Master Sync,Puppet Sync"));
}
int VisualScriptFunction::get_output_sequence_port_count() const {
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index 39997d14c4..9942d5baa6 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -31,6 +31,7 @@
#include "visual_script_property_selector.h"
#include "core/os/keyboard.h"
+#include "editor/editor_node.h"
#include "editor_scale.h"
#include "modules/visual_script/visual_script.h"
#include "modules/visual_script/visual_script_builtin_funcs.h"
@@ -176,10 +177,8 @@ void VisualScriptPropertySelector::_update_search() {
Ref<Texture> icon;
if (E->get().name == "Script Variables") {
icon = get_icon("Script", "EditorIcons");
- } else if (has_icon(E->get().name, "EditorIcons")) {
- icon = get_icon(E->get().name, "EditorIcons");
} else {
- icon = get_icon("Object", "EditorIcons");
+ icon = EditorNode::get_singleton()->get_class_icon(E->get().name);
}
category->set_icon(0, icon);
continue;
@@ -289,10 +288,8 @@ void VisualScriptPropertySelector::_update_search() {
if (E->get().name == "*Script Methods") {
icon = get_icon("Script", "EditorIcons");
script_methods = true;
- } else if (has_icon(rep, "EditorIcons")) {
- icon = get_icon(rep, "EditorIcons");
} else {
- icon = get_icon("Object", "EditorIcons");
+ icon = EditorNode::get_singleton()->get_class_icon(rep);
}
category->set_icon(0, icon);
diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml
index 2e11e1a44c..9241492623 100644
--- a/modules/websocket/doc_classes/WebSocketClient.xml
+++ b/modules/websocket/doc_classes/WebSocketClient.xml
@@ -25,7 +25,7 @@
</argument>
<description>
Connect to the given URL requesting one of the given [code]protocols[/code] as sub-protocol.
- If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connnections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true.
+ If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true.
</description>
</method>
<method name="disconnect_from_host">
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index a3dec27a6f..9594c6fdf4 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -144,7 +144,7 @@ private:
int video_driver_index;
public:
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
virtual int get_video_driver_count() const;
virtual const char *get_video_driver_name(int p_driver) const;
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 3c99f37bb5..b0ec3c4245 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -39,6 +39,7 @@
#include "unix/file_access_unix.h"
#include <emscripten.h>
+#include <png.h>
#include <stdlib.h>
#include "dom_keys.inc"
@@ -708,7 +709,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
video_driver_index = p_video_driver;
video_mode = p_desired;
- // Can't fulfil fullscreen request during start-up due to browser security.
+ // Can't fulfill fullscreen request during start-up due to browser security.
video_mode.fullscreen = false;
/* clang-format off */
if (EM_ASM_INT_V({ return Module.resizeCanvasOnStart })) {
@@ -912,6 +913,57 @@ void OS_JavaScript::set_window_title(const String &p_title) {
/* clang-format on */
}
+void OS_JavaScript::set_icon(const Ref<Image> &p_icon) {
+
+ ERR_FAIL_COND(p_icon.is_null());
+ Ref<Image> icon = p_icon;
+ if (icon->is_compressed()) {
+ icon = icon->duplicate();
+ ERR_FAIL_COND(icon->decompress() != OK)
+ }
+ if (icon->get_format() != Image::FORMAT_RGBA8) {
+ if (icon == p_icon)
+ icon = icon->duplicate();
+ icon->convert(Image::FORMAT_RGBA8);
+ }
+
+ png_image png_meta;
+ memset(&png_meta, 0, sizeof png_meta);
+ png_meta.version = PNG_IMAGE_VERSION;
+ png_meta.width = icon->get_width();
+ png_meta.height = icon->get_height();
+ png_meta.format = PNG_FORMAT_RGBA;
+
+ PoolByteArray png;
+ size_t len;
+ PoolByteArray::Read r = icon->get_data().read();
+ ERR_FAIL_COND(!png_image_write_get_memory_size(png_meta, len, 0, r.ptr(), 0, NULL));
+
+ png.resize(len);
+ PoolByteArray::Write w = png.write();
+ ERR_FAIL_COND(!png_image_write_to_memory(&png_meta, w.ptr(), &len, 0, r.ptr(), 0, NULL));
+ w = PoolByteArray::Write();
+
+ r = png.read();
+ /* clang-format off */
+ EM_ASM_ARGS({
+ var PNG_PTR = $0;
+ var PNG_LEN = $1;
+
+ var png = new Blob([HEAPU8.slice(PNG_PTR, PNG_PTR + PNG_LEN)], { type: "image/png" });
+ var url = URL.createObjectURL(png);
+ var link = document.getElementById('-gd-engine-icon');
+ if (link === null) {
+ link = document.createElement('link');
+ link.rel = 'icon';
+ link.id = '-gd-engine-icon';
+ document.head.appendChild(link);
+ }
+ link.href = url;
+ }, r.ptr(), len);
+ /* clang-format on */
+}
+
String OS_JavaScript::get_executable_path() const {
return OS::get_executable_path();
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index f40fb8fc7e..ddcbf8c7c9 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -135,6 +135,7 @@ public:
virtual void alert(const String &p_alert, const String &p_title = "ALERT!");
virtual void set_window_title(const String &p_title);
+ virtual void set_icon(const Ref<Image> &p_icon);
String get_executable_path() const;
virtual Error shell_open(String p_uri);
virtual String get_name();
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index c0de4e3f2a..886ff4b332 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1662,8 +1662,10 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
[cursors[p_shape] release];
cursors[p_shape] = cursor;
- if (p_shape == CURSOR_ARROW) {
- [cursor set];
+ if (p_shape == cursor_shape) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ [cursor set];
+ }
}
[imgrep release];
@@ -1671,8 +1673,10 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
} else {
// Reset to default system cursor
cursors[p_shape] = NULL;
+
+ CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
- set_cursor_shape(p_shape);
+ set_cursor_shape(c);
}
}
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 5b5f30244e..f489c0894f 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -406,6 +406,8 @@ void OSUWP::finalize() {
}
void OSUWP::finalize_core() {
+
+ NetSocketPosix::cleanup();
}
void OSUWP::alert(const String &p_alert, const String &p_title) {
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 574e152d52..9641b9cde9 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -152,7 +152,7 @@ private:
Windows::Devices::Sensors::Magnetometer ^ magnetometer;
Windows::Devices::Sensors::Gyrometer ^ gyrometer;
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
protected:
virtual int get_video_driver_count() const;
virtual int get_current_video_driver() const;
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 586533e817..5dfb1592e0 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -29,6 +29,7 @@ prog = env.add_program('#bin/godot', common_win + res_obj, PROGSUFFIX=env["PROGS
# Microsoft Visual Studio Project Generation
if env['vsproj']:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file]
+ env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 150d418502..5d5af17086 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -208,8 +208,8 @@ def configure_msvc(env, manual_msvc_config):
'RTAUDIO_ENABLED', 'WASAPI_ENABLED',
'WINMIDI_ENABLED', 'TYPED_METHOD_BIND',
'WIN32', 'MSVC',
- {'WINVER' : '$target_win_version',
- '_WIN32_WINNT': '$target_win_version'}])
+ 'WINVER=$target_win_version',
+ '_WIN32_WINNT=$target_win_version'])
env.AppendUnique(CPPDEFINES=['NOMINMAX']) # disable bogus min/max WinDef.h macros
if env["bits"] == "64":
env.AppendUnique(CPPDEFINES=['_WIN64'])
diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis
new file mode 100644
index 0000000000..01963035a1
--- /dev/null
+++ b/platform/windows/godot.natvis
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+ <Type Name="Vector&lt;*&gt;">
+ <Expand>
+ <Item Name="size">(_cowdata &amp;&amp; _cowdata-&gt;_ptr) ? (((const unsigned int *)(_cowdata-&gt;_ptr))[-1]) : 0</Item>
+ <ArrayItems>
+ <Size>(_cowdata &amp;&amp; _cowdata-&gt;_ptr) ? (((const unsigned int *)(_cowdata-&gt;_ptr))[-1]) : 0</Size>
+ <ValuePointer>(_cowdata) ? (_cowdata-&gt;_ptr) : 0</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Type>
+
+ <Type Name="PoolVector&lt;*&gt;">
+ <Expand>
+ <Item Name="size">alloc ? (alloc-&gt;size / sizeof($T1)) : 0</Item>
+ <ArrayItems>
+ <Size>alloc ? (alloc-&gt;size / sizeof($T1)) : 0</Size>
+ <ValuePointer>alloc ? (($T1 *)alloc-&gt;mem) : 0</ValuePointer>
+ </ArrayItems>
+ </Expand>
+ </Type>
+
+ <Type Name="Variant">
+ <DisplayString Condition="this-&gt;type == Variant::NIL">nil</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::BOOL">{_data._bool}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::INT">{_data._int}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::REAL">{_data._real}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::TRANSFORM2D">{_data._transform2d}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::AABB">{_data._aabb}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::BASIS">{_data._basis}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::TRANSFORM">{_data._transform}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::STRING &amp;&amp; ((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr == 0">""</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::STRING &amp;&amp; ((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr != 0">{((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr,su}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::VECTOR2">{*(Vector2 *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::RECT2">{*(Rect2 *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::VECTOR3">{*(Vector3 *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::PLANE">{*(Plane *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::_RID">{*(RID *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::OBJECT">{*(Object *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::DICTIONARY">{*(Dictionary *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::ARRAY">{*(Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_BYTE_ARRAY">{*(PoolByteArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_INT_ARRAY">{*(PoolIntArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_REAL_ARRAY">{*(PoolRealArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_STRING_ARRAY">{*(PoolStringArray *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_VECTOR2_ARRAY">{*(PoolVector2Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_VECTOR3_ARRAY">{*(PoolVector3Array *)_data._mem}</DisplayString>
+ <DisplayString Condition="this-&gt;type == Variant::POOL_COLOR_ARRAY">{*(PoolColorArray *)_data._mem}</DisplayString>
+
+ <StringView Condition="this-&gt;type == Variant::STRING &amp;&amp; ((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr != 0">((String *)(&amp;_data._mem[0]))-&gt;_cowdata._ptr,su</StringView>
+
+ <Expand>
+ <Item Name="value" Condition="this-&gt;type == Variant::BOOL">_data._bool</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::INT">_data._int</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::REAL">_data._real</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::TRANSFORM2D">_data._transform2d</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::AABB">_data._aabb</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::BASIS">_data._basis</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::TRANSFORM">_data._transform</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::ARRAY">*(Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::STRING">*(String *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::VECTOR2">*(Vector2 *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::RECT2">*(Rect2 *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::VECTOR3">*(Vector3 *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::PLANE">*(Plane *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::QUAT">*(Quat *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::COLOR">*(Color *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::_RID">*(RID *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::OBJECT">*(Object *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::DICTIONARY">*(Dictionary *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::ARRAY">*(Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_BYTE_ARRAY">*(PoolByteArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_INT_ARRAY">*(PoolIntArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_REAL_ARRAY">*(PoolRealArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_STRING_ARRAY">*(PoolStringArray *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_VECTOR2_ARRAY">*(PoolVector2Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_VECTOR3_ARRAY">*(PoolVector3Array *)_data._mem</Item>
+ <Item Name="value" Condition="this-&gt;type == Variant::POOL_COLOR_ARRAY">*(PoolColorArray *)_data._mem</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="String">
+ <DisplayString Condition="this-&gt;_cowdata._ptr == 0">empty</DisplayString>
+ <DisplayString Condition="this-&gt;_cowdata._ptr != 0">{this->_cowdata._ptr,su}</DisplayString>
+ <StringView Condition="this-&gt;_cowdata._ptr != 0">this->_cowdata._ptr,su</StringView>
+ </Type>
+
+ <Type Name="Vector2">
+ <DisplayString>{{{x},{y}}}</DisplayString>
+ <Expand>
+ <Item Name="x">x</Item>
+ <Item Name="y">y</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="Vector3">
+ <DisplayString>{{{x},{y},{z}}}</DisplayString>
+ <Expand>
+ <Item Name="x">x</Item>
+ <Item Name="y">y</Item>
+ <Item Name="z">z</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="Quat">
+ <DisplayString>Quat {{{x},{y},{z},{w}}}</DisplayString>
+ <Expand>
+ <Item Name="x">x</Item>
+ <Item Name="y">y</Item>
+ <Item Name="z">z</Item>
+ <Item Name="w">w</Item>
+ </Expand>
+ </Type>
+
+ <Type Name="Color">
+ <DisplayString>Color {{{r},{g},{b},{a}}}</DisplayString>
+ <Expand>
+ <Item Name="red">r</Item>
+ <Item Name="green">g</Item>
+ <Item Name="blue">b</Item>
+ <Item Name="alpha">a</Item>
+ </Expand>
+ </Type>
+</AutoVisualizer>
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 6723210432..d575525f93 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1512,6 +1512,7 @@ void OS_Windows::finalize_core() {
timeEndPeriod(1);
memdelete(process_map);
+ NetSocketPosix::cleanup();
}
void OS_Windows::alert(const String &p_alert, const String &p_title) {
@@ -2310,8 +2311,10 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
cursors[p_shape] = CreateIconIndirect(&iconinfo);
- if (p_shape == CURSOR_ARROW) {
- SetCursor(cursors[p_shape]);
+ if (p_shape == cursor_shape) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ SetCursor(cursors[p_shape]);
+ }
}
if (hAndMask != NULL) {
@@ -2327,8 +2330,10 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
} else {
// Reset to default system cursor
cursors[p_shape] = NULL;
+
+ CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
- set_cursor_shape(p_shape);
+ set_cursor_shape(c);
}
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 0abede5b10..01e1c51ca5 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -157,7 +157,7 @@ class OS_Windows : public OS {
void _update_window_style(bool repaint = true);
- // functions used by main to initialize/deintialize the OS
+ // functions used by main to initialize/deinitialize the OS
protected:
virtual int get_current_video_driver() const;
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index b80a20ce40..3d05a650da 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -2524,13 +2524,16 @@ void OS_X11::set_cursor_shape(CursorShape p_shape) {
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
- if (p_shape == current_cursor)
+ if (p_shape == current_cursor) {
return;
- if (mouse_mode == MOUSE_MODE_VISIBLE && mouse_mode != MOUSE_MODE_CONFINED) {
- if (cursors[p_shape] != None)
+ }
+
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ if (cursors[p_shape] != None) {
XDefineCursor(x11_display, x11_window, cursors[p_shape]);
- else if (cursors[CURSOR_ARROW] != None)
+ } else if (cursors[CURSOR_ARROW] != None) {
XDefineCursor(x11_display, x11_window, cursors[CURSOR_ARROW]);
+ }
}
current_cursor = p_shape;
@@ -2606,8 +2609,10 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
// Save it for a further usage
cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_image);
- if (p_shape == CURSOR_ARROW) {
- XDefineCursor(x11_display, x11_window, cursors[p_shape]);
+ if (p_shape == current_cursor) {
+ if (mouse_mode == MOUSE_MODE_VISIBLE || mouse_mode == MOUSE_MODE_CONFINED) {
+ XDefineCursor(x11_display, x11_window, cursors[p_shape]);
+ }
}
memfree(cursor_image->pixels);
@@ -2618,8 +2623,9 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
cursors[p_shape] = XcursorImageLoadCursor(x11_display, img[p_shape]);
}
+ CursorShape c = current_cursor;
current_cursor = CURSOR_MAX;
- set_cursor_shape(p_shape);
+ set_cursor_shape(c);
}
}
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 790606a0b2..a33fc844a5 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -227,6 +227,65 @@ bool SpriteFrames::get_animation_loop(const StringName &p_anim) const {
return E->get().loop;
}
+void SpriteFrames::_set_frames(const Array &p_frames) {
+
+ clear_all();
+ Map<StringName, Anim>::Element *E = animations.find(SceneStringNames::get_singleton()->_default);
+ ERR_FAIL_COND(!E);
+
+ E->get().frames.resize(p_frames.size());
+ for (int i = 0; i < E->get().frames.size(); i++)
+ E->get().frames.write[i] = p_frames[i];
+}
+Array SpriteFrames::_get_frames() const {
+
+ return Array();
+}
+
+Array SpriteFrames::_get_animations() const {
+
+ Array anims;
+ for (Map<StringName, Anim>::Element *E = animations.front(); E; E = E->next()) {
+ Dictionary d;
+ d["name"] = E->key();
+ d["speed"] = E->get().speed;
+ d["loop"] = E->get().loop;
+ Array frames;
+ for (int i = 0; i < E->get().frames.size(); i++) {
+ frames.push_back(E->get().frames[i]);
+ }
+ d["frames"] = frames;
+ anims.push_back(d);
+ }
+
+ return anims;
+}
+void SpriteFrames::_set_animations(const Array &p_animations) {
+
+ animations.clear();
+ for (int i = 0; i < p_animations.size(); i++) {
+
+ Dictionary d = p_animations[i];
+
+ ERR_CONTINUE(!d.has("name"));
+ ERR_CONTINUE(!d.has("speed"));
+ ERR_CONTINUE(!d.has("loop"));
+ ERR_CONTINUE(!d.has("frames"));
+
+ Anim anim;
+ anim.speed = d["speed"];
+ anim.loop = d["loop"];
+ Array frames = d["frames"];
+ for (int i = 0; i < frames.size(); i++) {
+
+ RES res = frames[i];
+ anim.frames.push_back(res);
+ }
+
+ animations[d["name"]] = anim;
+ }
+}
+
void SpriteFrames::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_animation", "anim"), &SpriteFrames::add_animation);
@@ -249,6 +308,16 @@ void SpriteFrames::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_frame", "anim", "idx"), &SpriteFrames::remove_frame);
ClassDB::bind_method(D_METHOD("clear", "anim"), &SpriteFrames::clear);
ClassDB::bind_method(D_METHOD("clear_all"), &SpriteFrames::clear_all);
+
+ ClassDB::bind_method(D_METHOD("_set_frames"), &SpriteFrames::_set_frames);
+ ClassDB::bind_method(D_METHOD("_get_frames"), &SpriteFrames::_get_frames);
+
+ ADD_PROPERTYNZ(PropertyInfo(Variant::ARRAY, "frames", PROPERTY_HINT_NONE, "", 0), "_set_frames", "_get_frames"); //compatibility
+
+ ClassDB::bind_method(D_METHOD("_set_animations"), &SpriteFrames::_set_animations);
+ ClassDB::bind_method(D_METHOD("_get_animations"), &SpriteFrames::_get_animations);
+
+ ADD_PROPERTYNZ(PropertyInfo(Variant::ARRAY, "animations", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_animations", "_get_animations"); //compatibility
}
SpriteFrames::SpriteFrames() {
diff --git a/scene/2d/animated_sprite.h b/scene/2d/animated_sprite.h
index 672c9ef327..cc49465403 100644
--- a/scene/2d/animated_sprite.h
+++ b/scene/2d/animated_sprite.h
@@ -54,6 +54,12 @@ class SpriteFrames : public Resource {
Map<StringName, Anim> animations;
+ Array _get_frames() const;
+ void _set_frames(const Array &p_frames);
+
+ Array _get_animations() const;
+ void _set_animations(const Array &p_animations);
+
Vector<String> _get_animation_list() const;
protected:
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index 6dc2e2e39d..36a0e4039a 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -348,7 +348,7 @@ public:
void force_update_transform();
- // Used by control nodes to retreive the parent's anchorable area
+ // Used by control nodes to retrieve the parent's anchorable area
virtual Rect2 get_anchorable_rect() const { return Rect2(0, 0, 0, 0); };
int get_canvas_layer() const;
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index 80c2f005b6..d674958d33 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -48,6 +48,13 @@ void Light::set_param(Param p_param, float p_value) {
if (p_param == PARAM_SPOT_ANGLE || p_param == PARAM_RANGE) {
update_gizmo();
+
+ if (p_param == PARAM_SPOT_ANGLE) {
+ _change_notify("spot_angle");
+ } else if (p_param == PARAM_RANGE) {
+ _change_notify("omni_range");
+ _change_notify("spot_range");
+ }
}
}
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 36c0dfc18a..774ee49af2 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -431,7 +431,7 @@ void Sprite3D::_draw() {
};
- Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height());
+ Vector2 src_tsize = tsize;
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
@@ -441,10 +441,10 @@ void Sprite3D::_draw() {
}
Vector2 uvs[4] = {
- final_src_rect.position / tsize,
- (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize,
- (final_src_rect.position + final_src_rect.size) / tsize,
- (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize,
+ final_src_rect.position / src_tsize,
+ (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / src_tsize,
+ (final_src_rect.position + final_src_rect.size) / src_tsize,
+ (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / src_tsize,
};
if (is_flipped_h()) {
@@ -731,7 +731,7 @@ void AnimatedSprite3D::_draw() {
};
- Vector2 src_tsize = Vector2(texture->get_width(), texture->get_height());
+ Vector2 src_tsize = tsize;
// Properly setup UVs for impostor textures (AtlasTexture).
Ref<AtlasTexture> atlas_tex = texture;
@@ -741,10 +741,10 @@ void AnimatedSprite3D::_draw() {
}
Vector2 uvs[4] = {
- final_src_rect.position / tsize,
- (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize,
- (final_src_rect.position + final_src_rect.size) / tsize,
- (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize,
+ final_src_rect.position / src_tsize,
+ (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / src_tsize,
+ (final_src_rect.position + final_src_rect.size) / src_tsize,
+ (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / src_tsize,
};
if (is_flipped_h()) {
diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp
index f9d096633c..56a86b6a17 100644
--- a/scene/3d/vehicle_body.cpp
+++ b/scene/3d/vehicle_body.cpp
@@ -562,7 +562,7 @@ void VehicleBody::_resolve_single_bilateral(PhysicsDirectBodyState *s, const Vec
b2invmass);
// FIXME: rel_vel assignment here is overwritten by the following assignment.
- // What seemes to be intended in the next next assignment is: rel_vel = normal.dot(rel_vel);
+ // What seems to be intended in the next next assignment is: rel_vel = normal.dot(rel_vel);
// Investigate why.
real_t rel_vel = jac.getRelativeVelocity(
s->get_linear_velocity(),
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 837723450c..5923ad7657 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -320,7 +320,7 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
}
if (!_travel(sm, start_request)) {
- //cant travel, then teleport
+ //can't travel, then teleport
path.clear();
current = start_request;
}
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 2a4d526a7f..7d91703cf8 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -419,7 +419,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
if (first_key_time == 0.0) {
//ignore, use for transition
if (key_count == 1)
- continue; //with one key we cant do anything
+ continue; //with one key we can't do anything
transition = a->track_get_key_transition(i, 0);
first_key_time = a->track_get_key_time(i, 1);
first_key = 1;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 7a4846e6d5..eb00f91bb3 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -192,7 +192,7 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin
case FILTER_IGNORE:
break; //will not happen anyway
case FILTER_PASS: {
- //values filtered pass, the rest dont
+ //values filtered pass, the rest don't
for (int i = 0; i < blend_count; i++) {
if (blendw[i] == 0) //not filtered, does not pass
continue;
@@ -206,7 +206,7 @@ float AnimationNode::_blend_node(const StringName &p_subpath, const Vector<Strin
} break;
case FILTER_STOP: {
- //values filtered dont pass, the rest are blended
+ //values filtered don't pass, the rest are blended
for (int i = 0; i < blend_count; i++) {
if (blendw[i] > 0) //filtered, does not pass
@@ -292,7 +292,7 @@ String AnimationNode::get_caption() const {
}
void AnimationNode::add_input(const String &p_name) {
- //root nodes cant add inputs
+ //root nodes can't add inputs
ERR_FAIL_COND(Object::cast_to<AnimationRootNode>(this) != NULL)
Input input;
ERR_FAIL_COND(p_name.find(".") != -1 || p_name.find("/") != -1);
@@ -1227,7 +1227,7 @@ void AnimationTree::_process_graph(float p_delta) {
t->object->set_indexed(t->subpath, t->value);
} break;
- default: {} //the rest dont matter
+ default: {} //the rest don't matter
}
}
}
diff --git a/scene/animation/root_motion_view.cpp b/scene/animation/root_motion_view.cpp
index 098bd05e9a..01a10dbc2b 100644
--- a/scene/animation/root_motion_view.cpp
+++ b/scene/animation/root_motion_view.cpp
@@ -112,7 +112,7 @@ void RootMotionView::_notification(int p_what) {
first = false;
- transform.orthonormalize(); //dont want scale, too imprecise
+ transform.orthonormalize(); //don't want scale, too imprecise
transform.affine_invert();
accumulated = transform * accumulated;
diff --git a/scene/animation/tween_interpolaters.cpp b/scene/animation/tween_interpolaters.cpp
index 11f2b0c17f..52aa7403c0 100644
--- a/scene/animation/tween_interpolaters.cpp
+++ b/scene/animation/tween_interpolaters.cpp
@@ -28,6 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+/**
+ * Adapted from Penner Easing equations' C++ port.
+ * Source: https://github.com/jesusgollonet/ofpennereasing
+ * License: BSD-3-clause
+ */
+
#include "tween.h"
const real_t pi = 3.1415926535898;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 24697e370f..12349e0983 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2877,7 +2877,7 @@ void Control::_bind_methods() {
ADD_GROUP("Mouse", "mouse_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_filter", PROPERTY_HINT_ENUM, "Stop,Pass,Ignore"), "set_mouse_filter", "get_mouse_filter");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertial split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_default_cursor_shape", PROPERTY_HINT_ENUM, "Arrow,Ibeam,Pointing hand,Cross,Wait,Busy,Drag,Can drop,Forbidden,Vertical resize,Horizontal resize,Secondary diagonal resize,Main diagonal resize,Move,Vertical split,Horizontal split,Help"), "set_default_cursor_shape", "get_default_cursor_shape");
ADD_GROUP("Size Flags", "size_flags_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "size_flags_horizontal", PROPERTY_HINT_FLAGS, "Fill,Expand,Shrink Center,Shrink End"), "set_h_size_flags", "get_h_size_flags");
diff --git a/scene/gui/control.h b/scene/gui/control.h
index c38cd66245..eb39d9ca0f 100644
--- a/scene/gui/control.h
+++ b/scene/gui/control.h
@@ -76,7 +76,7 @@ public:
SIZE_EXPAND = 2,
SIZE_EXPAND_FILL = SIZE_EXPAND | SIZE_FILL,
SIZE_SHRINK_CENTER = 4, //ignored by expand or fill
- SIZE_SHRINK_END = 8, //ignored by expand or fil
+ SIZE_SHRINK_END = 8, //ignored by expand or fill
};
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 9045197333..0ffaac20f6 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -1304,7 +1304,7 @@ GraphEdit::GraphEdit() {
add_child(connections_layer);
connections_layer->connect("draw", this, "_connections_layer_draw");
connections_layer->set_name("CLAYER");
- connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offseted
+ connections_layer->set_disable_visibility_clip(true); // so it can draw freely and be offset
connections_layer->set_mouse_filter(MOUSE_FILTER_IGNORE);
h_scroll = memnew(HScrollBar);
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index ce8de38b74..91dab27930 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -295,14 +295,13 @@ Size2 Label::get_minimum_size() const {
Size2 min_style = get_stylebox("normal")->get_minimum_size();
+ // don't want to mutable everything
+ if (word_cache_dirty)
+ const_cast<Label *>(this)->regenerate_word_cache();
+
if (autowrap)
return Size2(1, clip ? 1 : minsize.height) + min_style;
else {
-
- // don't want to mutable everything
- if (word_cache_dirty)
- const_cast<Label *>(this)->regenerate_word_cache();
-
Size2 ms = minsize;
if (clip)
ms.width = 1;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 1e281471a6..fa5019a6f7 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -29,12 +29,13 @@
/*************************************************************************/
#include "rich_text_label.h"
+
#include "core/os/keyboard.h"
#include "core/os/os.h"
#include "scene/scene_string_names.h"
#ifdef TOOLS_ENABLED
-#include "editor/editor_node.h"
+#include "editor/editor_scale.h"
#endif
RichTextLabel::Item *RichTextLabel::_get_next_item(Item *p_item, bool p_free) {
@@ -2295,7 +2296,7 @@ RichTextLabel::RichTextLabel() {
vscroll = memnew(VScrollBar);
add_child(vscroll);
- vscroll->set_drag_slave(String(".."));
+ vscroll->set_drag_node(String(".."));
vscroll->set_step(1);
vscroll->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 0);
vscroll->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0);
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index df27fb0e6b..07380f45cc 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -300,24 +300,24 @@ void ScrollBar::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- if (has_node(drag_slave_path)) {
- Node *n = get_node(drag_slave_path);
- drag_slave = Object::cast_to<Control>(n);
+ if (has_node(drag_node_path)) {
+ Node *n = get_node(drag_node_path);
+ drag_node = Object::cast_to<Control>(n);
}
- if (drag_slave) {
- drag_slave->connect("gui_input", this, "_drag_slave_input");
- drag_slave->connect("tree_exiting", this, "_drag_slave_exit", varray(), CONNECT_ONESHOT);
+ if (drag_node) {
+ drag_node->connect("gui_input", this, "_drag_node_input");
+ drag_node->connect("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT);
}
}
if (p_what == NOTIFICATION_EXIT_TREE) {
- if (drag_slave) {
- drag_slave->disconnect("gui_input", this, "_drag_slave_input");
- drag_slave->disconnect("tree_exiting", this, "_drag_slave_exit");
+ if (drag_node) {
+ drag_node->disconnect("gui_input", this, "_drag_node_input");
+ drag_node->disconnect("tree_exiting", this, "_drag_node_exit");
}
- drag_slave = NULL;
+ drag_node = NULL;
}
if (p_what == NOTIFICATION_INTERNAL_PHYSICS_PROCESS) {
@@ -337,12 +337,13 @@ void ScrollBar::_notification(int p_what) {
scrolling = false;
set_physics_process_internal(false);
}
- } else if (drag_slave_touching) {
- if (drag_slave_touching_deaccel) {
+ } else if (drag_node_touching) {
+
+ if (drag_node_touching_deaccel) {
Vector2 pos = Vector2(orientation == HORIZONTAL ? get_value() : 0, orientation == VERTICAL ? get_value() : 0);
- pos += drag_slave_speed * get_physics_process_delta_time();
+ pos += drag_node_speed * get_physics_process_delta_time();
bool turnoff = false;
@@ -360,15 +361,15 @@ void ScrollBar::_notification(int p_what) {
set_value(pos.x);
- float sgn_x = drag_slave_speed.x < 0 ? -1 : 1;
- float val_x = Math::abs(drag_slave_speed.x);
+ float sgn_x = drag_node_speed.x < 0 ? -1 : 1;
+ float val_x = Math::abs(drag_node_speed.x);
val_x -= 1000 * get_physics_process_delta_time();
if (val_x < 0) {
turnoff = true;
}
- drag_slave_speed.x = sgn_x * val_x;
+ drag_node_speed.x = sgn_x * val_x;
} else {
@@ -384,29 +385,29 @@ void ScrollBar::_notification(int p_what) {
set_value(pos.y);
- float sgn_y = drag_slave_speed.y < 0 ? -1 : 1;
- float val_y = Math::abs(drag_slave_speed.y);
+ float sgn_y = drag_node_speed.y < 0 ? -1 : 1;
+ float val_y = Math::abs(drag_node_speed.y);
val_y -= 1000 * get_physics_process_delta_time();
if (val_y < 0) {
turnoff = true;
}
- drag_slave_speed.y = sgn_y * val_y;
+ drag_node_speed.y = sgn_y * val_y;
}
if (turnoff) {
set_physics_process_internal(false);
- drag_slave_touching = false;
- drag_slave_touching_deaccel = false;
+ drag_node_touching = false;
+ drag_node_touching_deaccel = false;
}
} else {
if (time_since_motion == 0 || time_since_motion > 0.1) {
- Vector2 diff = drag_slave_accum - last_drag_slave_accum;
- last_drag_slave_accum = drag_slave_accum;
- drag_slave_speed = diff / get_physics_process_delta_time();
+ Vector2 diff = drag_node_accum - last_drag_node_accum;
+ last_drag_node_accum = drag_node_accum;
+ drag_node_speed = diff / get_physics_process_delta_time();
}
time_since_motion += get_physics_process_delta_time();
@@ -544,15 +545,15 @@ float ScrollBar::get_custom_step() const {
return custom_step;
}
-void ScrollBar::_drag_slave_exit() {
+void ScrollBar::_drag_node_exit() {
- if (drag_slave) {
- drag_slave->disconnect("gui_input", this, "_drag_slave_input");
+ if (drag_node) {
+ drag_node->disconnect("gui_input", this, "_drag_node_input");
}
- drag_slave = NULL;
+ drag_node = NULL;
}
-void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
+void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) {
Ref<InputEventMouseButton> mb = p_input;
@@ -563,43 +564,30 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
if (mb->is_pressed()) {
- if (drag_slave_touching) {
- set_physics_process_internal(false);
- drag_slave_touching_deaccel = false;
- drag_slave_touching = false;
- drag_slave_speed = Vector2();
- drag_slave_accum = Vector2();
- last_drag_slave_accum = Vector2();
- drag_slave_from = Vector2();
- }
+ drag_node_speed = Vector2();
+ drag_node_accum = Vector2();
+ last_drag_node_accum = Vector2();
+ drag_node_from = Vector2(orientation == HORIZONTAL ? get_value() : 0, orientation == VERTICAL ? get_value() : 0);
- if (true) {
- drag_slave_speed = Vector2();
- drag_slave_accum = Vector2();
- last_drag_slave_accum = Vector2();
- //drag_slave_from=Vector2(h_scroll->get_val(),v_scroll->get_val());
- drag_slave_from = Vector2(orientation == HORIZONTAL ? get_value() : 0, orientation == VERTICAL ? get_value() : 0);
+ drag_node_touching = OS::get_singleton()->has_touchscreen_ui_hint();
+ drag_node_touching_deaccel = false;
+ time_since_motion = 0;
- drag_slave_touching = OS::get_singleton()->has_touchscreen_ui_hint();
- drag_slave_touching_deaccel = false;
+ if (drag_node_touching) {
+ set_physics_process_internal(true);
time_since_motion = 0;
- if (drag_slave_touching) {
- set_physics_process_internal(true);
- time_since_motion = 0;
- }
}
} else {
- if (drag_slave_touching) {
+ if (drag_node_touching) {
- if (drag_slave_speed == Vector2()) {
- drag_slave_touching_deaccel = false;
- drag_slave_touching = false;
+ if (drag_node_speed == Vector2()) {
+ drag_node_touching_deaccel = false;
+ drag_node_touching = false;
set_physics_process_internal(false);
} else {
-
- drag_slave_touching_deaccel = true;
+ drag_node_touching_deaccel = true;
}
}
}
@@ -609,60 +597,54 @@ void ScrollBar::_drag_slave_input(const Ref<InputEvent> &p_input) {
if (mm.is_valid()) {
- if (drag_slave_touching && !drag_slave_touching_deaccel) {
+ if (drag_node_touching && !drag_node_touching_deaccel) {
Vector2 motion = Vector2(mm->get_relative().x, mm->get_relative().y);
- drag_slave_accum -= motion;
- Vector2 diff = drag_slave_from + drag_slave_accum;
+ drag_node_accum -= motion;
+ Vector2 diff = drag_node_from + drag_node_accum;
if (orientation == HORIZONTAL)
set_value(diff.x);
- /*
- else
- drag_slave_accum.x=0;
- */
+
if (orientation == VERTICAL)
set_value(diff.y);
- /*
- else
- drag_slave_accum.y=0;
- */
+
time_since_motion = 0;
}
}
}
-void ScrollBar::set_drag_slave(const NodePath &p_path) {
+void ScrollBar::set_drag_node(const NodePath &p_path) {
if (is_inside_tree()) {
- if (drag_slave) {
- drag_slave->disconnect("gui_input", this, "_drag_slave_input");
- drag_slave->disconnect("tree_exiting", this, "_drag_slave_exit");
+ if (drag_node) {
+ drag_node->disconnect("gui_input", this, "_drag_node_input");
+ drag_node->disconnect("tree_exiting", this, "_drag_node_exit");
}
}
- drag_slave = NULL;
- drag_slave_path = p_path;
+ drag_node = NULL;
+ drag_node_path = p_path;
if (is_inside_tree()) {
if (has_node(p_path)) {
Node *n = get_node(p_path);
- drag_slave = Object::cast_to<Control>(n);
+ drag_node = Object::cast_to<Control>(n);
}
- if (drag_slave) {
- drag_slave->connect("gui_input", this, "_drag_slave_input");
- drag_slave->connect("tree_exiting", this, "_drag_slave_exit", varray(), CONNECT_ONESHOT);
+ if (drag_node) {
+ drag_node->connect("gui_input", this, "_drag_node_input");
+ drag_node->connect("tree_exiting", this, "_drag_node_exit", varray(), CONNECT_ONESHOT);
}
}
}
-NodePath ScrollBar::get_drag_slave() const {
+NodePath ScrollBar::get_drag_node() const {
- return drag_slave_path;
+ return drag_node_path;
}
void ScrollBar::set_smooth_scroll_enabled(bool p_enable) {
@@ -678,8 +660,8 @@ void ScrollBar::_bind_methods() {
ClassDB::bind_method(D_METHOD("_gui_input"), &ScrollBar::_gui_input);
ClassDB::bind_method(D_METHOD("set_custom_step", "step"), &ScrollBar::set_custom_step);
ClassDB::bind_method(D_METHOD("get_custom_step"), &ScrollBar::get_custom_step);
- ClassDB::bind_method(D_METHOD("_drag_slave_input"), &ScrollBar::_drag_slave_input);
- ClassDB::bind_method(D_METHOD("_drag_slave_exit"), &ScrollBar::_drag_slave_exit);
+ ClassDB::bind_method(D_METHOD("_drag_node_input"), &ScrollBar::_drag_node_input);
+ ClassDB::bind_method(D_METHOD("_drag_node_exit"), &ScrollBar::_drag_node_exit);
ADD_SIGNAL(MethodInfo("scrolling"));
@@ -691,13 +673,13 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
orientation = p_orientation;
highlight = HIGHLIGHT_NONE;
custom_step = -1;
- drag_slave = NULL;
+ drag_node = NULL;
drag.active = false;
- drag_slave_speed = Vector2();
- drag_slave_touching = false;
- drag_slave_touching_deaccel = false;
+ drag_node_speed = Vector2();
+ drag_node_touching = false;
+ drag_node_touching_deaccel = false;
scrolling = false;
target_scroll = 0;
diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h
index 15e037f8bb..cde4120cdb 100644
--- a/scene/gui/scroll_bar.h
+++ b/scene/gui/scroll_bar.h
@@ -36,6 +36,7 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
+
class ScrollBar : public Range {
GDCLASS(ScrollBar, Range);
@@ -71,25 +72,25 @@ class ScrollBar : public Range {
static void set_can_focus_by_default(bool p_can_focus);
- Node *drag_slave;
- NodePath drag_slave_path;
+ Node *drag_node;
+ NodePath drag_node_path;
- Vector2 drag_slave_speed;
- Vector2 drag_slave_accum;
- Vector2 drag_slave_from;
- Vector2 last_drag_slave_accum;
- float last_drag_slave_time;
+ Vector2 drag_node_speed;
+ Vector2 drag_node_accum;
+ Vector2 drag_node_from;
+ Vector2 last_drag_node_accum;
+ float last_drag_node_time;
float time_since_motion;
- bool drag_slave_touching;
- bool drag_slave_touching_deaccel;
+ bool drag_node_touching;
+ bool drag_node_touching_deaccel;
bool click_handled;
bool scrolling;
double target_scroll;
bool smooth_scroll_enabled;
- void _drag_slave_exit();
- void _drag_slave_input(const Ref<InputEvent> &p_input);
+ void _drag_node_exit();
+ void _drag_node_input(const Ref<InputEvent> &p_input);
void _gui_input(Ref<InputEvent> p_event);
@@ -102,8 +103,8 @@ public:
void set_custom_step(float p_custom_step);
float get_custom_step() const;
- void set_drag_slave(const NodePath &p_path);
- NodePath get_drag_slave() const;
+ void set_drag_node(const NodePath &p_path);
+ NodePath get_drag_node() const;
void set_smooth_scroll_enabled(bool p_enable);
bool is_smooth_scroll_enabled() const;
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index f56cc897ca..a9566d9387 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1942,7 +1942,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
int to_column = get_selection_to_column();
if (row < from_line || row > to_line || (row == from_line && col < from_column) || (row == to_line && col > to_column)) {
- // Right click is outside the seleted text
+ // Right click is outside the selected text
deselect();
}
}
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index be1870068d..24b9083964 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1721,7 +1721,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
if (p_button == BUTTON_LEFT || (p_button == BUTTON_RIGHT && allow_rmb_select)) {
/* process selection */
- if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it' s confusing for check
+ if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check
emit_signal("item_activated");
incr_search.clear();
@@ -2239,13 +2239,13 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
_go_left();
}
- } else if (p_event->is_action("ui_up") && p_event->is_pressed()) {
+ } else if (p_event->is_action("ui_up") && p_event->is_pressed() && !k->get_command()) {
if (!cursor_can_exit_tree) accept_event();
_go_up();
- } else if (p_event->is_action("ui_down") && p_event->is_pressed()) {
+ } else if (p_event->is_action("ui_down") && p_event->is_pressed() && !k->get_command()) {
if (!cursor_can_exit_tree) accept_event();
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp
index 4750e05633..a9b7fba9c7 100644
--- a/scene/main/http_request.cpp
+++ b/scene/main/http_request.cpp
@@ -330,15 +330,13 @@ bool HTTPRequest::_update_connection() {
return true;
}
- if (client->is_response_chunked()) {
- body_len = -1; // No body len because chunked, change your webserver configuration if you want body len
- } else {
- body_len = client->get_response_body_length();
+ // No body len (-1) if chunked or no content-length header was provided.
+ // Change your webserver configuration if you want body len.
+ body_len = client->get_response_body_length();
- if (body_size_limit >= 0 && body_len > body_size_limit) {
- call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray());
- return true;
- }
+ if (body_size_limit >= 0 && body_len > body_size_limit) {
+ call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray());
+ return true;
}
if (download_to_file != String()) {
@@ -378,6 +376,9 @@ bool HTTPRequest::_update_connection() {
call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
return true;
}
+ } else if (client->get_status() == HTTPClient::STATUS_DISCONNECTED) {
+ // We read till EOF, with no errors. Request is done.
+ call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body);
}
return false;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index d4456738ae..06bc12d774 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2116,6 +2116,12 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
node->set(name, value);
}
+ List<GroupInfo> groups;
+ get_groups(&groups);
+
+ for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next())
+ node->add_to_group(E->get().name, E->get().persistent);
+
node->set_name(get_name());
p_new_parent->add_child(node);
@@ -2210,6 +2216,12 @@ Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const {
node->set(name, get(name));
}
+ List<GroupInfo> groups;
+ get_groups(&groups);
+
+ for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next())
+ node->add_to_group(E->get().name, E->get().persistent);
+
for (int i = 0; i < get_child_count(); i++) {
get_child(i)->_duplicate_and_reown(node, p_reown_map);
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index dfd9dfa52e..487ca2b009 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2789,6 +2789,8 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("gui_get_drag_data"), &Viewport::gui_get_drag_data);
ClassDB::bind_method(D_METHOD("gui_is_dragging"), &Viewport::gui_is_dragging);
+ ClassDB::bind_method(D_METHOD("get_modal_stack_top"), &Viewport::get_modal_stack_top);
+
ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input);
ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled);
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 694e959bcb..80ad2ad739 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1442,7 +1442,7 @@ void Animation::track_set_key_transition(int p_track, int p_key_idx, float p_tra
case TYPE_BEZIER:
case TYPE_AUDIO:
case TYPE_ANIMATION: {
- // they dont use transition
+ // they don't use transition
} break;
}
}
diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp
index 50bf8f38f7..b78b3a6ffb 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -178,6 +178,7 @@ PoolVector<int> BitmapFont::_get_kernings() const {
void BitmapFont::_set_textures(const Vector<Variant> &p_textures) {
+ textures.clear();
for (int i = 0; i < p_textures.size(); i++) {
Ref<Texture> tex = p_textures[i];
ERR_CONTINUE(!tex.is_valid());
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 4727526b68..2cf802a2da 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -145,6 +145,31 @@ void ShaderMaterial::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
+bool ShaderMaterial::property_can_revert(const String &p_name) {
+ if (shader.is_valid()) {
+
+ StringName pr = shader->remap_param(p_name);
+ if (pr) {
+ Variant default_value = VisualServer::get_singleton()->material_get_param_default(_get_material(), pr);
+ Variant current_value;
+ _get(p_name, current_value);
+ return default_value.get_type() != Variant::NIL && default_value != current_value;
+ }
+ }
+ return false;
+}
+
+Variant ShaderMaterial::property_get_revert(const String &p_name) {
+ Variant r_ret;
+ if (shader.is_valid()) {
+ StringName pr = shader->remap_param(p_name);
+ if (pr) {
+ r_ret = VisualServer::get_singleton()->material_get_param_default(_get_material(), pr);
+ }
+ }
+ return r_ret;
+}
+
void ShaderMaterial::set_shader(const Ref<Shader> &p_shader) {
if (shader.is_valid()) {
@@ -190,6 +215,8 @@ void ShaderMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shader_param", "param", "value"), &ShaderMaterial::set_shader_param);
ClassDB::bind_method(D_METHOD("get_shader_param", "param"), &ShaderMaterial::get_shader_param);
ClassDB::bind_method(D_METHOD("_shader_changed"), &ShaderMaterial::_shader_changed);
+ ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &ShaderMaterial::property_can_revert);
+ ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &ShaderMaterial::property_get_revert);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shader", PROPERTY_HINT_RESOURCE_TYPE, "Shader"), "set_shader", "get_shader");
}
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 078649e7b0..4a2a813341 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -85,6 +85,8 @@ 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;
+ bool property_can_revert(const String &p_name);
+ Variant property_get_revert(const String &p_name);
static void _bind_methods();
diff --git a/scene/resources/scene_format_text.cpp b/scene/resources/scene_format_text.cpp
index 02d2cf31f3..597ffe49ae 100644
--- a/scene/resources/scene_format_text.cpp
+++ b/scene/resources/scene_format_text.cpp
@@ -294,25 +294,25 @@ Ref<PackedScene> ResourceInteractiveLoaderText::_parse_node_tag(VariantParser::R
if (!next_tag.fields.has("from")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'from' field fron connection tag";
+ error_text = "missing 'from' field from connection tag";
return Ref<PackedScene>();
}
if (!next_tag.fields.has("to")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'to' field fron connection tag";
+ error_text = "missing 'to' field from connection tag";
return Ref<PackedScene>();
}
if (!next_tag.fields.has("signal")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'signal' field fron connection tag";
+ error_text = "missing 'signal' field from connection tag";
return Ref<PackedScene>();
}
if (!next_tag.fields.has("method")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'method' field fron connection tag";
+ error_text = "missing 'method' field from connection tag";
return Ref<PackedScene>();
}
@@ -358,7 +358,7 @@ Ref<PackedScene> ResourceInteractiveLoaderText::_parse_node_tag(VariantParser::R
if (!next_tag.fields.has("path")) {
error = ERR_FILE_CORRUPT;
- error_text = "missing 'path' field fron connection tag";
+ error_text = "missing 'path' field from connection tag";
_printerr();
return Ref<PackedScene>();
}
diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp
index 1bfc41bd92..66bf3b4991 100644
--- a/scene/resources/shader.cpp
+++ b/scene/resources/shader.cpp
@@ -126,6 +126,11 @@ void Shader::get_default_texture_param_list(List<StringName> *r_textures) const
r_textures->push_back(E->key());
}
}
+
+bool Shader::is_text_shader() const {
+ return true;
+}
+
bool Shader::has_param(const StringName &p_param) const {
return params_cache.has(p_param);
@@ -235,8 +240,10 @@ Error ResourceFormatSaverShader::save(const String &p_path, const RES &p_resourc
void ResourceFormatSaverShader::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
- if (Object::cast_to<Shader>(*p_resource)) {
- p_extensions->push_back("shader");
+ if (const Shader *shader = Object::cast_to<Shader>(*p_resource)) {
+ if (shader->is_text_shader()) {
+ p_extensions->push_back("shader");
+ }
}
}
bool ResourceFormatSaverShader::recognize(const RES &p_resource) const {
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index 6c91205c0c..c2c205237f 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -79,6 +79,8 @@ public:
Ref<Texture> get_default_texture_param(const StringName &p_param) const;
void get_default_texture_param_list(List<StringName> *r_textures) const;
+ virtual bool is_text_shader() const;
+
_FORCE_INLINE_ StringName remap_param(const StringName &p_param) const {
if (params_cache_dirty)
get_param_list(NULL);
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 9875c7b130..16b4ed31df 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -30,11 +30,11 @@
#include "texture.h"
-#include "bit_mask.h"
#include "core/core_string_names.h"
#include "core/io/image_loader.h"
#include "core/method_bind_ext.gen.inc"
#include "core/os/os.h"
+#include "scene/resources/bit_mask.h"
Size2 Texture::get_size() const {
@@ -1633,16 +1633,17 @@ void GradientTexture::_queue_update() {
if (update_pending)
return;
+ update_pending = true;
call_deferred("_update");
}
void GradientTexture::_update() {
+ update_pending = false;
+
if (gradient.is_null())
return;
- update_pending = false;
-
PoolVector<uint8_t> data;
data.resize(width * 4);
{
@@ -1945,8 +1946,8 @@ void AnimatedTexture::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "fps", PROPERTY_HINT_RANGE, "0,1024,0.1"), "set_fps", "get_fps");
for (int i = 0; i < MAX_FRAMES; i++) {
- ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "frame_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_frame_texture", "get_frame_texture", i);
- ADD_PROPERTYI(PropertyInfo(Variant::REAL, "frame_" + itos(i) + "/delay_sec", PROPERTY_HINT_RANGE, "0.0,16.0,0.01"), "set_frame_delay", "get_frame_delay", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "frame_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_frame_texture", "get_frame_texture", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::REAL, "frame_" + itos(i) + "/delay_sec", PROPERTY_HINT_RANGE, "0.0,16.0,0.01", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_frame_delay", "get_frame_delay", i);
}
}
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 4865f7b507..cb759c63da 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -37,9 +37,10 @@
#include "core/os/rw_lock.h"
#include "core/os/thread_safe.h"
#include "core/resource.h"
-#include "curve.h"
#include "scene/resources/color_ramp.h"
+#include "scene/resources/curve.h"
#include "servers/visual_server.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 6bfb6ec5bf..f12ea8f2bb 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -414,6 +414,10 @@ Shader::Mode VisualShader::get_mode() const {
return shader_mode;
}
+bool VisualShader::is_text_shader() const {
+ return false;
+}
+
String VisualShader::generate_preview_shader(Type p_type, int p_node, int p_port, Vector<DefaultTextureParam> &default_tex_params) const {
Ref<VisualShaderNode> node = get_node(p_type, p_node);
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 70d2425304..2867daac3a 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -141,6 +141,8 @@ public:
void set_mode(Mode p_mode);
virtual Mode get_mode() const;
+ virtual bool is_text_shader() const;
+
void set_graph_offset(const Vector2 &p_offset);
Vector2 get_graph_offset() const;
diff --git a/servers/arvr_server.h b/servers/arvr_server.h
index 25318aff4b..a28b91c225 100644
--- a/servers/arvr_server.h
+++ b/servers/arvr_server.h
@@ -87,7 +87,7 @@ private:
uint64_t last_process_usec; /* for frame timing, usec when we did our processing */
uint64_t last_commit_usec; /* for frame timing, usec when we finished committing both eyes */
- uint64_t last_frame_usec; /* time it took between process and commiting, we should probably average this over the last x frames */
+ uint64_t last_frame_usec; /* time it took between process and committing, we should probably average this over the last x frames */
protected:
static ARVRServer *singleton;
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 45d66cd8f2..7de0695e8c 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -137,7 +137,7 @@ void AudioStreamPlaybackMicrophone::_mix_internal(AudioFrame *p_buffer, int p_fr
Vector<int32_t> buf = AudioDriver::get_singleton()->get_input_buffer();
unsigned int input_size = AudioDriver::get_singleton()->get_input_size();
- // p_frames is multipled by two since an AudioFrame is stereo
+ // p_frames is multiplied by two since an AudioFrame is stereo
if ((p_frames + MICROPHONE_PLAYBACK_DELAY * 2) > input_size) {
for (int i = 0; i < p_frames; i++) {
p_buffer[i] = AudioFrame(0.0f, 0.0f);
diff --git a/servers/physics/space_sw.cpp b/servers/physics/space_sw.cpp
index 925fa47eac..731749b8ce 100644
--- a/servers/physics/space_sw.cpp
+++ b/servers/physics/space_sw.cpp
@@ -105,7 +105,7 @@ bool PhysicsDirectSpaceStateSW::intersect_ray(const Vector3 &p_from, const Vecto
int amount = space->broadphase->cull_segment(begin, end, space->intersection_query_results, SpaceSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
- //todo, create another array tha references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
+ //todo, create another array that references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
bool collided = false;
Vector3 res_point, res_normal;
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index be44eabdf0..f36328c985 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -112,7 +112,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2 &p_from, const Vec
int amount = space->broadphase->cull_segment(begin, end, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
- //todo, create another array tha references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
+ //todo, create another array that references results, compute AABBs and check closest point to ray origin, sort, and stop evaluating results when beyond first collision
bool collided = false;
Vector2 res_point, res_normal;
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index c26f02f087..6eeaf12dfc 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -249,6 +249,7 @@ public:
virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
+ virtual Variant material_get_param_default(RID p_material, const StringName &p_param) const = 0;
virtual void material_set_line_width(RID p_material, float p_width) = 0;
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index 8a8b8af267..4718eb14a5 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2273,6 +2273,90 @@ bool ShaderLanguage::is_sampler_type(DataType p_type) {
p_type == TYPE_SAMPLERCUBE;
}
+Variant ShaderLanguage::constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type) {
+ if (p_value.size() > 0) {
+ Variant value;
+ switch (p_type) {
+ case ShaderLanguage::TYPE_BOOL:
+ value = Variant(p_value[0].boolean);
+ break;
+ case ShaderLanguage::TYPE_BVEC2:
+ case ShaderLanguage::TYPE_BVEC3:
+ case ShaderLanguage::TYPE_BVEC4:
+ case ShaderLanguage::TYPE_INT:
+ value = Variant(p_value[0].sint);
+ break;
+ case ShaderLanguage::TYPE_IVEC2:
+ value = Variant(Vector2(p_value[0].sint, p_value[1].sint));
+ break;
+ case ShaderLanguage::TYPE_IVEC3:
+ value = Variant(Vector3(p_value[0].sint, p_value[1].sint, p_value[2].sint));
+ break;
+ case ShaderLanguage::TYPE_IVEC4:
+ value = Variant(Plane(p_value[0].sint, p_value[1].sint, p_value[2].sint, p_value[3].sint));
+ break;
+ case ShaderLanguage::TYPE_UINT:
+ value = Variant(p_value[0].uint);
+ break;
+ case ShaderLanguage::TYPE_UVEC2:
+ value = Variant(Vector2(p_value[0].uint, p_value[1].uint));
+ break;
+ case ShaderLanguage::TYPE_UVEC3:
+ value = Variant(Vector3(p_value[0].uint, p_value[1].uint, p_value[2].uint));
+ break;
+ case ShaderLanguage::TYPE_UVEC4:
+ value = Variant(Plane(p_value[0].uint, p_value[1].uint, p_value[2].uint, p_value[3].uint));
+ break;
+ case ShaderLanguage::TYPE_FLOAT:
+ value = Variant(p_value[0].real);
+ break;
+ case ShaderLanguage::TYPE_VEC2:
+ value = Variant(Vector2(p_value[0].real, p_value[1].real));
+ break;
+ case ShaderLanguage::TYPE_VEC3:
+ value = Variant(Vector3(p_value[0].real, p_value[1].real, p_value[2].real));
+ break;
+ case ShaderLanguage::TYPE_VEC4:
+ value = Variant(Plane(p_value[0].real, p_value[1].real, p_value[2].real, p_value[3].real));
+ break;
+ case ShaderLanguage::TYPE_MAT2:
+ value = Variant(Transform2D(p_value[0].real, p_value[2].real, p_value[1].real, p_value[3].real, 0.0, 0.0));
+ break;
+ case ShaderLanguage::TYPE_MAT3: {
+ Basis p;
+ p[0][0] = p_value[0].real;
+ p[0][1] = p_value[1].real;
+ p[0][2] = p_value[2].real;
+ p[1][0] = p_value[3].real;
+ p[1][1] = p_value[4].real;
+ p[1][2] = p_value[5].real;
+ p[2][0] = p_value[6].real;
+ p[2][1] = p_value[7].real;
+ p[2][2] = p_value[8].real;
+ value = Variant(p);
+ break;
+ }
+ case ShaderLanguage::TYPE_MAT4: {
+ Basis p;
+ p[0][0] = p_value[0].real;
+ p[0][1] = p_value[1].real;
+ p[0][2] = p_value[2].real;
+ p[1][0] = p_value[4].real;
+ p[1][1] = p_value[5].real;
+ p[1][2] = p_value[6].real;
+ p[2][0] = p_value[8].real;
+ p[2][1] = p_value[9].real;
+ p[2][2] = p_value[10].real;
+ Transform t = Transform(p, Vector3(p_value[3].real, p_value[7].real, p_value[11].real));
+ value = Variant(t);
+ break;
+ }
+ }
+ return value;
+ }
+ return Variant();
+}
+
void ShaderLanguage::get_keyword_list(List<String> *r_keywords) {
Set<String> kws;
@@ -3353,8 +3437,9 @@ ShaderLanguage::Node *ShaderLanguage::_reduce_expression(BlockNode *p_block, Sha
}
}
} else {
+ ConstantNode::Value value = values[0];
for (int i = 1; i < cardinality; i++) {
- values.push_back(values[0]);
+ values.push_back(value);
}
}
} else if (values.size() != cardinality) {
diff --git a/servers/visual/shader_language.h b/servers/visual/shader_language.h
index e8ae099302..08c4d06992 100644
--- a/servers/visual/shader_language.h
+++ b/servers/visual/shader_language.h
@@ -548,6 +548,7 @@ public:
static int get_cardinality(DataType p_type);
static bool is_scalar_type(DataType p_type);
static bool is_sampler_type(DataType p_type);
+ static Variant constant_value_to_variant(const Vector<ShaderLanguage::ConstantNode::Value> &p_value, DataType p_type);
static void get_keyword_list(List<String> *r_keywords);
static void get_builtin_funcs(List<String> *r_keywords);
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index f25973c4e2..b54e150656 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -203,6 +203,7 @@ public:
BIND3(material_set_param, RID, const StringName &, const Variant &)
BIND2RC(Variant, material_get_param, RID, const StringName &)
+ BIND2RC(Variant, material_get_param_default, RID, const StringName &)
BIND2(material_set_render_priority, RID, int)
BIND2(material_set_line_width, RID, float)
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index 39ab8307f4..b286533590 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -294,7 +294,7 @@ void VisualServerViewport::draw_viewports() {
arvr_interface->commit_for_eye(ARVRInterface::EYE_RIGHT, vp->render_target, vp->viewport_to_screen_rect);
}
- // and for our frame timing, mark when we've finished commiting our eyes
+ // and for our frame timing, mark when we've finished committing our eyes
ARVRServer::get_singleton()->_mark_commit();
} else {
VSG::rasterizer->set_current_render_target(vp->render_target);
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 85205e5132..b8f86d7123 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -137,6 +137,7 @@ public:
FUNC3(material_set_param, RID, const StringName &, const Variant &)
FUNC2RC(Variant, material_get_param, RID, const StringName &)
+ FUNC2RC(Variant, material_get_param_default, RID, const StringName &)
FUNC2(material_set_render_priority, RID, int)
FUNC2(material_set_line_width, RID, float)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index d4e96bb173..7240266133 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1695,6 +1695,7 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("material_get_shader", "shader_material"), &VisualServer::material_get_shader);
ClassDB::bind_method(D_METHOD("material_set_param", "material", "parameter", "value"), &VisualServer::material_set_param);
ClassDB::bind_method(D_METHOD("material_get_param", "material", "parameter"), &VisualServer::material_get_param);
+ ClassDB::bind_method(D_METHOD("material_get_param_default", "material", "parameter"), &VisualServer::material_get_param_default);
ClassDB::bind_method(D_METHOD("material_set_render_priority", "material", "priority"), &VisualServer::material_set_render_priority);
ClassDB::bind_method(D_METHOD("material_set_line_width", "material", "width"), &VisualServer::material_set_line_width);
ClassDB::bind_method(D_METHOD("material_set_next_pass", "material", "next_material"), &VisualServer::material_set_next_pass);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 7c21d138e0..6a1f2c3550 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -209,6 +209,7 @@ public:
virtual void material_set_param(RID p_material, const StringName &p_param, const Variant &p_value) = 0;
virtual Variant material_get_param(RID p_material, const StringName &p_param) const = 0;
+ virtual Variant material_get_param_default(RID p_material, const StringName &p_param) const = 0;
virtual void material_set_render_priority(RID p_material, int priority) = 0;
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 82b7748194..71053de016 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -266,6 +266,8 @@ File extracted from upstream source:
- Also copy `win32helpers/` from `win32port/` inside `thirdparty/libwebsockets`
- A small fix has been added in `libwebsockets/libwebsockets.h` to `#include <sys/socket.h>` for the BSD family.
This change has been PRed upstream, and should be merged before the next update. Remember to check and remove this line.
+- Another fix has been added to allow building for 32-bits UWP, replacing `GetFileSize[Ex]` and `CreateFileW` with supported functions.
+ There is a diff for this change in `thirdparty/libwebsockets/uwp_fixes.diff`
Important: `lws_config.h` and `lws_config_private.h` contains custom
Godot build configurations, check them out when updating.
@@ -354,6 +356,11 @@ Collection of single-file libraries used in Godot components.
* Upstream: https://github.com/ivanfratric/polypartition (`src/polypartition.cpp`)
* Version: TBD, class was renamed
* License: MIT
+- `open-simplex-noise.{c,h}`
+ * Upstream: https://github.com/smcameron/open-simplex-noise-in-c
+ * Version: git (0d555e7, 2015)
+ * License: Unlicense
+
### modules
@@ -523,3 +530,5 @@ Files extracted from upstream source:
- lib/{common/,compress/,decompress/,zstd.h}
- LICENSE
+
+- Applied the patch in `thirdparty/zstd/1314.diff` (PR 1314 upstream, already merged). Needed to build on UWP ARM. Can be removed when a new version is released with the patch.
diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
index 948db62896..8a43081ef1 100644
--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
+++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
@@ -635,9 +635,20 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
HANDLE ret;
WCHAR buf[MAX_PATH];
lws_fop_fd_t fop_fd;
- LARGE_INTEGER llFileSize = {0};
+ FILE_STANDARD_INFO fInfo = {0};
MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
+
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 // Windows 8 (minimum when UWP_ENABLED, but can be used in Windows builds)
+ CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
+ extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
+
+ if (((*flags) & 7) == _O_RDONLY) {
+ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams);
+ } else {
+ ret = CreateFile2(buf, GENERIC_WRITE, 0, CREATE_ALWAYS, &extParams);
+ }
+#else
if (((*flags) & 7) == _O_RDONLY) {
ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -645,6 +656,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
}
+#endif
if (ret == LWS_INVALID_FILE)
goto bail;
@@ -657,9 +669,9 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
fop_fd->fd = ret;
fop_fd->filesystem_priv = NULL; /* we don't use it */
fop_fd->flags = *flags;
- fop_fd->len = GetFileSize(ret, NULL);
- if(GetFileSizeEx(ret, &llFileSize))
- fop_fd->len = llFileSize.QuadPart;
+ fop_fd->len = 0;
+ if(GetFileInformationByHandleEx(ret, FileStandardInfo, &fInfo, sizeof(fInfo)))
+ fop_fd->len = fInfo.EndOfFile.QuadPart;
fop_fd->pos = 0;
diff --git a/thirdparty/libwebsockets/uwp_fixes.diff b/thirdparty/libwebsockets/uwp_fixes.diff
new file mode 100644
index 0000000000..5b9d8724ed
--- /dev/null
+++ b/thirdparty/libwebsockets/uwp_fixes.diff
@@ -0,0 +1,47 @@
+diff --git a/thirdparty/libwebsockets/plat/lws-plat-win.c b/thirdparty/libwebsockets/plat/lws-plat-win.c
+index 948db6289..511e29739 100644
+--- a/thirdparty/libwebsockets/plat/lws-plat-win.c
++++ b/thirdparty/libwebsockets/plat/lws-plat-win.c
+@@ -635,9 +635,20 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ HANDLE ret;
+ WCHAR buf[MAX_PATH];
+ lws_fop_fd_t fop_fd;
+- LARGE_INTEGER llFileSize = {0};
++ FILE_STANDARD_INFO fInfo = {0};
+
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
++
++#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0602 // Windows 8 (minimum when UWP_ENABLED, but can be used in Windows builds)
++ CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
++ extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
++
++ if (((*flags) & 7) == _O_RDONLY) {
++ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams);
++ } else {
++ ret = CreateFile2(buf, GENERIC_WRITE, 0, CREATE_ALWAYS, &extParams);
++ }
++#else
+ if (((*flags) & 7) == _O_RDONLY) {
+ ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+@@ -645,6 +656,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ ret = CreateFileW(buf, GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ }
++#endif
+
+ if (ret == LWS_INVALID_FILE)
+ goto bail;
+@@ -657,9 +669,9 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
+ fop_fd->fd = ret;
+ fop_fd->filesystem_priv = NULL; /* we don't use it */
+ fop_fd->flags = *flags;
+- fop_fd->len = GetFileSize(ret, NULL);
+- if(GetFileSizeEx(ret, &llFileSize))
+- fop_fd->len = llFileSize.QuadPart;
++ fop_fd->len = 0;
++ if(GetFileInformationByHandleEx(ret, FileStandardInfo, &fInfo, sizeof(fInfo)))
++ fop_fd->len = fInfo.EndOfFile.QuadPart;
+
+ fop_fd->pos = 0;
+
diff --git a/thirdparty/miniupnpc/minissdpc.c b/thirdparty/miniupnpc/minissdpc.c
index d76b242ad0..1d29b4ba5b 100644
--- a/thirdparty/miniupnpc/minissdpc.c
+++ b/thirdparty/miniupnpc/minissdpc.c
@@ -494,7 +494,6 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
struct addrinfo hints, *servinfo, *p;
#endif
#ifdef _WIN32
- MIB_IPFORWARDROW ip_forward;
unsigned long _ttl = (unsigned long)ttl;
#endif
int linklocal = 1;
@@ -538,61 +537,103 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
* SSDP multicast traffic */
/* Get IP associated with the index given in the ip_forward struct
* in order to give this ip to setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF) */
- if(!ipv6
- && (GetBestRoute(inet_addr("223.255.255.255"), 0, &ip_forward) == NO_ERROR)) {
- DWORD dwRetVal = 0;
- PMIB_IPADDRTABLE pIPAddrTable;
- DWORD dwSize = 0;
-#ifdef DEBUG
- IN_ADDR IPAddr;
-#endif
- int i;
-#ifdef DEBUG
- printf("ifIndex=%lu nextHop=%lx \n", ip_forward.dwForwardIfIndex, ip_forward.dwForwardNextHop);
-#endif
- pIPAddrTable = (MIB_IPADDRTABLE *) malloc(sizeof (MIB_IPADDRTABLE));
- if(pIPAddrTable) {
- if (GetIpAddrTable(pIPAddrTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) {
- free(pIPAddrTable);
- pIPAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize);
- }
- }
- if(pIPAddrTable) {
- dwRetVal = GetIpAddrTable( pIPAddrTable, &dwSize, 0 );
+ if(!ipv6) {
+ DWORD ifbestidx;
+ SOCKADDR_IN destAddr;
+ memset(&destAddr, 0, sizeof(destAddr));
+ destAddr.sin_family = AF_INET;
+ destAddr.sin_addr.s_addr = inet_addr("223.255.255.255");
+ destAddr.sin_port = 0;
+ if (GetBestInterfaceEx((struct sockaddr *)&destAddr, &ifbestidx) == NO_ERROR) {
+ DWORD dwSize = 0;
+ DWORD dwRetVal = 0;
+ unsigned int i = 0;
+ ULONG flags = GAA_FLAG_INCLUDE_PREFIX;
+ ULONG family = AF_INET;
+ LPVOID lpMsgBuf = NULL;
+ PIP_ADAPTER_ADDRESSES pAddresses = NULL;
+ ULONG outBufLen = 0;
+ ULONG Iterations = 0;
+ PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL;
+ PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL;
+ PIP_ADAPTER_ANYCAST_ADDRESS pAnycast = NULL;
+ PIP_ADAPTER_MULTICAST_ADDRESS pMulticast = NULL;
+ IP_ADAPTER_DNS_SERVER_ADDRESS *pDnServer = NULL;
+ IP_ADAPTER_PREFIX *pPrefix = NULL;
+
+ outBufLen = 15360;
+ do {
+ pAddresses = (IP_ADAPTER_ADDRESSES *) HeapAlloc(GetProcessHeap(), 0, outBufLen);
+ if (pAddresses == NULL) {
+ break;
+ }
+
+ dwRetVal = GetAdaptersAddresses(family, flags, NULL, pAddresses, &outBufLen);
+
+ if (dwRetVal == ERROR_BUFFER_OVERFLOW) {
+ HeapFree(GetProcessHeap(), 0, pAddresses);
+ pAddresses = NULL;
+ } else {
+ break;
+ }
+ Iterations++;
+ } while ((dwRetVal == ERROR_BUFFER_OVERFLOW) && (Iterations < 3));
+
if (dwRetVal == NO_ERROR) {
+ pCurrAddresses = pAddresses;
+ while (pCurrAddresses) {
#ifdef DEBUG
- printf("\tNum Entries: %ld\n", pIPAddrTable->dwNumEntries);
-#endif
- for (i=0; i < (int) pIPAddrTable->dwNumEntries; i++) {
-#ifdef DEBUG
- printf("\n\tInterface Index[%d]:\t%ld\n", i, pIPAddrTable->table[i].dwIndex);
- IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwAddr;
- printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
- IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwMask;
- printf("\tSubnet Mask[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
- IPAddr.S_un.S_addr = (u_long) pIPAddrTable->table[i].dwBCastAddr;
- printf("\tBroadCast[%d]: \t%s (%ld)\n", i, inet_ntoa(IPAddr), pIPAddrTable->table[i].dwBCastAddr);
- printf("\tReassembly size[%d]:\t%ld\n", i, pIPAddrTable->table[i].dwReasmSize);
- printf("\tType and State[%d]:", i);
+ printf("\tIfIndex (IPv4 interface): %u\n", pCurrAddresses->IfIndex);
+ printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName);
+ pUnicast = pCurrAddresses->FirstUnicastAddress;
+ if (pUnicast != NULL) {
+ for (i = 0; pUnicast != NULL; i++) {
+ IPAddr.S_un.S_addr = (u_long) pUnicast->Address;
+ printf("\tIP Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ pUnicast = pUnicast->Next;
+ }
+ printf("\tNumber of Unicast Addresses: %d\n", i);
+ }
+ pAnycast = pCurrAddresses->FirstAnycastAddress;
+ if (pAnycast) {
+ for (i = 0; pAnycast != NULL; i++) {
+ IPAddr.S_un.S_addr = (u_long) pAnyCast->Address;
+ printf("\tAnycast Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ pAnycast = pAnycast->Next;
+ }
+ printf("\tNumber of Anycast Addresses: %d\n", i);
+ }
+ pMulticast = pCurrAddresses->FirstMulticastAddress;
+ if (pMulticast) {
+ for (i = 0; pMulticast != NULL; i++) {
+ IPAddr.S_un.S_addr = (u_long) pMultiCast->Address;
+ printf("\tMulticast Address[%d]: \t%s\n", i, inet_ntoa(IPAddr) );
+ }
+ }
printf("\n");
#endif
- if (pIPAddrTable->table[i].dwIndex == ip_forward.dwForwardIfIndex) {
+ pUnicast = pCurrAddresses->FirstUnicastAddress;
+ if (pCurrAddresses->IfIndex == ifbestidx && pUnicast != NULL) {
+ SOCKADDR_IN *ipv4 = (SOCKADDR_IN *)(pUnicast->Address.lpSockaddr);
/* Set the address of this interface to be used */
struct in_addr mc_if;
memset(&mc_if, 0, sizeof(mc_if));
- mc_if.s_addr = pIPAddrTable->table[i].dwAddr;
+ mc_if.s_addr = ipv4->sin_addr.s_addr;
if(setsockopt(sudp, IPPROTO_IP, IP_MULTICAST_IF, (const char *)&mc_if, sizeof(mc_if)) < 0) {
PRINT_SOCKET_ERROR("setsockopt");
}
- ((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = pIPAddrTable->table[i].dwAddr;
+ ((struct sockaddr_in *)&sockudp_r)->sin_addr.s_addr = ipv4->sin_addr.s_addr;
#ifndef DEBUG
break;
#endif
}
+ pCurrAddresses = pCurrAddresses->Next;
}
}
- free(pIPAddrTable);
- pIPAddrTable = NULL;
+ if (pAddresses != NULL) {
+ HeapFree(GetProcessHeap(), 0, pAddresses);
+ pAddresses = NULL;
+ }
}
}
#endif /* _WIN32 */
diff --git a/thirdparty/misc/open-simplex-noise-LICENSE b/thirdparty/misc/open-simplex-noise-LICENSE
new file mode 100644
index 0000000000..a84c395662
--- /dev/null
+++ b/thirdparty/misc/open-simplex-noise-LICENSE
@@ -0,0 +1,25 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org>
+
diff --git a/thirdparty/misc/open-simplex-noise-no-allocate.patch b/thirdparty/misc/open-simplex-noise-no-allocate.patch
new file mode 100644
index 0000000000..fc3abe7d00
--- /dev/null
+++ b/thirdparty/misc/open-simplex-noise-no-allocate.patch
@@ -0,0 +1,133 @@
+diff -u orig/open-simplex-noise.c misc/open-simplex-noise.c
+--- orig/open-simplex-noise.c 2018-09-14 11:11:40.049810000 +0200
++++ misc/open-simplex-noise.c 2018-09-14 11:09:39.726457000 +0200
+@@ -13,6 +13,11 @@
+ * of any particular randomization library, so results
+ * will be the same when ported to other languages.
+ */
++
++// -- GODOT start --
++// Modified to work without allocating memory, also removed some unused function.
++// -- GODOT end --
++
+ #include <math.h>
+ #include <stdlib.h>
+ #include <stdint.h>
+@@ -34,11 +39,12 @@
+
+ #define DEFAULT_SEED (0LL)
+
+-struct osn_context {
++// -- GODOT start --
++/*struct osn_context {
+ int16_t *perm;
+ int16_t *permGradIndex3D;
+-};
+-
++};*/
++// -- GODOT end --
+ #define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
+
+ /*
+@@ -126,7 +132,9 @@
+ int xi = (int) x;
+ return x < xi ? xi - 1 : xi;
+ }
+-
++
++// -- GODOT start --
++/*
+ static int allocate_perm(struct osn_context *ctx, int nperm, int ngrad)
+ {
+ if (ctx->perm)
+@@ -154,18 +162,21 @@
+ memcpy(ctx->perm, p, sizeof(*ctx->perm) * nelements);
+
+ for (i = 0; i < 256; i++) {
+- /* Since 3D has 24 gradients, simple bitmask won't work, so precompute modulo array. */
++ // Since 3D has 24 gradients, simple bitmask won't work, so precompute modulo array.
+ ctx->permGradIndex3D[i] = (int16_t)((ctx->perm[i] % (ARRAYSIZE(gradients3D) / 3)) * 3);
+ }
+ return 0;
+ }
++*/
++// -- GODOT end --
+
+ /*
+ * Initializes using a permutation array generated from a 64-bit seed.
+ * Generates a proper permutation (i.e. doesn't merely perform N successive pair
+ * swaps on a base array). Uses a simple 64-bit LCG.
+ */
+-int open_simplex_noise(int64_t seed, struct osn_context **ctx)
++// -- GODOT start --
++int open_simplex_noise(int64_t seed, struct osn_context *ctx)
+ {
+ int rc;
+ int16_t source[256];
+@@ -174,20 +185,9 @@
+ int16_t *permGradIndex3D;
+ int r;
+
+- *ctx = (struct osn_context *) malloc(sizeof(**ctx));
+- if (!(*ctx))
+- return -ENOMEM;
+- (*ctx)->perm = NULL;
+- (*ctx)->permGradIndex3D = NULL;
+-
+- rc = allocate_perm(*ctx, 256, 256);
+- if (rc) {
+- free(*ctx);
+- return rc;
+- }
+-
+- perm = (*ctx)->perm;
+- permGradIndex3D = (*ctx)->permGradIndex3D;
++ perm = ctx->perm;
++ permGradIndex3D = ctx->permGradIndex3D;
++// -- GODOT end --
+
+ for (i = 0; i < 256; i++)
+ source[i] = (int16_t) i;
+@@ -206,6 +206,8 @@
+ return 0;
+ }
+
++// -- GODOT start --
++/*
+ void open_simplex_noise_free(struct osn_context *ctx)
+ {
+ if (!ctx)
+@@ -220,6 +222,8 @@
+ }
+ free(ctx);
+ }
++*/
++// -- GODOT end --
+
+ /* 2D OpenSimplex (Simplectic) Noise. */
+ double open_simplex_noise2(struct osn_context *ctx, double x, double y)
+diff -u orig/open-simplex-noise.h misc/open-simplex-noise.h
+--- orig/open-simplex-noise.h 2018-09-14 11:11:19.659807000 +0200
++++ misc/open-simplex-noise.h 2018-09-14 11:10:05.006460000 +0200
+@@ -35,11 +35,18 @@
+ extern "C" {
+ #endif
+
+-struct osn_context;
++// -- GODOT start --
++// Modified to work without allocating memory, also removed some unused function.
+
+-int open_simplex_noise(int64_t seed, struct osn_context **ctx);
++struct osn_context {
++ int16_t perm[256];
++ int16_t permGradIndex3D[256];
++};
++
++int open_simplex_noise(int64_t seed, struct osn_context *ctx);
++//int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements);
++// -- GODOT end --
+ void open_simplex_noise_free(struct osn_context *ctx);
+-int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements);
+ double open_simplex_noise2(struct osn_context *ctx, double x, double y);
+ double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z);
+ double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w);
diff --git a/thirdparty/misc/open-simplex-noise.c b/thirdparty/misc/open-simplex-noise.c
new file mode 100644
index 0000000000..42f2fbb5be
--- /dev/null
+++ b/thirdparty/misc/open-simplex-noise.c
@@ -0,0 +1,2254 @@
+/*
+ * OpenSimplex (Simplectic) Noise in C.
+ * Ported by Stephen M. Cameron from Kurt Spencer's java implementation
+ *
+ * v1.1 (October 5, 2014)
+ * - Added 2D and 4D implementations.
+ * - Proper gradient sets for all dimensions, from a
+ * dimensionally-generalizable scheme with an actual
+ * rhyme and reason behind it.
+ * - Removed default permutation array in favor of
+ * default seed.
+ * - Changed seed-based constructor to be independent
+ * of any particular randomization library, so results
+ * will be the same when ported to other languages.
+ */
+
+// -- GODOT start --
+// Modified to work without allocating memory, also removed some unused function.
+// -- GODOT end --
+
+#include <math.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <errno.h>
+
+#include "open-simplex-noise.h"
+
+#define STRETCH_CONSTANT_2D (-0.211324865405187) /* (1 / sqrt(2 + 1) - 1 ) / 2; */
+#define SQUISH_CONSTANT_2D (0.366025403784439) /* (sqrt(2 + 1) -1) / 2; */
+#define STRETCH_CONSTANT_3D (-1.0 / 6.0) /* (1 / sqrt(3 + 1) - 1) / 3; */
+#define SQUISH_CONSTANT_3D (1.0 / 3.0) /* (sqrt(3+1)-1)/3; */
+#define STRETCH_CONSTANT_4D (-0.138196601125011) /* (1 / sqrt(4 + 1) - 1) / 4; */
+#define SQUISH_CONSTANT_4D (0.309016994374947) /* (sqrt(4 + 1) - 1) / 4; */
+
+#define NORM_CONSTANT_2D (47.0)
+#define NORM_CONSTANT_3D (103.0)
+#define NORM_CONSTANT_4D (30.0)
+
+#define DEFAULT_SEED (0LL)
+
+// -- GODOT start --
+/*struct osn_context {
+ int16_t *perm;
+ int16_t *permGradIndex3D;
+};*/
+// -- GODOT end --
+#define ARRAYSIZE(x) (sizeof((x)) / sizeof((x)[0]))
+
+/*
+ * Gradients for 2D. They approximate the directions to the
+ * vertices of an octagon from the center.
+ */
+static const int8_t gradients2D[] = {
+ 5, 2, 2, 5,
+ -5, 2, -2, 5,
+ 5, -2, 2, -5,
+ -5, -2, -2, -5,
+};
+
+/*
+ * Gradients for 3D. They approximate the directions to the
+ * vertices of a rhombicuboctahedron from the center, skewed so
+ * that the triangular and square facets can be inscribed inside
+ * circles of the same radius.
+ */
+static const signed char gradients3D[] = {
+ -11, 4, 4, -4, 11, 4, -4, 4, 11,
+ 11, 4, 4, 4, 11, 4, 4, 4, 11,
+ -11, -4, 4, -4, -11, 4, -4, -4, 11,
+ 11, -4, 4, 4, -11, 4, 4, -4, 11,
+ -11, 4, -4, -4, 11, -4, -4, 4, -11,
+ 11, 4, -4, 4, 11, -4, 4, 4, -11,
+ -11, -4, -4, -4, -11, -4, -4, -4, -11,
+ 11, -4, -4, 4, -11, -4, 4, -4, -11,
+};
+
+/*
+ * Gradients for 4D. They approximate the directions to the
+ * vertices of a disprismatotesseractihexadecachoron from the center,
+ * skewed so that the tetrahedral and cubic facets can be inscribed inside
+ * spheres of the same radius.
+ */
+static const signed char gradients4D[] = {
+ 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3,
+ -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3,
+ 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3,
+ -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3,
+ 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3,
+ -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3,
+ 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3,
+ -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3,
+ 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3,
+ -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3,
+ 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3,
+ -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3,
+ 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3,
+ -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3,
+ 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3,
+ -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3,
+};
+
+static double extrapolate2(struct osn_context *ctx, int xsb, int ysb, double dx, double dy)
+{
+ int16_t *perm = ctx->perm;
+ int index = perm[(perm[xsb & 0xFF] + ysb) & 0xFF] & 0x0E;
+ return gradients2D[index] * dx
+ + gradients2D[index + 1] * dy;
+}
+
+static double extrapolate3(struct osn_context *ctx, int xsb, int ysb, int zsb, double dx, double dy, double dz)
+{
+ int16_t *perm = ctx->perm;
+ int16_t *permGradIndex3D = ctx->permGradIndex3D;
+ int index = permGradIndex3D[(perm[(perm[xsb & 0xFF] + ysb) & 0xFF] + zsb) & 0xFF];
+ return gradients3D[index] * dx
+ + gradients3D[index + 1] * dy
+ + gradients3D[index + 2] * dz;
+}
+
+static double extrapolate4(struct osn_context *ctx, int xsb, int ysb, int zsb, int wsb, double dx, double dy, double dz, double dw)
+{
+ int16_t *perm = ctx->perm;
+ int index = perm[(perm[(perm[(perm[xsb & 0xFF] + ysb) & 0xFF] + zsb) & 0xFF] + wsb) & 0xFF] & 0xFC;
+ return gradients4D[index] * dx
+ + gradients4D[index + 1] * dy
+ + gradients4D[index + 2] * dz
+ + gradients4D[index + 3] * dw;
+}
+
+static INLINE int fastFloor(double x) {
+ int xi = (int) x;
+ return x < xi ? xi - 1 : xi;
+}
+
+// -- GODOT start --
+/*
+static int allocate_perm(struct osn_context *ctx, int nperm, int ngrad)
+{
+ if (ctx->perm)
+ free(ctx->perm);
+ if (ctx->permGradIndex3D)
+ free(ctx->permGradIndex3D);
+ ctx->perm = (int16_t *) malloc(sizeof(*ctx->perm) * nperm);
+ if (!ctx->perm)
+ return -ENOMEM;
+ ctx->permGradIndex3D = (int16_t *) malloc(sizeof(*ctx->permGradIndex3D) * ngrad);
+ if (!ctx->permGradIndex3D) {
+ free(ctx->perm);
+ return -ENOMEM;
+ }
+ return 0;
+}
+
+int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements)
+{
+ int i, rc;
+
+ rc = allocate_perm(ctx, nelements, 256);
+ if (rc)
+ return rc;
+ memcpy(ctx->perm, p, sizeof(*ctx->perm) * nelements);
+
+ for (i = 0; i < 256; i++) {
+ // Since 3D has 24 gradients, simple bitmask won't work, so precompute modulo array.
+ ctx->permGradIndex3D[i] = (int16_t)((ctx->perm[i] % (ARRAYSIZE(gradients3D) / 3)) * 3);
+ }
+ return 0;
+}
+*/
+// -- GODOT end --
+
+/*
+ * Initializes using a permutation array generated from a 64-bit seed.
+ * Generates a proper permutation (i.e. doesn't merely perform N successive pair
+ * swaps on a base array). Uses a simple 64-bit LCG.
+ */
+// -- GODOT start --
+int open_simplex_noise(int64_t seed, struct osn_context *ctx)
+{
+ int rc;
+ int16_t source[256];
+ int i;
+ int16_t *perm;
+ int16_t *permGradIndex3D;
+ int r;
+
+ perm = ctx->perm;
+ permGradIndex3D = ctx->permGradIndex3D;
+// -- GODOT end --
+
+ for (i = 0; i < 256; i++)
+ source[i] = (int16_t) i;
+ seed = seed * 6364136223846793005LL + 1442695040888963407LL;
+ seed = seed * 6364136223846793005LL + 1442695040888963407LL;
+ seed = seed * 6364136223846793005LL + 1442695040888963407LL;
+ for (i = 255; i >= 0; i--) {
+ seed = seed * 6364136223846793005LL + 1442695040888963407LL;
+ r = (int)((seed + 31) % (i + 1));
+ if (r < 0)
+ r += (i + 1);
+ perm[i] = source[r];
+ permGradIndex3D[i] = (short)((perm[i] % (ARRAYSIZE(gradients3D) / 3)) * 3);
+ source[r] = source[i];
+ }
+ return 0;
+}
+
+// -- GODOT start --
+/*
+void open_simplex_noise_free(struct osn_context *ctx)
+{
+ if (!ctx)
+ return;
+ if (ctx->perm) {
+ free(ctx->perm);
+ ctx->perm = NULL;
+ }
+ if (ctx->permGradIndex3D) {
+ free(ctx->permGradIndex3D);
+ ctx->permGradIndex3D = NULL;
+ }
+ free(ctx);
+}
+*/
+// -- GODOT end --
+
+/* 2D OpenSimplex (Simplectic) Noise. */
+double open_simplex_noise2(struct osn_context *ctx, double x, double y)
+{
+
+ /* Place input coordinates onto grid. */
+ double stretchOffset = (x + y) * STRETCH_CONSTANT_2D;
+ double xs = x + stretchOffset;
+ double ys = y + stretchOffset;
+
+ /* Floor to get grid coordinates of rhombus (stretched square) super-cell origin. */
+ int xsb = fastFloor(xs);
+ int ysb = fastFloor(ys);
+
+ /* Skew out to get actual coordinates of rhombus origin. We'll need these later. */
+ double squishOffset = (xsb + ysb) * SQUISH_CONSTANT_2D;
+ double xb = xsb + squishOffset;
+ double yb = ysb + squishOffset;
+
+ /* Compute grid coordinates relative to rhombus origin. */
+ double xins = xs - xsb;
+ double yins = ys - ysb;
+
+ /* Sum those together to get a value that determines which region we're in. */
+ double inSum = xins + yins;
+
+ /* Positions relative to origin point. */
+ double dx0 = x - xb;
+ double dy0 = y - yb;
+
+ /* We'll be defining these inside the next block and using them afterwards. */
+ double dx_ext, dy_ext;
+ int xsv_ext, ysv_ext;
+
+ double dx1;
+ double dy1;
+ double attn1;
+ double dx2;
+ double dy2;
+ double attn2;
+ double zins;
+ double attn0;
+ double attn_ext;
+
+ double value = 0;
+
+ /* Contribution (1,0) */
+ dx1 = dx0 - 1 - SQUISH_CONSTANT_2D;
+ dy1 = dy0 - 0 - SQUISH_CONSTANT_2D;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate2(ctx, xsb + 1, ysb + 0, dx1, dy1);
+ }
+
+ /* Contribution (0,1) */
+ dx2 = dx0 - 0 - SQUISH_CONSTANT_2D;
+ dy2 = dy0 - 1 - SQUISH_CONSTANT_2D;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate2(ctx, xsb + 0, ysb + 1, dx2, dy2);
+ }
+
+ if (inSum <= 1) { /* We're inside the triangle (2-Simplex) at (0,0) */
+ zins = 1 - inSum;
+ if (zins > xins || zins > yins) { /* (0,0) is one of the closest two triangular vertices */
+ if (xins > yins) {
+ xsv_ext = xsb + 1;
+ ysv_ext = ysb - 1;
+ dx_ext = dx0 - 1;
+ dy_ext = dy0 + 1;
+ } else {
+ xsv_ext = xsb - 1;
+ ysv_ext = ysb + 1;
+ dx_ext = dx0 + 1;
+ dy_ext = dy0 - 1;
+ }
+ } else { /* (1,0) and (0,1) are the closest two vertices. */
+ xsv_ext = xsb + 1;
+ ysv_ext = ysb + 1;
+ dx_ext = dx0 - 1 - 2 * SQUISH_CONSTANT_2D;
+ dy_ext = dy0 - 1 - 2 * SQUISH_CONSTANT_2D;
+ }
+ } else { /* We're inside the triangle (2-Simplex) at (1,1) */
+ zins = 2 - inSum;
+ if (zins < xins || zins < yins) { /* (0,0) is one of the closest two triangular vertices */
+ if (xins > yins) {
+ xsv_ext = xsb + 2;
+ ysv_ext = ysb + 0;
+ dx_ext = dx0 - 2 - 2 * SQUISH_CONSTANT_2D;
+ dy_ext = dy0 + 0 - 2 * SQUISH_CONSTANT_2D;
+ } else {
+ xsv_ext = xsb + 0;
+ ysv_ext = ysb + 2;
+ dx_ext = dx0 + 0 - 2 * SQUISH_CONSTANT_2D;
+ dy_ext = dy0 - 2 - 2 * SQUISH_CONSTANT_2D;
+ }
+ } else { /* (1,0) and (0,1) are the closest two vertices. */
+ dx_ext = dx0;
+ dy_ext = dy0;
+ xsv_ext = xsb;
+ ysv_ext = ysb;
+ }
+ xsb += 1;
+ ysb += 1;
+ dx0 = dx0 - 1 - 2 * SQUISH_CONSTANT_2D;
+ dy0 = dy0 - 1 - 2 * SQUISH_CONSTANT_2D;
+ }
+
+ /* Contribution (0,0) or (1,1) */
+ attn0 = 2 - dx0 * dx0 - dy0 * dy0;
+ if (attn0 > 0) {
+ attn0 *= attn0;
+ value += attn0 * attn0 * extrapolate2(ctx, xsb, ysb, dx0, dy0);
+ }
+
+ /* Extra Vertex */
+ attn_ext = 2 - dx_ext * dx_ext - dy_ext * dy_ext;
+ if (attn_ext > 0) {
+ attn_ext *= attn_ext;
+ value += attn_ext * attn_ext * extrapolate2(ctx, xsv_ext, ysv_ext, dx_ext, dy_ext);
+ }
+
+ return value / NORM_CONSTANT_2D;
+}
+
+/*
+ * 3D OpenSimplex (Simplectic) Noise
+ */
+double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z)
+{
+
+ /* Place input coordinates on simplectic honeycomb. */
+ double stretchOffset = (x + y + z) * STRETCH_CONSTANT_3D;
+ double xs = x + stretchOffset;
+ double ys = y + stretchOffset;
+ double zs = z + stretchOffset;
+
+ /* Floor to get simplectic honeycomb coordinates of rhombohedron (stretched cube) super-cell origin. */
+ int xsb = fastFloor(xs);
+ int ysb = fastFloor(ys);
+ int zsb = fastFloor(zs);
+
+ /* Skew out to get actual coordinates of rhombohedron origin. We'll need these later. */
+ double squishOffset = (xsb + ysb + zsb) * SQUISH_CONSTANT_3D;
+ double xb = xsb + squishOffset;
+ double yb = ysb + squishOffset;
+ double zb = zsb + squishOffset;
+
+ /* Compute simplectic honeycomb coordinates relative to rhombohedral origin. */
+ double xins = xs - xsb;
+ double yins = ys - ysb;
+ double zins = zs - zsb;
+
+ /* Sum those together to get a value that determines which region we're in. */
+ double inSum = xins + yins + zins;
+
+ /* Positions relative to origin point. */
+ double dx0 = x - xb;
+ double dy0 = y - yb;
+ double dz0 = z - zb;
+
+ /* We'll be defining these inside the next block and using them afterwards. */
+ double dx_ext0, dy_ext0, dz_ext0;
+ double dx_ext1, dy_ext1, dz_ext1;
+ int xsv_ext0, ysv_ext0, zsv_ext0;
+ int xsv_ext1, ysv_ext1, zsv_ext1;
+
+ double wins;
+ int8_t c, c1, c2;
+ int8_t aPoint, bPoint;
+ double aScore, bScore;
+ int aIsFurtherSide;
+ int bIsFurtherSide;
+ double p1, p2, p3;
+ double score;
+ double attn0, attn1, attn2, attn3, attn4, attn5, attn6;
+ double dx1, dy1, dz1;
+ double dx2, dy2, dz2;
+ double dx3, dy3, dz3;
+ double dx4, dy4, dz4;
+ double dx5, dy5, dz5;
+ double dx6, dy6, dz6;
+ double attn_ext0, attn_ext1;
+
+ double value = 0;
+ if (inSum <= 1) { /* We're inside the tetrahedron (3-Simplex) at (0,0,0) */
+
+ /* Determine which two of (0,0,1), (0,1,0), (1,0,0) are closest. */
+ aPoint = 0x01;
+ aScore = xins;
+ bPoint = 0x02;
+ bScore = yins;
+ if (aScore >= bScore && zins > bScore) {
+ bScore = zins;
+ bPoint = 0x04;
+ } else if (aScore < bScore && zins > aScore) {
+ aScore = zins;
+ aPoint = 0x04;
+ }
+
+ /* Now we determine the two lattice points not part of the tetrahedron that may contribute.
+ This depends on the closest two tetrahedral vertices, including (0,0,0) */
+ wins = 1 - inSum;
+ if (wins > aScore || wins > bScore) { /* (0,0,0) is one of the closest two tetrahedral vertices. */
+ c = (bScore > aScore ? bPoint : aPoint); /* Our other closest vertex is the closest out of a and b. */
+
+ if ((c & 0x01) == 0) {
+ xsv_ext0 = xsb - 1;
+ xsv_ext1 = xsb;
+ dx_ext0 = dx0 + 1;
+ dx_ext1 = dx0;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb + 1;
+ dx_ext0 = dx_ext1 = dx0 - 1;
+ }
+
+ if ((c & 0x02) == 0) {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy_ext1 = dy0;
+ if ((c & 0x01) == 0) {
+ ysv_ext1 -= 1;
+ dy_ext1 += 1;
+ } else {
+ ysv_ext0 -= 1;
+ dy_ext0 += 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy0 - 1;
+ }
+
+ if ((c & 0x04) == 0) {
+ zsv_ext0 = zsb;
+ zsv_ext1 = zsb - 1;
+ dz_ext0 = dz0;
+ dz_ext1 = dz0 + 1;
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz0 - 1;
+ }
+ } else { /* (0,0,0) is not one of the closest two tetrahedral vertices. */
+ c = (int8_t)(aPoint | bPoint); /* Our two extra vertices are determined by the closest two. */
+
+ if ((c & 0x01) == 0) {
+ xsv_ext0 = xsb;
+ xsv_ext1 = xsb - 1;
+ dx_ext0 = dx0 - 2 * SQUISH_CONSTANT_3D;
+ dx_ext1 = dx0 + 1 - SQUISH_CONSTANT_3D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb + 1;
+ dx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ }
+
+ if ((c & 0x02) == 0) {
+ ysv_ext0 = ysb;
+ ysv_ext1 = ysb - 1;
+ dy_ext0 = dy0 - 2 * SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 + 1 - SQUISH_CONSTANT_3D;
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ }
+
+ if ((c & 0x04) == 0) {
+ zsv_ext0 = zsb;
+ zsv_ext1 = zsb - 1;
+ dz_ext0 = dz0 - 2 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 + 1 - SQUISH_CONSTANT_3D;
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ }
+ }
+
+ /* Contribution (0,0,0) */
+ attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0;
+ if (attn0 > 0) {
+ attn0 *= attn0;
+ value += attn0 * attn0 * extrapolate3(ctx, xsb + 0, ysb + 0, zsb + 0, dx0, dy0, dz0);
+ }
+
+ /* Contribution (1,0,0) */
+ dx1 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dy1 = dy0 - 0 - SQUISH_CONSTANT_3D;
+ dz1 = dz0 - 0 - SQUISH_CONSTANT_3D;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate3(ctx, xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1);
+ }
+
+ /* Contribution (0,1,0) */
+ dx2 = dx0 - 0 - SQUISH_CONSTANT_3D;
+ dy2 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dz2 = dz1;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate3(ctx, xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2);
+ }
+
+ /* Contribution (0,0,1) */
+ dx3 = dx2;
+ dy3 = dy1;
+ dz3 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate3(ctx, xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3);
+ }
+ } else if (inSum >= 2) { /* We're inside the tetrahedron (3-Simplex) at (1,1,1) */
+
+ /* Determine which two tetrahedral vertices are the closest, out of (1,1,0), (1,0,1), (0,1,1) but not (1,1,1). */
+ aPoint = 0x06;
+ aScore = xins;
+ bPoint = 0x05;
+ bScore = yins;
+ if (aScore <= bScore && zins < bScore) {
+ bScore = zins;
+ bPoint = 0x03;
+ } else if (aScore > bScore && zins < aScore) {
+ aScore = zins;
+ aPoint = 0x03;
+ }
+
+ /* Now we determine the two lattice points not part of the tetrahedron that may contribute.
+ This depends on the closest two tetrahedral vertices, including (1,1,1) */
+ wins = 3 - inSum;
+ if (wins < aScore || wins < bScore) { /* (1,1,1) is one of the closest two tetrahedral vertices. */
+ c = (bScore < aScore ? bPoint : aPoint); /* Our other closest vertex is the closest out of a and b. */
+
+ if ((c & 0x01) != 0) {
+ xsv_ext0 = xsb + 2;
+ xsv_ext1 = xsb + 1;
+ dx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_3D;
+ dx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb;
+ dx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_3D;
+ }
+
+ if ((c & 0x02) != 0) {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ if ((c & 0x01) != 0) {
+ ysv_ext1 += 1;
+ dy_ext1 -= 1;
+ } else {
+ ysv_ext0 += 1;
+ dy_ext0 -= 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_3D;
+ }
+
+ if ((c & 0x04) != 0) {
+ zsv_ext0 = zsb + 1;
+ zsv_ext1 = zsb + 2;
+ dz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 - 3 * SQUISH_CONSTANT_3D;
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb;
+ dz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_3D;
+ }
+ } else { /* (1,1,1) is not one of the closest two tetrahedral vertices. */
+ c = (int8_t)(aPoint & bPoint); /* Our two extra vertices are determined by the closest two. */
+
+ if ((c & 0x01) != 0) {
+ xsv_ext0 = xsb + 1;
+ xsv_ext1 = xsb + 2;
+ dx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dx_ext1 = dx0 - 2 - 2 * SQUISH_CONSTANT_3D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb;
+ dx_ext0 = dx0 - SQUISH_CONSTANT_3D;
+ dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;
+ }
+
+ if ((c & 0x02) != 0) {
+ ysv_ext0 = ysb + 1;
+ ysv_ext1 = ysb + 2;
+ dy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 2 - 2 * SQUISH_CONSTANT_3D;
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy0 - SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;
+ }
+
+ if ((c & 0x04) != 0) {
+ zsv_ext0 = zsb + 1;
+ zsv_ext1 = zsb + 2;
+ dz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 - 2 * SQUISH_CONSTANT_3D;
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb;
+ dz_ext0 = dz0 - SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;
+ }
+ }
+
+ /* Contribution (1,1,0) */
+ dx3 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dy3 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dz3 = dz0 - 0 - 2 * SQUISH_CONSTANT_3D;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate3(ctx, xsb + 1, ysb + 1, zsb + 0, dx3, dy3, dz3);
+ }
+
+ /* Contribution (1,0,1) */
+ dx2 = dx3;
+ dy2 = dy0 - 0 - 2 * SQUISH_CONSTANT_3D;
+ dz2 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate3(ctx, xsb + 1, ysb + 0, zsb + 1, dx2, dy2, dz2);
+ }
+
+ /* Contribution (0,1,1) */
+ dx1 = dx0 - 0 - 2 * SQUISH_CONSTANT_3D;
+ dy1 = dy3;
+ dz1 = dz2;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate3(ctx, xsb + 0, ysb + 1, zsb + 1, dx1, dy1, dz1);
+ }
+
+ /* Contribution (1,1,1) */
+ dx0 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ dy0 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ dz0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0;
+ if (attn0 > 0) {
+ attn0 *= attn0;
+ value += attn0 * attn0 * extrapolate3(ctx, xsb + 1, ysb + 1, zsb + 1, dx0, dy0, dz0);
+ }
+ } else { /* We're inside the octahedron (Rectified 3-Simplex) in between.
+ Decide between point (0,0,1) and (1,1,0) as closest */
+ p1 = xins + yins;
+ if (p1 > 1) {
+ aScore = p1 - 1;
+ aPoint = 0x03;
+ aIsFurtherSide = 1;
+ } else {
+ aScore = 1 - p1;
+ aPoint = 0x04;
+ aIsFurtherSide = 0;
+ }
+
+ /* Decide between point (0,1,0) and (1,0,1) as closest */
+ p2 = xins + zins;
+ if (p2 > 1) {
+ bScore = p2 - 1;
+ bPoint = 0x05;
+ bIsFurtherSide = 1;
+ } else {
+ bScore = 1 - p2;
+ bPoint = 0x02;
+ bIsFurtherSide = 0;
+ }
+
+ /* The closest out of the two (1,0,0) and (0,1,1) will replace the furthest out of the two decided above, if closer. */
+ p3 = yins + zins;
+ if (p3 > 1) {
+ score = p3 - 1;
+ if (aScore <= bScore && aScore < score) {
+ aScore = score;
+ aPoint = 0x06;
+ aIsFurtherSide = 1;
+ } else if (aScore > bScore && bScore < score) {
+ bScore = score;
+ bPoint = 0x06;
+ bIsFurtherSide = 1;
+ }
+ } else {
+ score = 1 - p3;
+ if (aScore <= bScore && aScore < score) {
+ aScore = score;
+ aPoint = 0x01;
+ aIsFurtherSide = 0;
+ } else if (aScore > bScore && bScore < score) {
+ bScore = score;
+ bPoint = 0x01;
+ bIsFurtherSide = 0;
+ }
+ }
+
+ /* Where each of the two closest points are determines how the extra two vertices are calculated. */
+ if (aIsFurtherSide == bIsFurtherSide) {
+ if (aIsFurtherSide) { /* Both closest points on (1,1,1) side */
+
+ /* One of the two extra points is (1,1,1) */
+ dx_ext0 = dx0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ dy_ext0 = dy0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ dz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_3D;
+ xsv_ext0 = xsb + 1;
+ ysv_ext0 = ysb + 1;
+ zsv_ext0 = zsb + 1;
+
+ /* Other extra point is based on the shared axis. */
+ c = (int8_t)(aPoint & bPoint);
+ if ((c & 0x01) != 0) {
+ dx_ext1 = dx0 - 2 - 2 * SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb + 2;
+ ysv_ext1 = ysb;
+ zsv_ext1 = zsb;
+ } else if ((c & 0x02) != 0) {
+ dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 2 - 2 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb;
+ ysv_ext1 = ysb + 2;
+ zsv_ext1 = zsb;
+ } else {
+ dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 - 2 * SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb;
+ ysv_ext1 = ysb;
+ zsv_ext1 = zsb + 2;
+ }
+ } else { /* Both closest points on (0,0,0) side */
+
+ /* One of the two extra points is (0,0,0) */
+ dx_ext0 = dx0;
+ dy_ext0 = dy0;
+ dz_ext0 = dz0;
+ xsv_ext0 = xsb;
+ ysv_ext0 = ysb;
+ zsv_ext0 = zsb;
+
+ /* Other extra point is based on the omitted axis. */
+ c = (int8_t)(aPoint | bPoint);
+ if ((c & 0x01) == 0) {
+ dx_ext1 = dx0 + 1 - SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb - 1;
+ ysv_ext1 = ysb + 1;
+ zsv_ext1 = zsb + 1;
+ } else if ((c & 0x02) == 0) {
+ dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 + 1 - SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb + 1;
+ ysv_ext1 = ysb - 1;
+ zsv_ext1 = zsb + 1;
+ } else {
+ dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 + 1 - SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb + 1;
+ ysv_ext1 = ysb + 1;
+ zsv_ext1 = zsb - 1;
+ }
+ }
+ } else { /* One point on (0,0,0) side, one point on (1,1,1) side */
+ if (aIsFurtherSide) {
+ c1 = aPoint;
+ c2 = bPoint;
+ } else {
+ c1 = bPoint;
+ c2 = aPoint;
+ }
+
+ /* One contribution is a permutation of (1,1,-1) */
+ if ((c1 & 0x01) == 0) {
+ dx_ext0 = dx0 + 1 - SQUISH_CONSTANT_3D;
+ dy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ xsv_ext0 = xsb - 1;
+ ysv_ext0 = ysb + 1;
+ zsv_ext0 = zsb + 1;
+ } else if ((c1 & 0x02) == 0) {
+ dx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dy_ext0 = dy0 + 1 - SQUISH_CONSTANT_3D;
+ dz_ext0 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ xsv_ext0 = xsb + 1;
+ ysv_ext0 = ysb - 1;
+ zsv_ext0 = zsb + 1;
+ } else {
+ dx_ext0 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dy_ext0 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dz_ext0 = dz0 + 1 - SQUISH_CONSTANT_3D;
+ xsv_ext0 = xsb + 1;
+ ysv_ext0 = ysb + 1;
+ zsv_ext0 = zsb - 1;
+ }
+
+ /* One contribution is a permutation of (0,0,2) */
+ dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_3D;
+ dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_3D;
+ dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_3D;
+ xsv_ext1 = xsb;
+ ysv_ext1 = ysb;
+ zsv_ext1 = zsb;
+ if ((c2 & 0x01) != 0) {
+ dx_ext1 -= 2;
+ xsv_ext1 += 2;
+ } else if ((c2 & 0x02) != 0) {
+ dy_ext1 -= 2;
+ ysv_ext1 += 2;
+ } else {
+ dz_ext1 -= 2;
+ zsv_ext1 += 2;
+ }
+ }
+
+ /* Contribution (1,0,0) */
+ dx1 = dx0 - 1 - SQUISH_CONSTANT_3D;
+ dy1 = dy0 - 0 - SQUISH_CONSTANT_3D;
+ dz1 = dz0 - 0 - SQUISH_CONSTANT_3D;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate3(ctx, xsb + 1, ysb + 0, zsb + 0, dx1, dy1, dz1);
+ }
+
+ /* Contribution (0,1,0) */
+ dx2 = dx0 - 0 - SQUISH_CONSTANT_3D;
+ dy2 = dy0 - 1 - SQUISH_CONSTANT_3D;
+ dz2 = dz1;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate3(ctx, xsb + 0, ysb + 1, zsb + 0, dx2, dy2, dz2);
+ }
+
+ /* Contribution (0,0,1) */
+ dx3 = dx2;
+ dy3 = dy1;
+ dz3 = dz0 - 1 - SQUISH_CONSTANT_3D;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate3(ctx, xsb + 0, ysb + 0, zsb + 1, dx3, dy3, dz3);
+ }
+
+ /* Contribution (1,1,0) */
+ dx4 = dx0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dy4 = dy0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ dz4 = dz0 - 0 - 2 * SQUISH_CONSTANT_3D;
+ attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4;
+ if (attn4 > 0) {
+ attn4 *= attn4;
+ value += attn4 * attn4 * extrapolate3(ctx, xsb + 1, ysb + 1, zsb + 0, dx4, dy4, dz4);
+ }
+
+ /* Contribution (1,0,1) */
+ dx5 = dx4;
+ dy5 = dy0 - 0 - 2 * SQUISH_CONSTANT_3D;
+ dz5 = dz0 - 1 - 2 * SQUISH_CONSTANT_3D;
+ attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5;
+ if (attn5 > 0) {
+ attn5 *= attn5;
+ value += attn5 * attn5 * extrapolate3(ctx, xsb + 1, ysb + 0, zsb + 1, dx5, dy5, dz5);
+ }
+
+ /* Contribution (0,1,1) */
+ dx6 = dx0 - 0 - 2 * SQUISH_CONSTANT_3D;
+ dy6 = dy4;
+ dz6 = dz5;
+ attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6;
+ if (attn6 > 0) {
+ attn6 *= attn6;
+ value += attn6 * attn6 * extrapolate3(ctx, xsb + 0, ysb + 1, zsb + 1, dx6, dy6, dz6);
+ }
+ }
+
+ /* First extra vertex */
+ attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0;
+ if (attn_ext0 > 0)
+ {
+ attn_ext0 *= attn_ext0;
+ value += attn_ext0 * attn_ext0 * extrapolate3(ctx, xsv_ext0, ysv_ext0, zsv_ext0, dx_ext0, dy_ext0, dz_ext0);
+ }
+
+ /* Second extra vertex */
+ attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1;
+ if (attn_ext1 > 0)
+ {
+ attn_ext1 *= attn_ext1;
+ value += attn_ext1 * attn_ext1 * extrapolate3(ctx, xsv_ext1, ysv_ext1, zsv_ext1, dx_ext1, dy_ext1, dz_ext1);
+ }
+
+ return value / NORM_CONSTANT_3D;
+}
+
+/*
+ * 4D OpenSimplex (Simplectic) Noise.
+ */
+double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w)
+{
+ double uins;
+ double dx1, dy1, dz1, dw1;
+ double dx2, dy2, dz2, dw2;
+ double dx3, dy3, dz3, dw3;
+ double dx4, dy4, dz4, dw4;
+ double dx5, dy5, dz5, dw5;
+ double dx6, dy6, dz6, dw6;
+ double dx7, dy7, dz7, dw7;
+ double dx8, dy8, dz8, dw8;
+ double dx9, dy9, dz9, dw9;
+ double dx10, dy10, dz10, dw10;
+ double attn0, attn1, attn2, attn3, attn4;
+ double attn5, attn6, attn7, attn8, attn9, attn10;
+ double attn_ext0, attn_ext1, attn_ext2;
+ int8_t c, c1, c2;
+ int8_t aPoint, bPoint;
+ double aScore, bScore;
+ int aIsBiggerSide;
+ int bIsBiggerSide;
+ double p1, p2, p3, p4;
+ double score;
+
+ /* Place input coordinates on simplectic honeycomb. */
+ double stretchOffset = (x + y + z + w) * STRETCH_CONSTANT_4D;
+ double xs = x + stretchOffset;
+ double ys = y + stretchOffset;
+ double zs = z + stretchOffset;
+ double ws = w + stretchOffset;
+
+ /* Floor to get simplectic honeycomb coordinates of rhombo-hypercube super-cell origin. */
+ int xsb = fastFloor(xs);
+ int ysb = fastFloor(ys);
+ int zsb = fastFloor(zs);
+ int wsb = fastFloor(ws);
+
+ /* Skew out to get actual coordinates of stretched rhombo-hypercube origin. We'll need these later. */
+ double squishOffset = (xsb + ysb + zsb + wsb) * SQUISH_CONSTANT_4D;
+ double xb = xsb + squishOffset;
+ double yb = ysb + squishOffset;
+ double zb = zsb + squishOffset;
+ double wb = wsb + squishOffset;
+
+ /* Compute simplectic honeycomb coordinates relative to rhombo-hypercube origin. */
+ double xins = xs - xsb;
+ double yins = ys - ysb;
+ double zins = zs - zsb;
+ double wins = ws - wsb;
+
+ /* Sum those together to get a value that determines which region we're in. */
+ double inSum = xins + yins + zins + wins;
+
+ /* Positions relative to origin point. */
+ double dx0 = x - xb;
+ double dy0 = y - yb;
+ double dz0 = z - zb;
+ double dw0 = w - wb;
+
+ /* We'll be defining these inside the next block and using them afterwards. */
+ double dx_ext0, dy_ext0, dz_ext0, dw_ext0;
+ double dx_ext1, dy_ext1, dz_ext1, dw_ext1;
+ double dx_ext2, dy_ext2, dz_ext2, dw_ext2;
+ int xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0;
+ int xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1;
+ int xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2;
+
+ double value = 0;
+ if (inSum <= 1) { /* We're inside the pentachoron (4-Simplex) at (0,0,0,0) */
+
+ /* Determine which two of (0,0,0,1), (0,0,1,0), (0,1,0,0), (1,0,0,0) are closest. */
+ aPoint = 0x01;
+ aScore = xins;
+ bPoint = 0x02;
+ bScore = yins;
+ if (aScore >= bScore && zins > bScore) {
+ bScore = zins;
+ bPoint = 0x04;
+ } else if (aScore < bScore && zins > aScore) {
+ aScore = zins;
+ aPoint = 0x04;
+ }
+ if (aScore >= bScore && wins > bScore) {
+ bScore = wins;
+ bPoint = 0x08;
+ } else if (aScore < bScore && wins > aScore) {
+ aScore = wins;
+ aPoint = 0x08;
+ }
+
+ /* Now we determine the three lattice points not part of the pentachoron that may contribute.
+ This depends on the closest two pentachoron vertices, including (0,0,0,0) */
+ uins = 1 - inSum;
+ if (uins > aScore || uins > bScore) { /* (0,0,0,0) is one of the closest two pentachoron vertices. */
+ c = (bScore > aScore ? bPoint : aPoint); /* Our other closest vertex is the closest out of a and b. */
+ if ((c & 0x01) == 0) {
+ xsv_ext0 = xsb - 1;
+ xsv_ext1 = xsv_ext2 = xsb;
+ dx_ext0 = dx0 + 1;
+ dx_ext1 = dx_ext2 = dx0;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + 1;
+ dx_ext0 = dx_ext1 = dx_ext2 = dx0 - 1;
+ }
+
+ if ((c & 0x02) == 0) {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;
+ dy_ext0 = dy_ext1 = dy_ext2 = dy0;
+ if ((c & 0x01) == 0x01) {
+ ysv_ext0 -= 1;
+ dy_ext0 += 1;
+ } else {
+ ysv_ext1 -= 1;
+ dy_ext1 += 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy_ext2 = dy0 - 1;
+ }
+
+ if ((c & 0x04) == 0) {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;
+ dz_ext0 = dz_ext1 = dz_ext2 = dz0;
+ if ((c & 0x03) != 0) {
+ if ((c & 0x03) == 0x03) {
+ zsv_ext0 -= 1;
+ dz_ext0 += 1;
+ } else {
+ zsv_ext1 -= 1;
+ dz_ext1 += 1;
+ }
+ } else {
+ zsv_ext2 -= 1;
+ dz_ext2 += 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz_ext2 = dz0 - 1;
+ }
+
+ if ((c & 0x08) == 0) {
+ wsv_ext0 = wsv_ext1 = wsb;
+ wsv_ext2 = wsb - 1;
+ dw_ext0 = dw_ext1 = dw0;
+ dw_ext2 = dw0 + 1;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + 1;
+ dw_ext0 = dw_ext1 = dw_ext2 = dw0 - 1;
+ }
+ } else { /* (0,0,0,0) is not one of the closest two pentachoron vertices. */
+ c = (int8_t)(aPoint | bPoint); /* Our three extra vertices are determined by the closest two. */
+
+ if ((c & 0x01) == 0) {
+ xsv_ext0 = xsv_ext2 = xsb;
+ xsv_ext1 = xsb - 1;
+ dx_ext0 = dx0 - 2 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 + 1 - SQUISH_CONSTANT_4D;
+ dx_ext2 = dx0 - SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb + 1;
+ dx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx_ext2 = dx0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x02) == 0) {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;
+ dy_ext0 = dy0 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy_ext2 = dy0 - SQUISH_CONSTANT_4D;
+ if ((c & 0x01) == 0x01) {
+ ysv_ext1 -= 1;
+ dy_ext1 += 1;
+ } else {
+ ysv_ext2 -= 1;
+ dy_ext2 += 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;
+ dy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy_ext2 = dy0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x04) == 0) {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;
+ dz_ext0 = dz0 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz_ext2 = dz0 - SQUISH_CONSTANT_4D;
+ if ((c & 0x03) == 0x03) {
+ zsv_ext1 -= 1;
+ dz_ext1 += 1;
+ } else {
+ zsv_ext2 -= 1;
+ dz_ext2 += 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;
+ dz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz_ext2 = dz0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x08) == 0) {
+ wsv_ext0 = wsv_ext1 = wsb;
+ wsv_ext2 = wsb - 1;
+ dw_ext0 = dw0 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 - SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 + 1 - SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb + 1;
+ dw_ext0 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw_ext2 = dw0 - 1 - SQUISH_CONSTANT_4D;
+ }
+ }
+
+ /* Contribution (0,0,0,0) */
+ attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0;
+ if (attn0 > 0) {
+ attn0 *= attn0;
+ value += attn0 * attn0 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 0, wsb + 0, dx0, dy0, dz0, dw0);
+ }
+
+ /* Contribution (1,0,0,0) */
+ dx1 = dx0 - 1 - SQUISH_CONSTANT_4D;
+ dy1 = dy0 - 0 - SQUISH_CONSTANT_4D;
+ dz1 = dz0 - 0 - SQUISH_CONSTANT_4D;
+ dw1 = dw0 - 0 - SQUISH_CONSTANT_4D;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1);
+ }
+
+ /* Contribution (0,1,0,0) */
+ dx2 = dx0 - 0 - SQUISH_CONSTANT_4D;
+ dy2 = dy0 - 1 - SQUISH_CONSTANT_4D;
+ dz2 = dz1;
+ dw2 = dw1;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2);
+ }
+
+ /* Contribution (0,0,1,0) */
+ dx3 = dx2;
+ dy3 = dy1;
+ dz3 = dz0 - 1 - SQUISH_CONSTANT_4D;
+ dw3 = dw1;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3);
+ }
+
+ /* Contribution (0,0,0,1) */
+ dx4 = dx2;
+ dy4 = dy1;
+ dz4 = dz1;
+ dw4 = dw0 - 1 - SQUISH_CONSTANT_4D;
+ attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;
+ if (attn4 > 0) {
+ attn4 *= attn4;
+ value += attn4 * attn4 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4);
+ }
+ } else if (inSum >= 3) { /* We're inside the pentachoron (4-Simplex) at (1,1,1,1)
+ Determine which two of (1,1,1,0), (1,1,0,1), (1,0,1,1), (0,1,1,1) are closest. */
+ aPoint = 0x0E;
+ aScore = xins;
+ bPoint = 0x0D;
+ bScore = yins;
+ if (aScore <= bScore && zins < bScore) {
+ bScore = zins;
+ bPoint = 0x0B;
+ } else if (aScore > bScore && zins < aScore) {
+ aScore = zins;
+ aPoint = 0x0B;
+ }
+ if (aScore <= bScore && wins < bScore) {
+ bScore = wins;
+ bPoint = 0x07;
+ } else if (aScore > bScore && wins < aScore) {
+ aScore = wins;
+ aPoint = 0x07;
+ }
+
+ /* Now we determine the three lattice points not part of the pentachoron that may contribute.
+ This depends on the closest two pentachoron vertices, including (0,0,0,0) */
+ uins = 4 - inSum;
+ if (uins < aScore || uins < bScore) { /* (1,1,1,1) is one of the closest two pentachoron vertices. */
+ c = (bScore < aScore ? bPoint : aPoint); /* Our other closest vertex is the closest out of a and b. */
+
+ if ((c & 0x01) != 0) {
+ xsv_ext0 = xsb + 2;
+ xsv_ext1 = xsv_ext2 = xsb + 1;
+ dx_ext0 = dx0 - 2 - 4 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx_ext2 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb;
+ dx_ext0 = dx_ext1 = dx_ext2 = dx0 - 4 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x02) != 0) {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy_ext2 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ if ((c & 0x01) != 0) {
+ ysv_ext1 += 1;
+ dy_ext1 -= 1;
+ } else {
+ ysv_ext0 += 1;
+ dy_ext0 -= 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;
+ dy_ext0 = dy_ext1 = dy_ext2 = dy0 - 4 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x04) != 0) {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz_ext2 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ if ((c & 0x03) != 0x03) {
+ if ((c & 0x03) == 0) {
+ zsv_ext0 += 1;
+ dz_ext0 -= 1;
+ } else {
+ zsv_ext1 += 1;
+ dz_ext1 -= 1;
+ }
+ } else {
+ zsv_ext2 += 1;
+ dz_ext2 -= 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;
+ dz_ext0 = dz_ext1 = dz_ext2 = dz0 - 4 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x08) != 0) {
+ wsv_ext0 = wsv_ext1 = wsb + 1;
+ wsv_ext2 = wsb + 2;
+ dw_ext0 = dw_ext1 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 2 - 4 * SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb;
+ dw_ext0 = dw_ext1 = dw_ext2 = dw0 - 4 * SQUISH_CONSTANT_4D;
+ }
+ } else { /* (1,1,1,1) is not one of the closest two pentachoron vertices. */
+ c = (int8_t)(aPoint & bPoint); /* Our three extra vertices are determined by the closest two. */
+
+ if ((c & 0x01) != 0) {
+ xsv_ext0 = xsv_ext2 = xsb + 1;
+ xsv_ext1 = xsb + 2;
+ dx_ext0 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D;
+ dx_ext2 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsv_ext2 = xsb;
+ dx_ext0 = dx0 - 2 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx_ext2 = dx0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x02) != 0) {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb + 1;
+ dy_ext0 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy_ext2 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ if ((c & 0x01) != 0) {
+ ysv_ext2 += 1;
+ dy_ext2 -= 1;
+ } else {
+ ysv_ext1 += 1;
+ dy_ext1 -= 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysv_ext2 = ysb;
+ dy_ext0 = dy0 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy_ext2 = dy0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x04) != 0) {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb + 1;
+ dz_ext0 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz_ext2 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ if ((c & 0x03) != 0) {
+ zsv_ext2 += 1;
+ dz_ext2 -= 1;
+ } else {
+ zsv_ext1 += 1;
+ dz_ext1 -= 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsv_ext2 = zsb;
+ dz_ext0 = dz0 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz_ext2 = dz0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x08) != 0) {
+ wsv_ext0 = wsv_ext1 = wsb + 1;
+ wsv_ext2 = wsb + 2;
+ dw_ext0 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsv_ext2 = wsb;
+ dw_ext0 = dw0 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw_ext2 = dw0 - 3 * SQUISH_CONSTANT_4D;
+ }
+ }
+
+ /* Contribution (1,1,1,0) */
+ dx4 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dy4 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dz4 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dw4 = dw0 - 3 * SQUISH_CONSTANT_4D;
+ attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;
+ if (attn4 > 0) {
+ attn4 *= attn4;
+ value += attn4 * attn4 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4);
+ }
+
+ /* Contribution (1,1,0,1) */
+ dx3 = dx4;
+ dy3 = dy4;
+ dz3 = dz0 - 3 * SQUISH_CONSTANT_4D;
+ dw3 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3);
+ }
+
+ /* Contribution (1,0,1,1) */
+ dx2 = dx4;
+ dy2 = dy0 - 3 * SQUISH_CONSTANT_4D;
+ dz2 = dz4;
+ dw2 = dw3;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2);
+ }
+
+ /* Contribution (0,1,1,1) */
+ dx1 = dx0 - 3 * SQUISH_CONSTANT_4D;
+ dz1 = dz4;
+ dy1 = dy4;
+ dw1 = dw3;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1);
+ }
+
+ /* Contribution (1,1,1,1) */
+ dx0 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dy0 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dz0 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dw0 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ attn0 = 2 - dx0 * dx0 - dy0 * dy0 - dz0 * dz0 - dw0 * dw0;
+ if (attn0 > 0) {
+ attn0 *= attn0;
+ value += attn0 * attn0 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 1, wsb + 1, dx0, dy0, dz0, dw0);
+ }
+ } else if (inSum <= 2) { /* We're inside the first dispentachoron (Rectified 4-Simplex) */
+ aIsBiggerSide = 1;
+ bIsBiggerSide = 1;
+
+ /* Decide between (1,1,0,0) and (0,0,1,1) */
+ if (xins + yins > zins + wins) {
+ aScore = xins + yins;
+ aPoint = 0x03;
+ } else {
+ aScore = zins + wins;
+ aPoint = 0x0C;
+ }
+
+ /* Decide between (1,0,1,0) and (0,1,0,1) */
+ if (xins + zins > yins + wins) {
+ bScore = xins + zins;
+ bPoint = 0x05;
+ } else {
+ bScore = yins + wins;
+ bPoint = 0x0A;
+ }
+
+ /* Closer between (1,0,0,1) and (0,1,1,0) will replace the further of a and b, if closer. */
+ if (xins + wins > yins + zins) {
+ score = xins + wins;
+ if (aScore >= bScore && score > bScore) {
+ bScore = score;
+ bPoint = 0x09;
+ } else if (aScore < bScore && score > aScore) {
+ aScore = score;
+ aPoint = 0x09;
+ }
+ } else {
+ score = yins + zins;
+ if (aScore >= bScore && score > bScore) {
+ bScore = score;
+ bPoint = 0x06;
+ } else if (aScore < bScore && score > aScore) {
+ aScore = score;
+ aPoint = 0x06;
+ }
+ }
+
+ /* Decide if (1,0,0,0) is closer. */
+ p1 = 2 - inSum + xins;
+ if (aScore >= bScore && p1 > bScore) {
+ bScore = p1;
+ bPoint = 0x01;
+ bIsBiggerSide = 0;
+ } else if (aScore < bScore && p1 > aScore) {
+ aScore = p1;
+ aPoint = 0x01;
+ aIsBiggerSide = 0;
+ }
+
+ /* Decide if (0,1,0,0) is closer. */
+ p2 = 2 - inSum + yins;
+ if (aScore >= bScore && p2 > bScore) {
+ bScore = p2;
+ bPoint = 0x02;
+ bIsBiggerSide = 0;
+ } else if (aScore < bScore && p2 > aScore) {
+ aScore = p2;
+ aPoint = 0x02;
+ aIsBiggerSide = 0;
+ }
+
+ /* Decide if (0,0,1,0) is closer. */
+ p3 = 2 - inSum + zins;
+ if (aScore >= bScore && p3 > bScore) {
+ bScore = p3;
+ bPoint = 0x04;
+ bIsBiggerSide = 0;
+ } else if (aScore < bScore && p3 > aScore) {
+ aScore = p3;
+ aPoint = 0x04;
+ aIsBiggerSide = 0;
+ }
+
+ /* Decide if (0,0,0,1) is closer. */
+ p4 = 2 - inSum + wins;
+ if (aScore >= bScore && p4 > bScore) {
+ bScore = p4;
+ bPoint = 0x08;
+ bIsBiggerSide = 0;
+ } else if (aScore < bScore && p4 > aScore) {
+ aScore = p4;
+ aPoint = 0x08;
+ aIsBiggerSide = 0;
+ }
+
+ /* Where each of the two closest points are determines how the extra three vertices are calculated. */
+ if (aIsBiggerSide == bIsBiggerSide) {
+ if (aIsBiggerSide) { /* Both closest points on the bigger side */
+ c1 = (int8_t)(aPoint | bPoint);
+ c2 = (int8_t)(aPoint & bPoint);
+ if ((c1 & 0x01) == 0) {
+ xsv_ext0 = xsb;
+ xsv_ext1 = xsb - 1;
+ dx_ext0 = dx0 - 3 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 + 1 - 2 * SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb + 1;
+ dx_ext0 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x02) == 0) {
+ ysv_ext0 = ysb;
+ ysv_ext1 = ysb - 1;
+ dy_ext0 = dy0 - 3 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy0 + 1 - 2 * SQUISH_CONSTANT_4D;
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x04) == 0) {
+ zsv_ext0 = zsb;
+ zsv_ext1 = zsb - 1;
+ dz_ext0 = dz0 - 3 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz0 + 1 - 2 * SQUISH_CONSTANT_4D;
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x08) == 0) {
+ wsv_ext0 = wsb;
+ wsv_ext1 = wsb - 1;
+ dw_ext0 = dw0 - 3 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 + 1 - 2 * SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsb + 1;
+ dw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ }
+
+ /* One combination is a permutation of (0,0,0,2) based on c2 */
+ xsv_ext2 = xsb;
+ ysv_ext2 = ysb;
+ zsv_ext2 = zsb;
+ wsv_ext2 = wsb;
+ dx_ext2 = dx0 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext2 = dy0 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext2 = dz0 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 2 * SQUISH_CONSTANT_4D;
+ if ((c2 & 0x01) != 0) {
+ xsv_ext2 += 2;
+ dx_ext2 -= 2;
+ } else if ((c2 & 0x02) != 0) {
+ ysv_ext2 += 2;
+ dy_ext2 -= 2;
+ } else if ((c2 & 0x04) != 0) {
+ zsv_ext2 += 2;
+ dz_ext2 -= 2;
+ } else {
+ wsv_ext2 += 2;
+ dw_ext2 -= 2;
+ }
+
+ } else { /* Both closest points on the smaller side */
+ /* One of the two extra points is (0,0,0,0) */
+ xsv_ext2 = xsb;
+ ysv_ext2 = ysb;
+ zsv_ext2 = zsb;
+ wsv_ext2 = wsb;
+ dx_ext2 = dx0;
+ dy_ext2 = dy0;
+ dz_ext2 = dz0;
+ dw_ext2 = dw0;
+
+ /* Other two points are based on the omitted axes. */
+ c = (int8_t)(aPoint | bPoint);
+
+ if ((c & 0x01) == 0) {
+ xsv_ext0 = xsb - 1;
+ xsv_ext1 = xsb;
+ dx_ext0 = dx0 + 1 - SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb + 1;
+ dx_ext0 = dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x02) == 0) {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D;
+ if ((c & 0x01) == 0x01)
+ {
+ ysv_ext0 -= 1;
+ dy_ext0 += 1;
+ } else {
+ ysv_ext1 -= 1;
+ dy_ext1 += 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x04) == 0) {
+ zsv_ext0 = zsv_ext1 = zsb;
+ dz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D;
+ if ((c & 0x03) == 0x03)
+ {
+ zsv_ext0 -= 1;
+ dz_ext0 += 1;
+ } else {
+ zsv_ext1 -= 1;
+ dz_ext1 += 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x08) == 0)
+ {
+ wsv_ext0 = wsb;
+ wsv_ext1 = wsb - 1;
+ dw_ext0 = dw0 - SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 + 1 - SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsb + 1;
+ dw_ext0 = dw_ext1 = dw0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ }
+ } else { /* One point on each "side" */
+ if (aIsBiggerSide) {
+ c1 = aPoint;
+ c2 = bPoint;
+ } else {
+ c1 = bPoint;
+ c2 = aPoint;
+ }
+
+ /* Two contributions are the bigger-sided point with each 0 replaced with -1. */
+ if ((c1 & 0x01) == 0) {
+ xsv_ext0 = xsb - 1;
+ xsv_ext1 = xsb;
+ dx_ext0 = dx0 + 1 - SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb + 1;
+ dx_ext0 = dx_ext1 = dx0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x02) == 0) {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy_ext1 = dy0 - SQUISH_CONSTANT_4D;
+ if ((c1 & 0x01) == 0x01) {
+ ysv_ext0 -= 1;
+ dy_ext0 += 1;
+ } else {
+ ysv_ext1 -= 1;
+ dy_ext1 += 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x04) == 0) {
+ zsv_ext0 = zsv_ext1 = zsb;
+ dz_ext0 = dz_ext1 = dz0 - SQUISH_CONSTANT_4D;
+ if ((c1 & 0x03) == 0x03) {
+ zsv_ext0 -= 1;
+ dz_ext0 += 1;
+ } else {
+ zsv_ext1 -= 1;
+ dz_ext1 += 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x08) == 0) {
+ wsv_ext0 = wsb;
+ wsv_ext1 = wsb - 1;
+ dw_ext0 = dw0 - SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 + 1 - SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsb + 1;
+ dw_ext0 = dw_ext1 = dw0 - 1 - SQUISH_CONSTANT_4D;
+ }
+
+ /* One contribution is a permutation of (0,0,0,2) based on the smaller-sided point */
+ xsv_ext2 = xsb;
+ ysv_ext2 = ysb;
+ zsv_ext2 = zsb;
+ wsv_ext2 = wsb;
+ dx_ext2 = dx0 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext2 = dy0 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext2 = dz0 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 2 * SQUISH_CONSTANT_4D;
+ if ((c2 & 0x01) != 0) {
+ xsv_ext2 += 2;
+ dx_ext2 -= 2;
+ } else if ((c2 & 0x02) != 0) {
+ ysv_ext2 += 2;
+ dy_ext2 -= 2;
+ } else if ((c2 & 0x04) != 0) {
+ zsv_ext2 += 2;
+ dz_ext2 -= 2;
+ } else {
+ wsv_ext2 += 2;
+ dw_ext2 -= 2;
+ }
+ }
+
+ /* Contribution (1,0,0,0) */
+ dx1 = dx0 - 1 - SQUISH_CONSTANT_4D;
+ dy1 = dy0 - 0 - SQUISH_CONSTANT_4D;
+ dz1 = dz0 - 0 - SQUISH_CONSTANT_4D;
+ dw1 = dw0 - 0 - SQUISH_CONSTANT_4D;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 0, wsb + 0, dx1, dy1, dz1, dw1);
+ }
+
+ /* Contribution (0,1,0,0) */
+ dx2 = dx0 - 0 - SQUISH_CONSTANT_4D;
+ dy2 = dy0 - 1 - SQUISH_CONSTANT_4D;
+ dz2 = dz1;
+ dw2 = dw1;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 0, wsb + 0, dx2, dy2, dz2, dw2);
+ }
+
+ /* Contribution (0,0,1,0) */
+ dx3 = dx2;
+ dy3 = dy1;
+ dz3 = dz0 - 1 - SQUISH_CONSTANT_4D;
+ dw3 = dw1;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 1, wsb + 0, dx3, dy3, dz3, dw3);
+ }
+
+ /* Contribution (0,0,0,1) */
+ dx4 = dx2;
+ dy4 = dy1;
+ dz4 = dz1;
+ dw4 = dw0 - 1 - SQUISH_CONSTANT_4D;
+ attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;
+ if (attn4 > 0) {
+ attn4 *= attn4;
+ value += attn4 * attn4 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 0, wsb + 1, dx4, dy4, dz4, dw4);
+ }
+
+ /* Contribution (1,1,0,0) */
+ dx5 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy5 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz5 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dw5 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5;
+ if (attn5 > 0) {
+ attn5 *= attn5;
+ value += attn5 * attn5 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5);
+ }
+
+ /* Contribution (1,0,1,0) */
+ dx6 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy6 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dz6 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw6 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6;
+ if (attn6 > 0) {
+ attn6 *= attn6;
+ value += attn6 * attn6 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6);
+ }
+
+ /* Contribution (1,0,0,1) */
+ dx7 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy7 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dz7 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dw7 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7;
+ if (attn7 > 0) {
+ attn7 *= attn7;
+ value += attn7 * attn7 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7);
+ }
+
+ /* Contribution (0,1,1,0) */
+ dx8 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dy8 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz8 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw8 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8;
+ if (attn8 > 0) {
+ attn8 *= attn8;
+ value += attn8 * attn8 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8);
+ }
+
+ /* Contribution (0,1,0,1) */
+ dx9 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dy9 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz9 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dw9 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9;
+ if (attn9 > 0) {
+ attn9 *= attn9;
+ value += attn9 * attn9 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9);
+ }
+
+ /* Contribution (0,0,1,1) */
+ dx10 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dy10 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dz10 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw10 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10;
+ if (attn10 > 0) {
+ attn10 *= attn10;
+ value += attn10 * attn10 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10);
+ }
+ } else { /* We're inside the second dispentachoron (Rectified 4-Simplex) */
+ aIsBiggerSide = 1;
+ bIsBiggerSide = 1;
+
+ /* Decide between (0,0,1,1) and (1,1,0,0) */
+ if (xins + yins < zins + wins) {
+ aScore = xins + yins;
+ aPoint = 0x0C;
+ } else {
+ aScore = zins + wins;
+ aPoint = 0x03;
+ }
+
+ /* Decide between (0,1,0,1) and (1,0,1,0) */
+ if (xins + zins < yins + wins) {
+ bScore = xins + zins;
+ bPoint = 0x0A;
+ } else {
+ bScore = yins + wins;
+ bPoint = 0x05;
+ }
+
+ /* Closer between (0,1,1,0) and (1,0,0,1) will replace the further of a and b, if closer. */
+ if (xins + wins < yins + zins) {
+ score = xins + wins;
+ if (aScore <= bScore && score < bScore) {
+ bScore = score;
+ bPoint = 0x06;
+ } else if (aScore > bScore && score < aScore) {
+ aScore = score;
+ aPoint = 0x06;
+ }
+ } else {
+ score = yins + zins;
+ if (aScore <= bScore && score < bScore) {
+ bScore = score;
+ bPoint = 0x09;
+ } else if (aScore > bScore && score < aScore) {
+ aScore = score;
+ aPoint = 0x09;
+ }
+ }
+
+ /* Decide if (0,1,1,1) is closer. */
+ p1 = 3 - inSum + xins;
+ if (aScore <= bScore && p1 < bScore) {
+ bScore = p1;
+ bPoint = 0x0E;
+ bIsBiggerSide = 0;
+ } else if (aScore > bScore && p1 < aScore) {
+ aScore = p1;
+ aPoint = 0x0E;
+ aIsBiggerSide = 0;
+ }
+
+ /* Decide if (1,0,1,1) is closer. */
+ p2 = 3 - inSum + yins;
+ if (aScore <= bScore && p2 < bScore) {
+ bScore = p2;
+ bPoint = 0x0D;
+ bIsBiggerSide = 0;
+ } else if (aScore > bScore && p2 < aScore) {
+ aScore = p2;
+ aPoint = 0x0D;
+ aIsBiggerSide = 0;
+ }
+
+ /* Decide if (1,1,0,1) is closer. */
+ p3 = 3 - inSum + zins;
+ if (aScore <= bScore && p3 < bScore) {
+ bScore = p3;
+ bPoint = 0x0B;
+ bIsBiggerSide = 0;
+ } else if (aScore > bScore && p3 < aScore) {
+ aScore = p3;
+ aPoint = 0x0B;
+ aIsBiggerSide = 0;
+ }
+
+ /* Decide if (1,1,1,0) is closer. */
+ p4 = 3 - inSum + wins;
+ if (aScore <= bScore && p4 < bScore) {
+ bScore = p4;
+ bPoint = 0x07;
+ bIsBiggerSide = 0;
+ } else if (aScore > bScore && p4 < aScore) {
+ aScore = p4;
+ aPoint = 0x07;
+ aIsBiggerSide = 0;
+ }
+
+ /* Where each of the two closest points are determines how the extra three vertices are calculated. */
+ if (aIsBiggerSide == bIsBiggerSide) {
+ if (aIsBiggerSide) { /* Both closest points on the bigger side */
+ c1 = (int8_t)(aPoint & bPoint);
+ c2 = (int8_t)(aPoint | bPoint);
+
+ /* Two contributions are permutations of (0,0,0,1) and (0,0,0,2) based on c1 */
+ xsv_ext0 = xsv_ext1 = xsb;
+ ysv_ext0 = ysv_ext1 = ysb;
+ zsv_ext0 = zsv_ext1 = zsb;
+ wsv_ext0 = wsv_ext1 = wsb;
+ dx_ext0 = dx0 - SQUISH_CONSTANT_4D;
+ dy_ext0 = dy0 - SQUISH_CONSTANT_4D;
+ dz_ext0 = dz0 - SQUISH_CONSTANT_4D;
+ dw_ext0 = dw0 - SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext1 = dy0 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext1 = dz0 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 - 2 * SQUISH_CONSTANT_4D;
+ if ((c1 & 0x01) != 0) {
+ xsv_ext0 += 1;
+ dx_ext0 -= 1;
+ xsv_ext1 += 2;
+ dx_ext1 -= 2;
+ } else if ((c1 & 0x02) != 0) {
+ ysv_ext0 += 1;
+ dy_ext0 -= 1;
+ ysv_ext1 += 2;
+ dy_ext1 -= 2;
+ } else if ((c1 & 0x04) != 0) {
+ zsv_ext0 += 1;
+ dz_ext0 -= 1;
+ zsv_ext1 += 2;
+ dz_ext1 -= 2;
+ } else {
+ wsv_ext0 += 1;
+ dw_ext0 -= 1;
+ wsv_ext1 += 2;
+ dw_ext1 -= 2;
+ }
+
+ /* One contribution is a permutation of (1,1,1,-1) based on c2 */
+ xsv_ext2 = xsb + 1;
+ ysv_ext2 = ysb + 1;
+ zsv_ext2 = zsb + 1;
+ wsv_ext2 = wsb + 1;
+ dx_ext2 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext2 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext2 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ if ((c2 & 0x01) == 0) {
+ xsv_ext2 -= 2;
+ dx_ext2 += 2;
+ } else if ((c2 & 0x02) == 0) {
+ ysv_ext2 -= 2;
+ dy_ext2 += 2;
+ } else if ((c2 & 0x04) == 0) {
+ zsv_ext2 -= 2;
+ dz_ext2 += 2;
+ } else {
+ wsv_ext2 -= 2;
+ dw_ext2 += 2;
+ }
+ } else { /* Both closest points on the smaller side */
+ /* One of the two extra points is (1,1,1,1) */
+ xsv_ext2 = xsb + 1;
+ ysv_ext2 = ysb + 1;
+ zsv_ext2 = zsb + 1;
+ wsv_ext2 = wsb + 1;
+ dx_ext2 = dx0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dy_ext2 = dy0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dz_ext2 = dz0 - 1 - 4 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 1 - 4 * SQUISH_CONSTANT_4D;
+
+ /* Other two points are based on the shared axes. */
+ c = (int8_t)(aPoint & bPoint);
+
+ if ((c & 0x01) != 0) {
+ xsv_ext0 = xsb + 2;
+ xsv_ext1 = xsb + 1;
+ dx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb;
+ dx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x02) != 0) {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ if ((c & 0x01) == 0)
+ {
+ ysv_ext0 += 1;
+ dy_ext0 -= 1;
+ } else {
+ ysv_ext1 += 1;
+ dy_ext1 -= 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x04) != 0) {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ if ((c & 0x03) == 0)
+ {
+ zsv_ext0 += 1;
+ dz_ext0 -= 1;
+ } else {
+ zsv_ext1 += 1;
+ dz_ext1 -= 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb;
+ dz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c & 0x08) != 0)
+ {
+ wsv_ext0 = wsb + 1;
+ wsv_ext1 = wsb + 2;
+ dw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsb;
+ dw_ext0 = dw_ext1 = dw0 - 3 * SQUISH_CONSTANT_4D;
+ }
+ }
+ } else { /* One point on each "side" */
+ if (aIsBiggerSide) {
+ c1 = aPoint;
+ c2 = bPoint;
+ } else {
+ c1 = bPoint;
+ c2 = aPoint;
+ }
+
+ /* Two contributions are the bigger-sided point with each 1 replaced with 2. */
+ if ((c1 & 0x01) != 0) {
+ xsv_ext0 = xsb + 2;
+ xsv_ext1 = xsb + 1;
+ dx_ext0 = dx0 - 2 - 3 * SQUISH_CONSTANT_4D;
+ dx_ext1 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ } else {
+ xsv_ext0 = xsv_ext1 = xsb;
+ dx_ext0 = dx_ext1 = dx0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x02) != 0) {
+ ysv_ext0 = ysv_ext1 = ysb + 1;
+ dy_ext0 = dy_ext1 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ if ((c1 & 0x01) == 0) {
+ ysv_ext0 += 1;
+ dy_ext0 -= 1;
+ } else {
+ ysv_ext1 += 1;
+ dy_ext1 -= 1;
+ }
+ } else {
+ ysv_ext0 = ysv_ext1 = ysb;
+ dy_ext0 = dy_ext1 = dy0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x04) != 0) {
+ zsv_ext0 = zsv_ext1 = zsb + 1;
+ dz_ext0 = dz_ext1 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ if ((c1 & 0x03) == 0) {
+ zsv_ext0 += 1;
+ dz_ext0 -= 1;
+ } else {
+ zsv_ext1 += 1;
+ dz_ext1 -= 1;
+ }
+ } else {
+ zsv_ext0 = zsv_ext1 = zsb;
+ dz_ext0 = dz_ext1 = dz0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ if ((c1 & 0x08) != 0) {
+ wsv_ext0 = wsb + 1;
+ wsv_ext1 = wsb + 2;
+ dw_ext0 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dw_ext1 = dw0 - 2 - 3 * SQUISH_CONSTANT_4D;
+ } else {
+ wsv_ext0 = wsv_ext1 = wsb;
+ dw_ext0 = dw_ext1 = dw0 - 3 * SQUISH_CONSTANT_4D;
+ }
+
+ /* One contribution is a permutation of (1,1,1,-1) based on the smaller-sided point */
+ xsv_ext2 = xsb + 1;
+ ysv_ext2 = ysb + 1;
+ zsv_ext2 = zsb + 1;
+ wsv_ext2 = wsb + 1;
+ dx_ext2 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy_ext2 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz_ext2 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw_ext2 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ if ((c2 & 0x01) == 0) {
+ xsv_ext2 -= 2;
+ dx_ext2 += 2;
+ } else if ((c2 & 0x02) == 0) {
+ ysv_ext2 -= 2;
+ dy_ext2 += 2;
+ } else if ((c2 & 0x04) == 0) {
+ zsv_ext2 -= 2;
+ dz_ext2 += 2;
+ } else {
+ wsv_ext2 -= 2;
+ dw_ext2 += 2;
+ }
+ }
+
+ /* Contribution (1,1,1,0) */
+ dx4 = dx0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dy4 = dy0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dz4 = dz0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ dw4 = dw0 - 3 * SQUISH_CONSTANT_4D;
+ attn4 = 2 - dx4 * dx4 - dy4 * dy4 - dz4 * dz4 - dw4 * dw4;
+ if (attn4 > 0) {
+ attn4 *= attn4;
+ value += attn4 * attn4 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 1, wsb + 0, dx4, dy4, dz4, dw4);
+ }
+
+ /* Contribution (1,1,0,1) */
+ dx3 = dx4;
+ dy3 = dy4;
+ dz3 = dz0 - 3 * SQUISH_CONSTANT_4D;
+ dw3 = dw0 - 1 - 3 * SQUISH_CONSTANT_4D;
+ attn3 = 2 - dx3 * dx3 - dy3 * dy3 - dz3 * dz3 - dw3 * dw3;
+ if (attn3 > 0) {
+ attn3 *= attn3;
+ value += attn3 * attn3 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 0, wsb + 1, dx3, dy3, dz3, dw3);
+ }
+
+ /* Contribution (1,0,1,1) */
+ dx2 = dx4;
+ dy2 = dy0 - 3 * SQUISH_CONSTANT_4D;
+ dz2 = dz4;
+ dw2 = dw3;
+ attn2 = 2 - dx2 * dx2 - dy2 * dy2 - dz2 * dz2 - dw2 * dw2;
+ if (attn2 > 0) {
+ attn2 *= attn2;
+ value += attn2 * attn2 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 1, wsb + 1, dx2, dy2, dz2, dw2);
+ }
+
+ /* Contribution (0,1,1,1) */
+ dx1 = dx0 - 3 * SQUISH_CONSTANT_4D;
+ dz1 = dz4;
+ dy1 = dy4;
+ dw1 = dw3;
+ attn1 = 2 - dx1 * dx1 - dy1 * dy1 - dz1 * dz1 - dw1 * dw1;
+ if (attn1 > 0) {
+ attn1 *= attn1;
+ value += attn1 * attn1 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 1, wsb + 1, dx1, dy1, dz1, dw1);
+ }
+
+ /* Contribution (1,1,0,0) */
+ dx5 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy5 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz5 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dw5 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ attn5 = 2 - dx5 * dx5 - dy5 * dy5 - dz5 * dz5 - dw5 * dw5;
+ if (attn5 > 0) {
+ attn5 *= attn5;
+ value += attn5 * attn5 * extrapolate4(ctx, xsb + 1, ysb + 1, zsb + 0, wsb + 0, dx5, dy5, dz5, dw5);
+ }
+
+ /* Contribution (1,0,1,0) */
+ dx6 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy6 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dz6 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw6 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ attn6 = 2 - dx6 * dx6 - dy6 * dy6 - dz6 * dz6 - dw6 * dw6;
+ if (attn6 > 0) {
+ attn6 *= attn6;
+ value += attn6 * attn6 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 1, wsb + 0, dx6, dy6, dz6, dw6);
+ }
+
+ /* Contribution (1,0,0,1) */
+ dx7 = dx0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dy7 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dz7 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dw7 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ attn7 = 2 - dx7 * dx7 - dy7 * dy7 - dz7 * dz7 - dw7 * dw7;
+ if (attn7 > 0) {
+ attn7 *= attn7;
+ value += attn7 * attn7 * extrapolate4(ctx, xsb + 1, ysb + 0, zsb + 0, wsb + 1, dx7, dy7, dz7, dw7);
+ }
+
+ /* Contribution (0,1,1,0) */
+ dx8 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dy8 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz8 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw8 = dw0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ attn8 = 2 - dx8 * dx8 - dy8 * dy8 - dz8 * dz8 - dw8 * dw8;
+ if (attn8 > 0) {
+ attn8 *= attn8;
+ value += attn8 * attn8 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 1, wsb + 0, dx8, dy8, dz8, dw8);
+ }
+
+ /* Contribution (0,1,0,1) */
+ dx9 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dy9 = dy0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dz9 = dz0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dw9 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ attn9 = 2 - dx9 * dx9 - dy9 * dy9 - dz9 * dz9 - dw9 * dw9;
+ if (attn9 > 0) {
+ attn9 *= attn9;
+ value += attn9 * attn9 * extrapolate4(ctx, xsb + 0, ysb + 1, zsb + 0, wsb + 1, dx9, dy9, dz9, dw9);
+ }
+
+ /* Contribution (0,0,1,1) */
+ dx10 = dx0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dy10 = dy0 - 0 - 2 * SQUISH_CONSTANT_4D;
+ dz10 = dz0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ dw10 = dw0 - 1 - 2 * SQUISH_CONSTANT_4D;
+ attn10 = 2 - dx10 * dx10 - dy10 * dy10 - dz10 * dz10 - dw10 * dw10;
+ if (attn10 > 0) {
+ attn10 *= attn10;
+ value += attn10 * attn10 * extrapolate4(ctx, xsb + 0, ysb + 0, zsb + 1, wsb + 1, dx10, dy10, dz10, dw10);
+ }
+ }
+
+ /* First extra vertex */
+ attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0 - dw_ext0 * dw_ext0;
+ if (attn_ext0 > 0)
+ {
+ attn_ext0 *= attn_ext0;
+ value += attn_ext0 * attn_ext0 * extrapolate4(ctx, xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0, dx_ext0, dy_ext0, dz_ext0, dw_ext0);
+ }
+
+ /* Second extra vertex */
+ attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1 - dw_ext1 * dw_ext1;
+ if (attn_ext1 > 0)
+ {
+ attn_ext1 *= attn_ext1;
+ value += attn_ext1 * attn_ext1 * extrapolate4(ctx, xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1, dx_ext1, dy_ext1, dz_ext1, dw_ext1);
+ }
+
+ /* Third extra vertex */
+ attn_ext2 = 2 - dx_ext2 * dx_ext2 - dy_ext2 * dy_ext2 - dz_ext2 * dz_ext2 - dw_ext2 * dw_ext2;
+ if (attn_ext2 > 0)
+ {
+ attn_ext2 *= attn_ext2;
+ value += attn_ext2 * attn_ext2 * extrapolate4(ctx, xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2, dx_ext2, dy_ext2, dz_ext2, dw_ext2);
+ }
+
+ return value / NORM_CONSTANT_4D;
+}
+
diff --git a/thirdparty/misc/open-simplex-noise.h b/thirdparty/misc/open-simplex-noise.h
new file mode 100644
index 0000000000..89e0df8218
--- /dev/null
+++ b/thirdparty/misc/open-simplex-noise.h
@@ -0,0 +1,58 @@
+#ifndef OPEN_SIMPLEX_NOISE_H__
+#define OPEN_SIMPLEX_NOISE_H__
+
+/*
+ * OpenSimplex (Simplectic) Noise in C.
+ * Ported to C from Kurt Spencer's java implementation by Stephen M. Cameron
+ *
+ * v1.1 (October 6, 2014)
+ * - Ported to C
+ *
+ * v1.1 (October 5, 2014)
+ * - Added 2D and 4D implementations.
+ * - Proper gradient sets for all dimensions, from a
+ * dimensionally-generalizable scheme with an actual
+ * rhyme and reason behind it.
+ * - Removed default permutation array in favor of
+ * default seed.
+ * - Changed seed-based constructor to be independent
+ * of any particular randomization library, so results
+ * will be the same when ported to other languages.
+ */
+
+#if ((__GNUC_STDC_INLINE__) || (__STDC_VERSION__ >= 199901L))
+ #include <stdint.h>
+ #define INLINE inline
+#elif (defined (_MSC_VER) || defined (__GNUC_GNU_INLINE__))
+ #include <stdint.h>
+ #define INLINE __inline
+#else
+ /* ANSI C doesn't have inline or stdint.h. */
+ #define INLINE
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+// -- GODOT start --
+// Modified to work without allocating memory, also removed some unused function.
+
+struct osn_context {
+ int16_t perm[256];
+ int16_t permGradIndex3D[256];
+};
+
+int open_simplex_noise(int64_t seed, struct osn_context *ctx);
+//int open_simplex_noise_init_perm(struct osn_context *ctx, int16_t p[], int nelements);
+// -- GODOT end --
+void open_simplex_noise_free(struct osn_context *ctx);
+double open_simplex_noise2(struct osn_context *ctx, double x, double y);
+double open_simplex_noise3(struct osn_context *ctx, double x, double y, double z);
+double open_simplex_noise4(struct osn_context *ctx, double x, double y, double z, double w);
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
diff --git a/thirdparty/zstd/1314.diff b/thirdparty/zstd/1314.diff
new file mode 100644
index 0000000000..c9f4efadbf
--- /dev/null
+++ b/thirdparty/zstd/1314.diff
@@ -0,0 +1,13 @@
+diff --git a/common/cpu.h b/common/cpu.h
+index 88e0ebf44..eeb428ad5 100644
+--- a/common/cpu.h
++++ b/common/cpu.h
+@@ -36,7 +36,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
+ U32 f1d = 0;
+ U32 f7b = 0;
+ U32 f7c = 0;
+-#ifdef _MSC_VER
++#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
+ int reg[4];
+ __cpuid((int*)reg, 0);
+ {
diff --git a/thirdparty/zstd/common/cpu.h b/thirdparty/zstd/common/cpu.h
index 4eb48e39e1..a109520a33 100644
--- a/thirdparty/zstd/common/cpu.h
+++ b/thirdparty/zstd/common/cpu.h
@@ -36,7 +36,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
U32 f1d = 0;
U32 f7b = 0;
U32 f7c = 0;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86))
int reg[4];
__cpuid((int*)reg, 0);
{