summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml4
-rw-r--r--SConstruct5
-rw-r--r--core/bind/core_bind.h6
-rw-r--r--core/class_db.cpp4
-rw-r--r--core/io/file_access_buffered.cpp4
-rw-r--r--core/io/image_loader.h1
-rw-r--r--core/io/ip.cpp36
-rw-r--r--core/io/ip.h11
-rw-r--r--core/io/ip_address.cpp3
-rw-r--r--core/io/marshalls.cpp5
-rw-r--r--core/io/net_socket.h2
-rw-r--r--core/io/packet_peer_udp.cpp23
-rw-r--r--core/io/packet_peer_udp.h2
-rw-r--r--core/io/resource_format_binary.cpp10
-rw-r--r--core/io/resource_format_binary.h2
-rw-r--r--core/io/resource_importer.h5
-rw-r--r--core/io/resource_loader.h2
-rw-r--r--core/io/resource_saver.h2
-rw-r--r--core/io/translation_loader_po.h1
-rw-r--r--core/io/xml_parser.cpp4
-rw-r--r--core/math/a_star.cpp141
-rw-r--r--core/math/a_star.h41
-rw-r--r--core/math/expression.h3
-rw-r--r--core/os/file_access.cpp6
-rw-r--r--core/os/input_event.h30
-rw-r--r--core/os/os.h2
-rw-r--r--core/pool_allocator.cpp4
-rw-r--r--core/pool_vector.h6
-rw-r--r--core/register_core_types.cpp1
-rw-r--r--core/ustring.cpp3
-rw-r--r--core/ustring.h2
-rw-r--r--core/variant_call.cpp6
-rw-r--r--doc/classes/AStar.xml2
-rw-r--r--doc/classes/AStar2D.xml258
-rw-r--r--doc/classes/AcceptDialog.xml5
-rw-r--r--doc/classes/AnimationPlayer.xml9
-rw-r--r--doc/classes/Area.xml15
-rw-r--r--doc/classes/Area2D.xml23
-rw-r--r--doc/classes/AudioEffectPitchShift.xml16
-rw-r--r--doc/classes/CPUParticles2D.xml4
-rw-r--r--doc/classes/CameraFeed.xml4
-rw-r--r--doc/classes/CameraServer.xml4
-rw-r--r--doc/classes/ColorPicker.xml5
-rw-r--r--doc/classes/Engine.xml18
-rw-r--r--doc/classes/File.xml4
-rw-r--r--doc/classes/GDNativeLibraryResourceLoader.xml13
-rw-r--r--doc/classes/GDNativeLibraryResourceSaver.xml13
-rw-r--r--doc/classes/IP.xml16
-rw-r--r--doc/classes/ItemList.xml78
-rw-r--r--doc/classes/OS.xml6
-rw-r--r--doc/classes/Object.xml1
-rw-r--r--doc/classes/PacketPeerUDP.xml23
-rw-r--r--doc/classes/ReferenceRect.xml3
-rw-r--r--doc/classes/Resource.xml9
-rw-r--r--doc/classes/ResourceFormatDDS.xml13
-rw-r--r--doc/classes/ResourceFormatImporter.xml13
-rw-r--r--doc/classes/ResourceFormatLoader.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderBMFont.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderBinary.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderDynamicFont.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderGDScript.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderImage.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderNativeScript.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderShader.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderStreamTexture.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderText.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderTextureLayered.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderTheora.xml13
-rw-r--r--doc/classes/ResourceFormatLoaderWebm.xml13
-rw-r--r--doc/classes/ResourceFormatPKM.xml13
-rw-r--r--doc/classes/ResourceFormatPVR.xml13
-rw-r--r--doc/classes/ResourceFormatSaver.xml11
-rw-r--r--doc/classes/ResourceFormatSaverBinary.xml13
-rw-r--r--doc/classes/ResourceFormatSaverGDScript.xml13
-rw-r--r--doc/classes/ResourceFormatSaverNativeScript.xml13
-rw-r--r--doc/classes/ResourceFormatSaverShader.xml13
-rw-r--r--doc/classes/ResourceFormatSaverText.xml13
-rw-r--r--doc/classes/ResourceImporter.xml13
-rw-r--r--doc/classes/ResourceInteractiveLoader.xml16
-rw-r--r--doc/classes/ResourceLoader.xml20
-rw-r--r--doc/classes/ResourcePreloader.xml1
-rw-r--r--doc/classes/ResourceSaver.xml16
-rw-r--r--doc/classes/ResourceSaverPNG.xml13
-rw-r--r--doc/classes/Sprite.xml2
-rw-r--r--doc/classes/String.xml16
-rw-r--r--doc/classes/TextEdit.xml26
-rw-r--r--doc/classes/TranslationLoaderPO.xml13
-rw-r--r--doc/classes/TranslationServer.xml1
-rw-r--r--doc/classes/VisualShaderNodeGroupBase.xml8
-rw-r--r--drivers/dummy/texture_loader_dummy.h1
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp8
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp23
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp3
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp10
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp17
-rw-r--r--drivers/png/image_loader_png.cpp355
-rw-r--r--drivers/png/image_loader_png.h9
-rw-r--r--drivers/png/png_driver_common.cpp205
-rw-r--r--drivers/png/png_driver_common.h (renamed from editor/editor_name_dialog.cpp)71
-rw-r--r--drivers/png/resource_saver_png.cpp137
-rw-r--r--drivers/png/resource_saver_png.h1
-rw-r--r--drivers/unix/ip_unix.cpp78
-rw-r--r--drivers/unix/ip_unix.h2
-rw-r--r--drivers/unix/net_socket_posix.cpp70
-rw-r--r--drivers/unix/net_socket_posix.h3
-rw-r--r--editor/animation_bezier_editor.h2
-rw-r--r--editor/animation_track_editor.cpp127
-rw-r--r--editor/animation_track_editor.h33
-rw-r--r--editor/animation_track_editor_plugins.h19
-rw-r--r--editor/audio_stream_preview.h4
-rw-r--r--editor/code_editor.cpp29
-rw-r--r--editor/code_editor.h2
-rw-r--r--editor/create_dialog.h2
-rw-r--r--editor/editor_audio_buses.h4
-rw-r--r--editor/editor_autoload_settings.cpp2
-rw-r--r--editor/editor_export.h11
-rw-r--r--editor/editor_feature_profile.cpp17
-rw-r--r--editor/editor_inspector.h5
-rw-r--r--editor/editor_layouts_dialog.cpp138
-rw-r--r--editor/editor_layouts_dialog.h (renamed from editor/editor_name_dialog.h)23
-rw-r--r--editor/editor_node.cpp21
-rw-r--r--editor/editor_node.h6
-rw-r--r--editor/editor_plugin.h3
-rw-r--r--editor/editor_profiler.h2
-rw-r--r--editor/editor_properties.cpp3
-rw-r--r--editor/editor_properties.h61
-rw-r--r--editor/editor_properties_array_dict.h4
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/editor_spin_slider.h2
-rw-r--r--editor/export_template_manager.h2
-rw-r--r--editor/find_in_files.h9
-rw-r--r--editor/icons/icon_GUI_toggle_off.svg6
-rw-r--r--editor/icons/icon_GUI_toggle_on.svg6
-rw-r--r--editor/icons/icon_key_valid.svg5
-rw-r--r--editor/import/editor_import_plugin.h3
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp3
-rw-r--r--editor/import/resource_importer_bitmask.h2
-rw-r--r--editor/import/resource_importer_csv_translation.h3
-rw-r--r--editor/import/resource_importer_image.cpp5
-rw-r--r--editor/import/resource_importer_image.h3
-rw-r--r--editor/import/resource_importer_layered_texture.h2
-rw-r--r--editor/import/resource_importer_obj.cpp3
-rw-r--r--editor/import/resource_importer_obj.h3
-rw-r--r--editor/import/resource_importer_scene.h2
-rw-r--r--editor/import/resource_importer_texture.h2
-rw-r--r--editor/import/resource_importer_texture_atlas.h2
-rw-r--r--editor/import/resource_importer_wav.h3
-rw-r--r--editor/import_dock.cpp3
-rw-r--r--editor/import_dock.h2
-rw-r--r--editor/pane_drag.h2
-rw-r--r--editor/plugins/animation_blend_space_1d_editor.h2
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp143
-rw-r--r--editor/plugins/animation_player_editor_plugin.h1
-rw-r--r--editor/plugins/animation_tree_editor_plugin.h3
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp9
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.cpp6
-rw-r--r--editor/plugins/cpu_particles_2d_editor_plugin.h3
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.cpp8
-rw-r--r--editor/plugins/cpu_particles_editor_plugin.h1
-rw-r--r--editor/plugins/curve_editor_plugin.h12
-rw-r--r--editor/plugins/editor_preview_plugins.h15
-rw-r--r--editor/plugins/gradient_editor_plugin.h5
-rw-r--r--editor/plugins/material_editor_plugin.h11
-rw-r--r--editor/plugins/mesh_editor_plugin.h3
-rw-r--r--editor/plugins/particles_2d_editor_plugin.cpp10
-rw-r--r--editor/plugins/particles_2d_editor_plugin.h3
-rw-r--r--editor/plugins/particles_editor_plugin.cpp11
-rw-r--r--editor/plugins/particles_editor_plugin.h3
-rw-r--r--editor/plugins/root_motion_editor_plugin.h4
-rw-r--r--editor/plugins/script_editor_plugin.cpp81
-rw-r--r--editor/plugins/script_editor_plugin.h10
-rw-r--r--editor/plugins/script_text_editor.cpp7
-rw-r--r--editor/plugins/script_text_editor.h1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp2
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp4
-rw-r--r--editor/plugins/spatial_editor_plugin.h15
-rw-r--r--editor/plugins/style_box_editor_plugin.h3
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/text_editor.h2
-rw-r--r--editor/plugins/texture_editor_plugin.h3
-rw-r--r--editor/plugins/tile_set_editor_plugin.h3
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp17
-rw-r--r--editor/plugins/visual_shader_editor_plugin.h11
-rw-r--r--editor/project_manager.cpp104
-rw-r--r--editor/project_manager.h12
-rw-r--r--editor/property_editor.h2
-rw-r--r--editor/property_selector.h2
-rw-r--r--editor/quick_open.h2
-rw-r--r--editor/scene_tree_dock.cpp29
-rw-r--r--editor/scene_tree_dock.h1
-rw-r--r--editor/script_editor_debugger.cpp92
-rw-r--r--editor/spatial_editor_gizmos.cpp32
-rw-r--r--main/main.cpp7
-rw-r--r--main/tests/test_string.cpp12
-rw-r--r--misc/ide/jetbrains/build.gradle2
-rw-r--r--modules/bmp/image_loader_bmp.cpp10
-rw-r--r--modules/bullet/bullet_physics_server.h2
-rw-r--r--modules/bullet/rigid_body_bullet.h2
-rw-r--r--modules/bullet/space_bullet.h3
-rw-r--r--modules/csg/csg.cpp8
-rw-r--r--modules/csg/csg_gizmos.h3
-rw-r--r--modules/csg/csg_shape.cpp8
-rw-r--r--modules/csg/csg_shape.h17
-rw-r--r--modules/cvtt/image_compress_cvtt.cpp6
-rw-r--r--modules/dds/texture_loader_dds.h1
-rw-r--r--modules/enet/networked_multiplayer_enet.h3
-rw-r--r--modules/etc/texture_loader_pkm.h1
-rw-r--r--modules/gdnative/arvr/arvr_interface_gdnative.h2
-rw-r--r--modules/gdnative/config.py2
-rw-r--r--modules/gdnative/doc_classes/@NativeScript.xml (renamed from doc/classes/@NativeScript.xml)0
-rw-r--r--modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml13
-rw-r--r--modules/gdnative/gdnative.h6
-rw-r--r--modules/gdnative/nativescript/nativescript.h6
-rw-r--r--modules/gdnative/net/multiplayer_peer_gdnative.h2
-rw-r--r--modules/gdnative/net/packet_peer_gdnative.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.h4
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.h1
-rw-r--r--modules/gdscript/config.py1
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml (renamed from doc/classes/@GDScript.xml)0
-rw-r--r--modules/gdscript/gdscript.h2
-rw-r--r--modules/gdscript/gdscript_function.cpp62
-rw-r--r--modules/gridmap/grid_map.cpp1
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp6
-rwxr-xr-xmodules/mbedtls/stream_peer_mbed_tls.cpp2
-rw-r--r--modules/mono/csharp_script.h4
-rw-r--r--modules/mono/editor/godotsharp_editor.h4
-rw-r--r--modules/mono/editor/mono_bottom_panel.h4
-rw-r--r--modules/mono/mono_gc_handle.h2
-rw-r--r--modules/mono/mono_gd/gd_mono.h2
-rw-r--r--modules/mono/signal_awaiter_utils.h2
-rw-r--r--modules/opensimplex/doc_classes/OpenSimplexNoise.xml2
-rw-r--r--modules/opensimplex/noise_texture.h2
-rw-r--r--modules/opensimplex/open_simplex_noise.h2
-rw-r--r--modules/opus/SCsub2
-rw-r--r--modules/opus/audio_stream_opus.h5
-rw-r--r--modules/pvr/texture_loader_pvr.h1
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h4
-rw-r--r--modules/stb_vorbis/config.py1
-rw-r--r--modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml13
-rw-r--r--modules/stb_vorbis/register_types.cpp13
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.cpp5
-rw-r--r--modules/stb_vorbis/resource_importer_ogg_vorbis.h3
-rw-r--r--modules/theora/config.py1
-rw-r--r--modules/theora/video_stream_theora.h1
-rw-r--r--modules/visual_script/config.py1
-rw-r--r--modules/visual_script/doc_classes/@VisualScript.xml (renamed from doc/classes/@VisualScript.xml)0
-rw-r--r--modules/visual_script/visual_script.cpp2
-rw-r--r--modules/visual_script/visual_script.h4
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.h3
-rw-r--r--modules/visual_script/visual_script_editor.cpp4
-rw-r--r--modules/visual_script/visual_script_editor.h2
-rw-r--r--modules/visual_script/visual_script_expression.h2
-rw-r--r--modules/visual_script/visual_script_flow_control.h14
-rw-r--r--modules/visual_script/visual_script_func_nodes.h11
-rw-r--r--modules/visual_script/visual_script_nodes.h54
-rw-r--r--modules/visual_script/visual_script_property_selector.cpp3
-rw-r--r--modules/visual_script/visual_script_property_selector.h2
-rw-r--r--modules/visual_script/visual_script_yield_nodes.h6
-rw-r--r--modules/vorbis/audio_stream_ogg_vorbis.h1
-rw-r--r--modules/webm/config.py1
-rw-r--r--modules/webm/libvpx/SCsub2
-rw-r--r--modules/webm/video_stream_webm.h3
-rw-r--r--platform/android/SCsub4
-rw-r--r--platform/android/detect.py16
-rw-r--r--platform/android/export/export.cpp5
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java12
-rw-r--r--platform/haiku/detect.py2
-rw-r--r--platform/javascript/export/export.cpp2
-rw-r--r--platform/osx/os_osx.h1
-rw-r--r--platform/osx/os_osx.mm11
-rw-r--r--platform/server/detect.py2
-rw-r--r--platform/windows/os_windows.cpp12
-rw-r--r--platform/windows/os_windows.h3
-rw-r--r--platform/x11/detect.py8
-rw-r--r--platform/x11/detect_prime.cpp14
-rw-r--r--platform/x11/joypad_linux.cpp4
-rw-r--r--scene/2d/area_2d.cpp8
-rw-r--r--scene/2d/audio_stream_player_2d.h2
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/2d/collision_object_2d.h2
-rw-r--r--scene/2d/collision_shape_2d.h2
-rw-r--r--scene/2d/cpu_particles_2d.cpp6
-rw-r--r--scene/2d/joints_2d.cpp4
-rw-r--r--scene/2d/line_2d.h2
-rw-r--r--scene/2d/mesh_instance_2d.h2
-rw-r--r--scene/2d/particles_2d.cpp1
-rw-r--r--scene/2d/particles_2d.h2
-rw-r--r--scene/2d/position_2d.h2
-rw-r--r--scene/2d/skeleton_2d.h2
-rw-r--r--scene/3d/area.cpp2
-rw-r--r--scene/3d/audio_stream_player_3d.h3
-rw-r--r--scene/3d/cpu_particles.cpp5
-rw-r--r--scene/3d/particles.cpp1
-rw-r--r--scene/3d/spatial_velocity_tracker.h2
-rw-r--r--scene/3d/sprite_3d.cpp1
-rw-r--r--scene/animation/animation_blend_space_1d.h2
-rw-r--r--scene/animation/animation_blend_space_2d.h3
-rw-r--r--scene/animation/animation_blend_tree.h5
-rw-r--r--scene/animation/animation_node_state_machine.cpp3
-rw-r--r--scene/animation/animation_node_state_machine.h3
-rw-r--r--scene/animation/animation_player.cpp44
-rw-r--r--scene/animation/animation_player.h10
-rw-r--r--scene/animation/animation_tree.h9
-rw-r--r--scene/animation/root_motion_view.h3
-rw-r--r--scene/audio/audio_stream_player.h2
-rw-r--r--scene/gui/base_button.cpp75
-rw-r--r--scene/gui/base_button.h4
-rw-r--r--scene/gui/color_picker.cpp133
-rw-r--r--scene/gui/color_picker.h10
-rw-r--r--scene/gui/color_rect.h2
-rw-r--r--scene/gui/control.cpp3
-rw-r--r--scene/gui/dialogs.cpp14
-rw-r--r--scene/gui/dialogs.h3
-rw-r--r--scene/gui/scroll_bar.cpp41
-rw-r--r--scene/gui/split_container.h2
-rw-r--r--scene/gui/tabs.cpp2
-rw-r--r--scene/gui/text_edit.cpp15
-rw-r--r--scene/gui/text_edit.h4
-rw-r--r--scene/gui/tree.cpp7
-rw-r--r--scene/main/viewport.cpp10
-rw-r--r--scene/resources/animation.cpp8
-rw-r--r--scene/resources/audio_stream_sample.h4
-rw-r--r--scene/resources/curve.cpp13
-rw-r--r--scene/resources/curve.h4
-rw-r--r--scene/resources/dynamic_font.h3
-rw-r--r--scene/resources/dynamic_font_stb.h1
-rw-r--r--scene/resources/font.h1
-rw-r--r--scene/resources/gradient.cpp13
-rw-r--r--scene/resources/material.cpp4
-rw-r--r--scene/resources/material.h4
-rw-r--r--scene/resources/particles_material.cpp1
-rw-r--r--scene/resources/particles_material.h2
-rw-r--r--scene/resources/primitive_meshes.h2
-rw-r--r--scene/resources/resource_format_text.cpp10
-rw-r--r--scene/resources/resource_format_text.h2
-rw-r--r--scene/resources/shader.h2
-rw-r--r--scene/resources/text_file.h2
-rw-r--r--scene/resources/texture.cpp1
-rw-r--r--scene/resources/texture.h20
-rw-r--r--scene/resources/tile_set.cpp30
-rw-r--r--scene/resources/visual_shader.cpp38
-rw-r--r--scene/resources/visual_shader.h19
-rw-r--r--scene/resources/visual_shader_nodes.h98
-rw-r--r--servers/audio/audio_effect.h5
-rw-r--r--servers/audio/audio_stream.h14
-rw-r--r--servers/audio/effects/audio_effect_amplify.h4
-rw-r--r--servers/audio/effects/audio_effect_chorus.h4
-rw-r--r--servers/audio/effects/audio_effect_compressor.h4
-rw-r--r--servers/audio/effects/audio_effect_delay.h4
-rw-r--r--servers/audio/effects/audio_effect_distortion.h5
-rw-r--r--servers/audio/effects/audio_effect_eq.h13
-rw-r--r--servers/audio/effects/audio_effect_filter.h23
-rw-r--r--servers/audio/effects/audio_effect_limiter.h4
-rw-r--r--servers/audio/effects/audio_effect_panner.h4
-rw-r--r--servers/audio/effects/audio_effect_phaser.h4
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.cpp42
-rw-r--r--servers/audio/effects/audio_effect_pitch_shift.h26
-rw-r--r--servers/audio/effects/audio_effect_record.h4
-rw-r--r--servers/audio/effects/audio_effect_reverb.h4
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.cpp5
-rw-r--r--servers/audio/effects/audio_effect_spectrum_analyzer.h5
-rw-r--r--servers/audio/effects/audio_effect_stereo_enhance.h4
-rw-r--r--servers/audio/effects/audio_stream_generator.h4
-rw-r--r--servers/audio_server.h5
-rw-r--r--servers/camera/camera_feed.cpp18
-rw-r--r--servers/camera/camera_feed.h4
-rw-r--r--servers/camera_server.cpp4
-rw-r--r--servers/camera_server.h4
-rw-r--r--servers/physics/area_sw.cpp2
-rw-r--r--servers/physics/body_sw.cpp3
-rw-r--r--servers/physics/gjk_epa.cpp5
-rw-r--r--servers/visual/shader_types.cpp2
372 files changed, 2960 insertions, 2115 deletions
diff --git a/.travis.yml b/.travis.yml
index 587e57c741..09d8cad07e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ env:
global:
- SCONS_CACHE=$HOME/.scons_cache
- SCONS_CACHE_LIMIT=1024
- - OPTIONS="debug_symbols=no verbose=yes progress=no"
+ - OPTIONS="debug_symbols=no verbose=yes progress=no builtin_libpng=yes"
- secure: "uch9QszCgsl1qVbuzY41P7S2hWL2IiNFV4SbAYRCdi0oJ9MIu+pVyrQdpf3+jG4rH6j4Rffl+sN17Zz4dIDDioFL1JwqyCqyCyswR8uACC0Rr8gr4Mi3+HIRbv+2s2P4cIQq41JM8FJe84k9jLEMGCGh69w+ibCWoWs74CokYVA="
cache:
@@ -39,7 +39,7 @@ matrix:
- ubuntu-toolchain-r-test
packages:
- &gcc8_deps [gcc-8, g++-8]
- - &linux_deps [libasound2-dev, libfreetype6-dev, libgl1-mesa-dev, libglu1-mesa-dev, libx11-dev, libxcursor-dev, libxi-dev, libxinerama-dev, libxrandr-dev]
+ - &linux_deps [libasound2-dev, libgl1-mesa-dev, libglu1-mesa-dev, libx11-dev, libxcursor-dev, libxi-dev, libxinerama-dev, libxrandr-dev]
- &linux_mono_deps [mono-devel, msbuild, nuget]
coverity_scan:
diff --git a/SConstruct b/SConstruct
index ce2566559c..a619ea0797 100644
--- a/SConstruct
+++ b/SConstruct
@@ -327,6 +327,8 @@ if selected_platform in platform_list:
env.Append(CCFLAGS=['/EHsc'])
if (env["werror"]):
env.Append(CCFLAGS=['/WX'])
+ # Force to use Unicode encoding
+ env.Append(MSVC_FLAGS=['/utf8'])
else: # Rest of the world
shadow_local_warning = []
all_plus_warnings = ['-Wwrite-strings']
@@ -337,14 +339,13 @@ if selected_platform in platform_list:
shadow_local_warning = ['-Wshadow-local']
if (env["warnings"] == 'extra'):
- # FIXME: enable -Wclobbered once #26351 is fixed
# Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
# once we switch to C++11 or later (necessary for our FALLTHROUGH macro).
env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-unused-parameter']
+ all_plus_warnings + shadow_local_warning)
env.Append(CXXFLAGS=['-Wctor-dtor-privacy', '-Wnon-virtual-dtor'])
if methods.using_gcc(env):
- env.Append(CCFLAGS=['-Wno-clobbered', '-Walloc-zero',
+ env.Append(CCFLAGS=['-Walloc-zero',
'-Wduplicated-branches', '-Wduplicated-cond',
'-Wstringop-overflow=4', '-Wlogical-op'])
env.Append(CXXFLAGS=['-Wnoexcept', '-Wplacement-new=1'])
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index 2751ff242c..7d0c158f51 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -694,7 +694,7 @@ VARIANT_ENUM_CAST(_Thread::Priority);
class _ClassDB : public Object {
- GDCLASS(_ClassDB, Object)
+ GDCLASS(_ClassDB, Object);
protected:
static void _bind_methods();
@@ -779,7 +779,7 @@ public:
class _JSON;
class JSONParseResult : public Reference {
- GDCLASS(JSONParseResult, Reference)
+ GDCLASS(JSONParseResult, Reference);
friend class _JSON;
@@ -807,7 +807,7 @@ public:
};
class _JSON : public Object {
- GDCLASS(_JSON, Object)
+ GDCLASS(_JSON, Object);
protected:
static void _bind_methods();
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 0c844657a4..ec07ee98e2 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -666,10 +666,8 @@ void ClassDB::bind_integer_constant(const StringName &p_class, const StringName
OBJTYPE_WLOCK;
ClassInfo *type = classes.getptr(p_class);
- if (!type) {
- ERR_FAIL_COND(!type);
- }
+ ERR_FAIL_COND(!type);
if (type->constant_map.has(p_name)) {
diff --git a/core/io/file_access_buffered.cpp b/core/io/file_access_buffered.cpp
index 83ff532aa4..93eaeb08c5 100644
--- a/core/io/file_access_buffered.cpp
+++ b/core/io/file_access_buffered.cpp
@@ -141,9 +141,7 @@ int FileAccessBuffered::get_buffer(uint8_t *p_dest, int p_length) const {
int left = cache_data_left();
if (left == 0) {
- if (to_read > 0) {
- file.offset += to_read;
- };
+ file.offset += to_read;
return total_read;
};
if (left < 0) {
diff --git a/core/io/image_loader.h b/core/io/image_loader.h
index 95c562b7a9..ae4b72a534 100644
--- a/core/io/image_loader.h
+++ b/core/io/image_loader.h
@@ -88,7 +88,6 @@ public:
};
class ResourceFormatLoaderImage : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderImage, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/core/io/ip.cpp b/core/io/ip.cpp
index 420e48f839..3d87131b51 100644
--- a/core/io/ip.cpp
+++ b/core/io/ip.cpp
@@ -234,6 +234,41 @@ Array IP::_get_local_addresses() const {
return addresses;
}
+Array IP::_get_local_interfaces() const {
+
+ Array results;
+ Map<String, Interface_Info> interfaces;
+ get_local_interfaces(&interfaces);
+ for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
+ Interface_Info &c = E->get();
+ Dictionary rc;
+ rc["name"] = c.name;
+ rc["friendly"] = c.name_friendly;
+ rc["index"] = c.index;
+
+ Array ips;
+ for (const List<IP_Address>::Element *F = c.ip_addresses.front(); F; F = F->next()) {
+ ips.push_front(F->get());
+ }
+ rc["addresses"] = ips;
+
+ results.push_front(rc);
+ }
+
+ return results;
+}
+
+void IP::get_local_addresses(List<IP_Address> *r_addresses) const {
+
+ Map<String, Interface_Info> interfaces;
+ get_local_interfaces(&interfaces);
+ for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) {
+ for (const List<IP_Address>::Element *F = E->get().ip_addresses.front(); F; F = F->next()) {
+ r_addresses->push_front(F->get());
+ }
+ }
+}
+
void IP::_bind_methods() {
ClassDB::bind_method(D_METHOD("resolve_hostname", "host", "ip_type"), &IP::resolve_hostname, DEFVAL(IP::TYPE_ANY));
@@ -242,6 +277,7 @@ void IP::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_resolve_item_address", "id"), &IP::get_resolve_item_address);
ClassDB::bind_method(D_METHOD("erase_resolve_item", "id"), &IP::erase_resolve_item);
ClassDB::bind_method(D_METHOD("get_local_addresses"), &IP::_get_local_addresses);
+ ClassDB::bind_method(D_METHOD("get_local_interfaces"), &IP::_get_local_interfaces);
ClassDB::bind_method(D_METHOD("clear_cache", "hostname"), &IP::clear_cache, DEFVAL(""));
BIND_ENUM_CONSTANT(RESOLVER_STATUS_NONE);
diff --git a/core/io/ip.h b/core/io/ip.h
index ead71ebb54..59b18ef986 100644
--- a/core/io/ip.h
+++ b/core/io/ip.h
@@ -73,16 +73,25 @@ protected:
virtual IP_Address _resolve_hostname(const String &p_hostname, Type p_type = TYPE_ANY) = 0;
Array _get_local_addresses() const;
+ Array _get_local_interfaces() const;
static IP *(*_create)();
public:
+ struct Interface_Info {
+ String name;
+ String name_friendly;
+ String index;
+ List<IP_Address> ip_addresses;
+ };
+
IP_Address resolve_hostname(const String &p_hostname, Type p_type = TYPE_ANY);
// async resolver hostname
ResolverID resolve_hostname_queue_item(const String &p_hostname, Type p_type = TYPE_ANY);
ResolverStatus get_resolve_item_status(ResolverID p_id) const;
IP_Address get_resolve_item_address(ResolverID p_id) const;
- virtual void get_local_addresses(List<IP_Address> *r_addresses) const = 0;
+ virtual void get_local_addresses(List<IP_Address> *r_addresses) const;
+ virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const = 0;
void erase_resolve_item(ResolverID p_id);
void clear_cache(const String &p_hostname = "");
diff --git a/core/io/ip_address.cpp b/core/io/ip_address.cpp
index 763a5fbb9a..9305afac5f 100644
--- a/core/io/ip_address.cpp
+++ b/core/io/ip_address.cpp
@@ -40,6 +40,9 @@ IP_Address::operator Variant() const {
IP_Address::operator String() const {
+ if (wildcard)
+ return "*";
+
if (!valid)
return "";
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index d1b6b82cf0..7494603462 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -103,10 +103,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
const uint8_t *buf = p_buffer;
int len = p_len;
- if (len < 4) {
-
- ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
- }
+ ERR_FAIL_COND_V(len < 4, ERR_INVALID_DATA);
uint32_t type = decode_uint32(buf);
diff --git a/core/io/net_socket.h b/core/io/net_socket.h
index 94e7ef6f75..3bc1369487 100644
--- a/core/io/net_socket.h
+++ b/core/io/net_socket.h
@@ -74,6 +74,8 @@ public:
virtual void set_ipv6_only_enabled(bool p_enabled) = 0;
virtual void set_tcp_no_delay_enabled(bool p_enabled) = 0;
virtual void set_reuse_address_enabled(bool p_enabled) = 0;
+ virtual Error join_multicast_group(const IP_Address &p_multi_address, String p_if_name) = 0;
+ virtual Error leave_multicast_group(const IP_Address &p_multi_address, String p_if_name) = 0;
};
#endif // NET_SOCKET_H
diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp
index 5912b8df94..7e9471c053 100644
--- a/core/io/packet_peer_udp.cpp
+++ b/core/io/packet_peer_udp.cpp
@@ -37,6 +37,27 @@ void PacketPeerUDP::set_blocking_mode(bool p_enable) {
blocking = p_enable;
}
+Error PacketPeerUDP::join_multicast_group(IP_Address p_multi_address, String p_if_name) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(!p_multi_address.is_valid(), ERR_INVALID_PARAMETER);
+
+ if (!_sock->is_open()) {
+ IP::Type ip_type = p_multi_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
+ Error err = _sock->open(NetSocket::TYPE_UDP, ip_type);
+ ERR_FAIL_COND_V(err != OK, err);
+ _sock->set_blocking_enabled(false);
+ }
+ return _sock->join_multicast_group(p_multi_address, p_if_name);
+}
+
+Error PacketPeerUDP::leave_multicast_group(IP_Address p_multi_address, String p_if_name) {
+
+ ERR_FAIL_COND_V(!_sock.is_valid(), ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(!_sock->is_open(), ERR_UNCONFIGURED);
+ return _sock->leave_multicast_group(p_multi_address, p_if_name);
+}
+
String PacketPeerUDP::_get_packet_ip() const {
return get_packet_address();
@@ -237,6 +258,8 @@ void PacketPeerUDP::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_packet_ip"), &PacketPeerUDP::_get_packet_ip);
ClassDB::bind_method(D_METHOD("get_packet_port"), &PacketPeerUDP::get_packet_port);
ClassDB::bind_method(D_METHOD("set_dest_address", "host", "port"), &PacketPeerUDP::_set_dest_address);
+ ClassDB::bind_method(D_METHOD("join_multicast_group", "multicast_address", "interface_name"), &PacketPeerUDP::join_multicast_group);
+ ClassDB::bind_method(D_METHOD("leave_multicast_group", "multicast_address", "interface_name"), &PacketPeerUDP::leave_multicast_group);
}
PacketPeerUDP::PacketPeerUDP() :
diff --git a/core/io/packet_peer_udp.h b/core/io/packet_peer_udp.h
index 0593137604..068bd5cd5a 100644
--- a/core/io/packet_peer_udp.h
+++ b/core/io/packet_peer_udp.h
@@ -77,6 +77,8 @@ public:
Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
int get_available_packet_count() const;
int get_max_packet_size() const;
+ Error join_multicast_group(IP_Address p_multi_address, String p_if_name);
+ Error leave_multicast_group(IP_Address p_multi_address, String p_if_name);
PacketPeerUDP();
~PacketPeerUDP();
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index f25abc4aab..aef2dcfff3 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -991,10 +991,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderBinary::load_interactive(cons
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err != OK) {
-
- ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
- }
+ ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
String path = p_original_path != "" ? p_original_path : p_path;
@@ -1129,9 +1126,8 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons
Error err;
f = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err != OK) {
- ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
- }
+
+ ERR_FAIL_COND_V(err != OK, ERR_FILE_CANT_OPEN);
Ref<ResourceInteractiveLoaderBinary> ria = memnew(ResourceInteractiveLoaderBinary);
ria->local_path = ProjectSettings::get_singleton()->localize_path(p_path);
diff --git a/core/io/resource_format_binary.h b/core/io/resource_format_binary.h
index a4894e4033..27777c8e8b 100644
--- a/core/io/resource_format_binary.h
+++ b/core/io/resource_format_binary.h
@@ -100,7 +100,6 @@ public:
};
class ResourceFormatLoaderBinary : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderBinary, ResourceFormatLoader)
public:
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions_for_type(const String &p_type, List<String> *p_extensions) const;
@@ -162,7 +161,6 @@ public:
};
class ResourceFormatSaverBinary : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverBinary, ResourceFormatSaver)
public:
static ResourceFormatSaverBinary *singleton;
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h
index 2e01989564..9cf298a7f5 100644
--- a/core/io/resource_importer.h
+++ b/core/io/resource_importer.h
@@ -37,8 +37,6 @@ class ResourceImporter;
class ResourceFormatImporter : public ResourceFormatLoader {
- GDCLASS(ResourceFormatImporter, ResourceFormatLoader)
-
struct PathAndType {
String path;
String type;
@@ -96,7 +94,8 @@ public:
class ResourceImporter : public Reference {
- GDCLASS(ResourceImporter, Reference)
+ GDCLASS(ResourceImporter, Reference);
+
public:
virtual String get_importer_name() const = 0;
virtual String get_visible_name() const = 0;
diff --git a/core/io/resource_loader.h b/core/io/resource_loader.h
index 9e7020be7c..70e7bdc224 100644
--- a/core/io/resource_loader.h
+++ b/core/io/resource_loader.h
@@ -62,7 +62,7 @@ public:
class ResourceFormatLoader : public Reference {
- GDCLASS(ResourceFormatLoader, Reference)
+ GDCLASS(ResourceFormatLoader, Reference);
protected:
static void _bind_methods();
diff --git a/core/io/resource_saver.h b/core/io/resource_saver.h
index 7df3bfb1f8..0fba47a5e8 100644
--- a/core/io/resource_saver.h
+++ b/core/io/resource_saver.h
@@ -38,7 +38,7 @@
*/
class ResourceFormatSaver : public Reference {
- GDCLASS(ResourceFormatSaver, Reference)
+ GDCLASS(ResourceFormatSaver, Reference);
protected:
static void _bind_methods();
diff --git a/core/io/translation_loader_po.h b/core/io/translation_loader_po.h
index d5fd264385..9d9c5d16ee 100644
--- a/core/io/translation_loader_po.h
+++ b/core/io/translation_loader_po.h
@@ -36,7 +36,6 @@
#include "core/translation.h"
class TranslationLoaderPO : public ResourceFormatLoader {
- GDCLASS(TranslationLoaderPO, ResourceFormatLoader)
public:
static RES load_translation(FileAccess *f, Error *r_error, const String &p_path = String());
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp
index f55af5a96a..82527d3f38 100644
--- a/core/io/xml_parser.cpp
+++ b/core/io/xml_parser.cpp
@@ -486,9 +486,7 @@ Error XMLParser::open(const String &p_path) {
Error err;
FileAccess *file = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err) {
- ERR_FAIL_COND_V(err != OK, err);
- }
+ ERR_FAIL_COND_V(err != OK, err);
length = file->get_len();
ERR_FAIL_COND_V(length < 1, ERR_FILE_CORRUPT);
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 0b6e9ae929..7ce3824505 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -435,10 +435,16 @@ PoolVector<int> AStar::get_id_path(int p_from_id, int p_to_id) {
}
void AStar::set_point_disabled(int p_id, bool p_disabled) {
+
+ ERR_FAIL_COND(!points.has(p_id));
+
points[p_id]->enabled = !p_disabled;
}
bool AStar::is_point_disabled(int p_id) const {
+
+ ERR_FAIL_COND_V(!points.has(p_id), false);
+
return !points[p_id]->enabled;
}
@@ -452,13 +458,12 @@ void AStar::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_point_weight_scale", "id", "weight_scale"), &AStar::set_point_weight_scale);
ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar::remove_point);
ClassDB::bind_method(D_METHOD("has_point", "id"), &AStar::has_point);
+ ClassDB::bind_method(D_METHOD("get_point_connections", "id"), &AStar::get_point_connections);
ClassDB::bind_method(D_METHOD("get_points"), &AStar::get_points);
ClassDB::bind_method(D_METHOD("set_point_disabled", "id", "disabled"), &AStar::set_point_disabled, DEFVAL(true));
ClassDB::bind_method(D_METHOD("is_point_disabled", "id"), &AStar::is_point_disabled);
- ClassDB::bind_method(D_METHOD("get_point_connections", "id"), &AStar::get_point_connections);
-
ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar::connect_points, DEFVAL(true));
ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar::disconnect_points);
ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar::are_points_connected);
@@ -485,3 +490,135 @@ AStar::~AStar() {
pass = 1;
clear();
}
+
+/////////////////////////////////////////////////////////////
+
+int AStar2D::get_available_point_id() const {
+ return astar.get_available_point_id();
+}
+
+void AStar2D::add_point(int p_id, const Vector2 &p_pos, real_t p_weight_scale) {
+ astar.add_point(p_id, Vector3(p_pos.x, p_pos.y, 0), p_weight_scale);
+}
+
+Vector2 AStar2D::get_point_position(int p_id) const {
+ Vector3 p = astar.get_point_position(p_id);
+ return Vector2(p.x, p.y);
+}
+
+void AStar2D::set_point_position(int p_id, const Vector2 &p_pos) {
+ astar.set_point_position(p_id, Vector3(p_pos.x, p_pos.y, 0));
+}
+
+real_t AStar2D::get_point_weight_scale(int p_id) const {
+ return astar.get_point_weight_scale(p_id);
+}
+
+void AStar2D::set_point_weight_scale(int p_id, real_t p_weight_scale) {
+ astar.set_point_weight_scale(p_id, p_weight_scale);
+}
+
+void AStar2D::remove_point(int p_id) {
+ astar.remove_point(p_id);
+}
+
+bool AStar2D::has_point(int p_id) const {
+ return astar.has_point(p_id);
+}
+
+PoolVector<int> AStar2D::get_point_connections(int p_id) {
+ return astar.get_point_connections(p_id);
+}
+
+Array AStar2D::get_points() {
+ return astar.get_points();
+}
+
+void AStar2D::set_point_disabled(int p_id, bool p_disabled) {
+ astar.set_point_disabled(p_id, p_disabled);
+}
+
+bool AStar2D::is_point_disabled(int p_id) const {
+ return astar.is_point_disabled(p_id);
+}
+
+void AStar2D::connect_points(int p_id, int p_with_id, bool p_bidirectional) {
+ astar.connect_points(p_id, p_with_id, p_bidirectional);
+}
+
+void AStar2D::disconnect_points(int p_id, int p_with_id) {
+ astar.disconnect_points(p_id, p_with_id);
+}
+
+bool AStar2D::are_points_connected(int p_id, int p_with_id) const {
+ return astar.are_points_connected(p_id, p_with_id);
+}
+
+void AStar2D::clear() {
+ astar.clear();
+}
+
+int AStar2D::get_closest_point(const Vector2 &p_point) const {
+ return astar.get_closest_point(Vector3(p_point.x, p_point.y, 0));
+}
+
+Vector2 AStar2D::get_closest_position_in_segment(const Vector2 &p_point) const {
+ Vector3 p = astar.get_closest_position_in_segment(Vector3(p_point.x, p_point.y, 0));
+ return Vector2(p.x, p.y);
+}
+
+PoolVector<Vector2> AStar2D::get_point_path(int p_from_id, int p_to_id) {
+
+ PoolVector3Array pv = astar.get_point_path(p_from_id, p_to_id);
+ int size = pv.size();
+ PoolVector2Array path;
+ path.resize(size);
+ {
+ PoolVector<Vector3>::Read r = pv.read();
+ PoolVector<Vector2>::Write w = path.write();
+ for (int i = 0; i < size; i++) {
+ Vector3 p = r[i];
+ w[i] = Vector2(p.x, p.y);
+ }
+ }
+ return path;
+}
+
+PoolVector<int> AStar2D::get_id_path(int p_from_id, int p_to_id) {
+ return astar.get_id_path(p_from_id, p_to_id);
+}
+
+void AStar2D::_bind_methods() {
+
+ ClassDB::bind_method(D_METHOD("get_available_point_id"), &AStar2D::get_available_point_id);
+ ClassDB::bind_method(D_METHOD("add_point", "id", "position", "weight_scale"), &AStar2D::add_point, DEFVAL(1.0));
+ ClassDB::bind_method(D_METHOD("get_point_position", "id"), &AStar2D::get_point_position);
+ ClassDB::bind_method(D_METHOD("set_point_position", "id", "position"), &AStar2D::set_point_position);
+ ClassDB::bind_method(D_METHOD("get_point_weight_scale", "id"), &AStar2D::get_point_weight_scale);
+ ClassDB::bind_method(D_METHOD("set_point_weight_scale", "id", "weight_scale"), &AStar2D::set_point_weight_scale);
+ ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar2D::remove_point);
+ ClassDB::bind_method(D_METHOD("has_point", "id"), &AStar2D::has_point);
+ ClassDB::bind_method(D_METHOD("get_point_connections", "id"), &AStar2D::get_point_connections);
+ ClassDB::bind_method(D_METHOD("get_points"), &AStar2D::get_points);
+
+ ClassDB::bind_method(D_METHOD("set_point_disabled", "id", "disabled"), &AStar2D::set_point_disabled, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("is_point_disabled", "id"), &AStar2D::is_point_disabled);
+
+ ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar2D::connect_points, DEFVAL(true));
+ ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar2D::disconnect_points);
+ ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar2D::are_points_connected);
+
+ ClassDB::bind_method(D_METHOD("clear"), &AStar2D::clear);
+
+ ClassDB::bind_method(D_METHOD("get_closest_point", "to_position"), &AStar2D::get_closest_point);
+ ClassDB::bind_method(D_METHOD("get_closest_position_in_segment", "to_position"), &AStar2D::get_closest_position_in_segment);
+
+ ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar2D::get_point_path);
+ ClassDB::bind_method(D_METHOD("get_id_path", "from_id", "to_id"), &AStar2D::get_id_path);
+}
+
+AStar2D::AStar2D() {
+}
+
+AStar2D::~AStar2D() {
+}
diff --git a/core/math/a_star.h b/core/math/a_star.h
index ba35d929b3..ec333efc1d 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -42,7 +42,7 @@
class AStar : public Reference {
- GDCLASS(AStar, Reference)
+ GDCLASS(AStar, Reference);
uint64_t pass;
@@ -143,4 +143,43 @@ public:
~AStar();
};
+class AStar2D : public Reference {
+ GDCLASS(AStar2D, Reference);
+ AStar astar;
+
+protected:
+ static void _bind_methods();
+
+public:
+ int get_available_point_id() const;
+
+ void add_point(int p_id, const Vector2 &p_pos, real_t p_weight_scale = 1);
+ Vector2 get_point_position(int p_id) const;
+ void set_point_position(int p_id, const Vector2 &p_pos);
+ real_t get_point_weight_scale(int p_id) const;
+ void set_point_weight_scale(int p_id, real_t p_weight_scale);
+ void remove_point(int p_id);
+ bool has_point(int p_id) const;
+ PoolVector<int> get_point_connections(int p_id);
+ Array get_points();
+
+ void set_point_disabled(int p_id, bool p_disabled = true);
+ bool is_point_disabled(int p_id) const;
+
+ void connect_points(int p_id, int p_with_id, bool p_bidirectional = true);
+ void disconnect_points(int p_id, int p_with_id);
+ bool are_points_connected(int p_id, int p_with_id) const;
+
+ void clear();
+
+ int get_closest_point(const Vector2 &p_point) const;
+ Vector2 get_closest_position_in_segment(const Vector2 &p_point) const;
+
+ PoolVector<Vector2> get_point_path(int p_from_id, int p_to_id);
+ PoolVector<int> get_id_path(int p_from_id, int p_to_id);
+
+ AStar2D();
+ ~AStar2D();
+};
+
#endif // ASTAR_H
diff --git a/core/math/expression.h b/core/math/expression.h
index 79f6f3989d..1113bb6587 100644
--- a/core/math/expression.h
+++ b/core/math/expression.h
@@ -34,7 +34,8 @@
#include "core/reference.h"
class Expression : public Reference {
- GDCLASS(Expression, Reference)
+ GDCLASS(Expression, Reference);
+
public:
enum BuiltinFunc {
MATH_SIN,
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 079f51bada..913caf6584 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -600,9 +600,8 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_err
if (!f) {
if (r_error) { // if error requested, do not throw error
return Vector<uint8_t>();
- } else {
- ERR_FAIL_COND_V(!f, Vector<uint8_t>());
}
+ ERR_FAIL_COND_V(!f, Vector<uint8_t>());
}
Vector<uint8_t> data;
data.resize(f->get_len());
@@ -621,9 +620,8 @@ String FileAccess::get_file_as_string(const String &p_path, Error *r_error) {
if (err != OK) {
if (r_error) {
return String();
- } else {
- ERR_FAIL_COND_V(err != OK, String());
}
+ ERR_FAIL_COND_V(err != OK, String());
}
String ret;
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 2eb321f134..4f5762e756 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -173,7 +173,7 @@ enum MidiMessageList {
*/
class InputEvent : public Resource {
- GDCLASS(InputEvent, Resource)
+ GDCLASS(InputEvent, Resource);
int device;
@@ -210,7 +210,7 @@ public:
};
class InputEventWithModifiers : public InputEvent {
- GDCLASS(InputEventWithModifiers, InputEvent)
+ GDCLASS(InputEventWithModifiers, InputEvent);
bool shift;
bool alt;
@@ -256,7 +256,7 @@ public:
class InputEventKey : public InputEventWithModifiers {
- GDCLASS(InputEventKey, InputEventWithModifiers)
+ GDCLASS(InputEventKey, InputEventWithModifiers);
bool pressed; /// otherwise release
@@ -295,7 +295,7 @@ public:
class InputEventMouse : public InputEventWithModifiers {
- GDCLASS(InputEventMouse, InputEventWithModifiers)
+ GDCLASS(InputEventMouse, InputEventWithModifiers);
int button_mask;
@@ -320,7 +320,7 @@ public:
class InputEventMouseButton : public InputEventMouse {
- GDCLASS(InputEventMouseButton, InputEventMouse)
+ GDCLASS(InputEventMouseButton, InputEventMouse);
float factor;
int button_index;
@@ -354,7 +354,7 @@ public:
class InputEventMouseMotion : public InputEventMouse {
- GDCLASS(InputEventMouseMotion, InputEventMouse)
+ GDCLASS(InputEventMouseMotion, InputEventMouse);
Vector2 relative;
Vector2 speed;
@@ -378,7 +378,7 @@ public:
class InputEventJoypadMotion : public InputEvent {
- GDCLASS(InputEventJoypadMotion, InputEvent)
+ GDCLASS(InputEventJoypadMotion, InputEvent);
int axis; ///< Joypad axis
float axis_value; ///< -1 to 1
@@ -403,7 +403,7 @@ public:
};
class InputEventJoypadButton : public InputEvent {
- GDCLASS(InputEventJoypadButton, InputEvent)
+ GDCLASS(InputEventJoypadButton, InputEvent);
int button_index;
bool pressed;
@@ -431,7 +431,7 @@ public:
};
class InputEventScreenTouch : public InputEvent {
- GDCLASS(InputEventScreenTouch, InputEvent)
+ GDCLASS(InputEventScreenTouch, InputEvent);
int index;
Vector2 pos;
bool pressed;
@@ -457,7 +457,7 @@ public:
class InputEventScreenDrag : public InputEvent {
- GDCLASS(InputEventScreenDrag, InputEvent)
+ GDCLASS(InputEventScreenDrag, InputEvent);
int index;
Vector2 pos;
Vector2 relative;
@@ -487,7 +487,7 @@ public:
class InputEventAction : public InputEvent {
- GDCLASS(InputEventAction, InputEvent)
+ GDCLASS(InputEventAction, InputEvent);
StringName action;
bool pressed;
@@ -519,7 +519,7 @@ public:
class InputEventGesture : public InputEventWithModifiers {
- GDCLASS(InputEventGesture, InputEventWithModifiers)
+ GDCLASS(InputEventGesture, InputEventWithModifiers);
Vector2 pos;
@@ -533,7 +533,7 @@ public:
class InputEventMagnifyGesture : public InputEventGesture {
- GDCLASS(InputEventMagnifyGesture, InputEventGesture)
+ GDCLASS(InputEventMagnifyGesture, InputEventGesture);
real_t factor;
protected:
@@ -551,7 +551,7 @@ public:
class InputEventPanGesture : public InputEventGesture {
- GDCLASS(InputEventPanGesture, InputEventGesture)
+ GDCLASS(InputEventPanGesture, InputEventGesture);
Vector2 delta;
protected:
@@ -568,7 +568,7 @@ public:
};
class InputEventMIDI : public InputEvent {
- GDCLASS(InputEventMIDI, InputEvent)
+ GDCLASS(InputEventMIDI, InputEvent);
int channel;
int message;
diff --git a/core/os/os.h b/core/os/os.h
index 514e1e2ad3..1b19ddff26 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -222,6 +222,8 @@ public:
virtual bool is_window_maximized() const { return true; }
virtual void set_window_always_on_top(bool p_enabled) {}
virtual bool is_window_always_on_top() const { return false; }
+ virtual void set_console_visible(bool p_enabled) {}
+ virtual bool is_console_visible() const { return false; }
virtual void request_attention() {}
virtual void center_window();
diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp
index a283d8db1d..11a3be89bd 100644
--- a/core/pool_allocator.cpp
+++ b/core/pool_allocator.cpp
@@ -500,9 +500,7 @@ void *PoolAllocator::get(ID p_mem) {
if (!needs_locking) {
Entry *e = get_entry(p_mem);
- if (!e) {
- ERR_FAIL_COND_V(!e, NULL);
- };
+ ERR_FAIL_COND_V(!e, NULL);
return &pool[e->pos];
}
diff --git a/core/pool_vector.h b/core/pool_vector.h
index 102a620f17..338de966f6 100644
--- a/core/pool_vector.h
+++ b/core/pool_vector.h
@@ -411,8 +411,8 @@ public:
p_to = size() + p_to;
}
- CRASH_BAD_INDEX(p_from, size());
- CRASH_BAD_INDEX(p_to, size());
+ ERR_FAIL_INDEX_V(p_from, size(), PoolVector<T>());
+ ERR_FAIL_INDEX_V(p_to, size(), PoolVector<T>());
PoolVector<T> slice;
int span = 1 + p_to - p_from;
@@ -511,6 +511,8 @@ const T PoolVector<T>::operator[](int p_index) const {
template <class T>
Error PoolVector<T>::resize(int p_size) {
+ ERR_FAIL_COND_V(p_size < 0, ERR_INVALID_PARAMETER);
+
if (alloc == NULL) {
if (p_size == 0)
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index 97c96b4018..135df4e5bd 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -184,6 +184,7 @@ void register_core_types() {
ClassDB::register_class<PackedDataContainer>();
ClassDB::register_virtual_class<PackedDataContainerRef>();
ClassDB::register_class<AStar>();
+ ClassDB::register_class<AStar2D>();
ClassDB::register_class<EncodedObjectAsID>();
ClassDB::register_class<RandomNumberGenerator>();
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 35b817b1d2..686aa6f8e3 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -2331,6 +2331,9 @@ String String::insert(int p_at_pos, const String &p_string) const {
}
String String::substr(int p_from, int p_chars) const {
+ if (p_chars == -1)
+ p_chars = length() - p_from;
+
if (empty() || p_from < 0 || p_from >= length() || p_chars <= 0)
return "";
diff --git a/core/ustring.h b/core/ustring.h
index 5b9be9f27c..ecf934a26b 100644
--- a/core/ustring.h
+++ b/core/ustring.h
@@ -201,7 +201,7 @@ public:
}
/* complex helpers */
- String substr(int p_from, int p_chars) const;
+ String substr(int p_from, int p_chars = -1) const;
int find(const String &p_str, int p_from = 0) const; ///< return <0 if failed
int find(const char *p_str, int p_from = 0) const; ///< return <0 if failed
int find_char(const CharType &p_char, int p_from = 0) const; ///< return <0 if failed
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index b3a4a13b08..dc28f1ca02 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -285,6 +285,8 @@ struct _VariantCall {
VCALL_LOCALMEM0R(String, get_file);
VCALL_LOCALMEM0R(String, xml_escape);
VCALL_LOCALMEM0R(String, xml_unescape);
+ VCALL_LOCALMEM0R(String, http_escape);
+ VCALL_LOCALMEM0R(String, http_unescape);
VCALL_LOCALMEM0R(String, c_escape);
VCALL_LOCALMEM0R(String, c_unescape);
VCALL_LOCALMEM0R(String, json_escape);
@@ -1497,7 +1499,7 @@ void register_variant_methods() {
ADDFUNC1R(STRING, INT, String, casecmp_to, STRING, "to", varray());
ADDFUNC1R(STRING, INT, String, nocasecmp_to, STRING, "to", varray());
ADDFUNC0R(STRING, INT, String, length, varray());
- ADDFUNC2R(STRING, STRING, String, substr, INT, "from", INT, "len", varray());
+ ADDFUNC2R(STRING, STRING, String, substr, INT, "from", INT, "len", varray(-1));
ADDFUNC2R(STRING, INT, String, find, STRING, "what", INT, "from", varray(0));
@@ -1550,6 +1552,8 @@ void register_variant_methods() {
ADDFUNC0R(STRING, STRING, String, get_file, varray());
ADDFUNC0R(STRING, STRING, String, xml_escape, varray());
ADDFUNC0R(STRING, STRING, String, xml_unescape, varray());
+ ADDFUNC0R(STRING, STRING, String, http_escape, varray());
+ ADDFUNC0R(STRING, STRING, String, http_unescape, varray());
ADDFUNC0R(STRING, STRING, String, c_escape, varray());
ADDFUNC0R(STRING, STRING, String, c_unescape, varray());
ADDFUNC0R(STRING, STRING, String, json_escape, varray());
diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml
index 16ceb293ad..81722535c2 100644
--- a/doc/classes/AStar.xml
+++ b/doc/classes/AStar.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AStar" inherits="Reference" category="Core" version="3.2">
<brief_description>
- AStar class representation that uses vectors as edges.
+ AStar class representation that uses 3d-vectors as edges.
</brief_description>
<description>
A* (A star) is a computer algorithm that is widely used in pathfinding and graph traversal, the process of plotting an efficiently directed path between multiple points. It enjoys widespread use due to its performance and accuracy. Godot's A* implementation make use of vectors as points.
diff --git a/doc/classes/AStar2D.xml b/doc/classes/AStar2D.xml
new file mode 100644
index 0000000000..b86e53d4d4
--- /dev/null
+++ b/doc/classes/AStar2D.xml
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="AStar2D" inherits="Reference" category="Core" version="3.2">
+ <brief_description>
+ AStar class representation that uses 2d-vectors as edges.
+ </brief_description>
+ <description>
+ This is a wrapper for the [AStar] class which uses 2D vectors instead of 3D vectors.
+ </description>
+ <tutorials>
+ </tutorials>
+ <methods>
+ <method name="add_point">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="position" type="Vector2">
+ </argument>
+ <argument index="2" name="weight_scale" type="float" default="1.0">
+ </argument>
+ <description>
+ Adds a new point at the given position with the given identifier. The algorithm prefers points with lower [code]weight_scale[/code] to form a path. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 1 or larger.
+ [codeblock]
+ var as = AStar2D.new()
+ as.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1
+ [/codeblock]
+ If there already exists a point for the given id, its position and weight scale are updated to the given values.
+ </description>
+ </method>
+ <method name="are_points_connected" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="to_id" type="int">
+ </argument>
+ <description>
+ Returns whether there is a connection/segment between the given points.
+ </description>
+ </method>
+ <method name="clear">
+ <return type="void">
+ </return>
+ <description>
+ Clears all the points and segments.
+ </description>
+ </method>
+ <method name="connect_points">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="to_id" type="int">
+ </argument>
+ <argument index="2" name="bidirectional" type="bool" default="true">
+ </argument>
+ <description>
+ Creates a segment between the given points. If [code]bidirectional[/code] is [code]false[/code], only movement from [code]id[/code] to [code]to_id[/code] is allowed, not the reverse direction.
+ [codeblock]
+ var as = AStar2D.new()
+ as.add_point(1, Vector2(1, 1))
+ as.add_point(2, Vector2(0, 5))
+ as.connect_points(1, 2, false)
+ [/codeblock]
+ </description>
+ </method>
+ <method name="disconnect_points">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="to_id" type="int">
+ </argument>
+ <description>
+ Deletes the segment between the given points.
+ </description>
+ </method>
+ <method name="get_available_point_id" qualifiers="const">
+ <return type="int">
+ </return>
+ <description>
+ Returns the next available point id with no point associated to it.
+ </description>
+ </method>
+ <method name="get_closest_point" qualifiers="const">
+ <return type="int">
+ </return>
+ <argument index="0" name="to_position" type="Vector2">
+ </argument>
+ <description>
+ Returns the id of the closest point to [code]to_position[/code]. Returns -1 if there are no points in the points pool.
+ </description>
+ </method>
+ <method name="get_closest_position_in_segment" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="to_position" type="Vector2">
+ </argument>
+ <description>
+ Returns the closest position to [code]to_position[/code] that resides inside a segment between two connected points.
+ [codeblock]
+ var as = AStar2D.new()
+ as.add_point(1, Vector2(0, 0))
+ as.add_point(2, Vector2(0, 5))
+ as.connect_points(1, 2)
+ var res = as.get_closest_position_in_segment(Vector2(3, 3)) # returns (0, 3)
+ [/codeblock]
+ The result is in the segment that goes from [code]y = 0[/code] to [code]y = 5[/code]. It's the closest position in the segment to the given point.
+ </description>
+ </method>
+ <method name="get_id_path">
+ <return type="PoolIntArray">
+ </return>
+ <argument index="0" name="from_id" type="int">
+ </argument>
+ <argument index="1" name="to_id" type="int">
+ </argument>
+ <description>
+ Returns an array with the ids of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
+ [codeblock]
+ var as = AStar2D.new()
+ as.add_point(1, Vector2(0, 0))
+ as.add_point(2, Vector2(0, 1), 1) # default weight is 1
+ as.add_point(3, Vector2(1, 1))
+ as.add_point(4, Vector2(2, 0))
+
+ as.connect_points(1, 2, false)
+ as.connect_points(2, 3, false)
+ as.connect_points(4, 3, false)
+ as.connect_points(1, 4, false)
+ as.connect_points(5, 4, false)
+
+ var res = as.get_id_path(1, 3) # returns [1, 2, 3]
+ [/codeblock]
+ If you change the 2nd point's weight to 3, then the result will be [code][1, 4, 3][/code] instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
+ </description>
+ </method>
+ <method name="get_point_connections">
+ <return type="PoolIntArray">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns an array with the ids of the points that form the connect with the given point.
+ [codeblock]
+ var as = AStar2D.new()
+ as.add_point(1, Vector2(0, 0))
+ as.add_point(2, Vector2(0, 1))
+ as.add_point(3, Vector2(1, 1))
+ as.add_point(4, Vector2(2, 0))
+
+ as.connect_points(1, 2, true)
+ as.connect_points(1, 3, true)
+
+ var neighbors = as.get_point_connections(1) # returns [2, 3]
+ [/codeblock]
+ </description>
+ </method>
+ <method name="get_point_path">
+ <return type="PoolVector2Array">
+ </return>
+ <argument index="0" name="from_id" type="int">
+ </argument>
+ <argument index="1" name="to_id" type="int">
+ </argument>
+ <description>
+ Returns an array with the points that are in the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
+ </description>
+ </method>
+ <method name="get_point_position" qualifiers="const">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns the position of the point associated with the given id.
+ </description>
+ </method>
+ <method name="get_point_weight_scale" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns the weight scale of the point associated with the given id.
+ </description>
+ </method>
+ <method name="get_points">
+ <return type="Array">
+ </return>
+ <description>
+ Returns an array of all points.
+ </description>
+ </method>
+ <method name="has_point" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns whether a point associated with the given id exists.
+ </description>
+ </method>
+ <method name="is_point_disabled" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Returns whether a point is disabled or not for pathfinding. By default, all points are enabled.
+ </description>
+ </method>
+ <method name="remove_point">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <description>
+ Removes the point associated with the given id from the points pool.
+ </description>
+ </method>
+ <method name="set_point_disabled">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="disabled" type="bool" default="true">
+ </argument>
+ <description>
+ Disables or enables the specified point for pathfinding. Useful for making a temporary obstacle.
+ </description>
+ </method>
+ <method name="set_point_position">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="position" type="Vector2">
+ </argument>
+ <description>
+ Sets the position for the point with the given id.
+ </description>
+ </method>
+ <method name="set_point_weight_scale">
+ <return type="void">
+ </return>
+ <argument index="0" name="id" type="int">
+ </argument>
+ <argument index="1" name="weight_scale" type="float">
+ </argument>
+ <description>
+ Sets the [code]weight_scale[/code] for the point with the given id.
+ </description>
+ </method>
+ </methods>
+ <constants>
+ </constants>
+</class>
diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index db35b2f352..3ea280cba3 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -57,12 +57,15 @@
</method>
</methods>
<members>
+ <member name="dialog_autowrap" type="bool" setter="set_autowrap" getter="has_autowrap">
+ Sets autowrapping for the text in the dialog.
+ </member>
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok">
If [code]true[/code], the dialog is hidden when the OK button is pressed. You can set it to [code]false[/code] if you want to do e.g. input validation when receiving the [signal confirmed] signal, and handle hiding the dialog in your own logic. Default value: [code]true[/code].
Note: Some nodes derived from this class can have a different default value, and potentially their own built-in logic overriding this setting. For example [FileDialog] defaults to [code]false[/code], and has its own input validation code that is called when you press OK, which eventually hides the dialog if the input is valid. As such this property can't be used in [FileDialog] to disable hiding the dialog when pressing OK.
</member>
<member name="dialog_text" type="String" setter="set_text" getter="get_text">
- The text displayed by this dialog.
+ The text displayed by the dialog.
</member>
</members>
<signals>
diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml
index 5ea993f83d..ff91db2e28 100644
--- a/doc/classes/AnimationPlayer.xml
+++ b/doc/classes/AnimationPlayer.xml
@@ -238,6 +238,9 @@
<member name="current_animation_position" type="float" setter="" getter="get_current_animation_position">
The position (in seconds) of the currently playing animation.
</member>
+ <member name="method_call_mode" type="int" setter="set_method_call_mode" getter="get_method_call_mode" enum="AnimationPlayer.AnimationMethodCallMode">
+ The call mode to use for Call Method tracks. Default value: [code]ANIMATION_METHOD_CALL_DEFERRED[/code].
+ </member>
<member name="playback_active" type="bool" setter="set_active" getter="is_active">
If [code]true[/code], updates animations in response to process-related notifications. Default value: [code]true[/code].
</member>
@@ -293,5 +296,11 @@
<constant name="ANIMATION_PROCESS_MANUAL" value="2" enum="AnimationProcessMode">
Do not process animation. Use the 'advance' method to process the animation manually.
</constant>
+ <constant name="ANIMATION_METHOD_CALL_DEFERRED" value="0" enum="AnimationMethodCallMode">
+ Batch method calls during the animation process, then do the calls after events are processed. This avoids bugs involving deleting nodes or modifying the AnimationPlayer while playing.
+ </constant>
+ <constant name="ANIMATION_METHOD_CALL_IMMEDIATE" value="1" enum="AnimationMethodCallMode">
+ Make method calls immediately when reached in the animation.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/Area.xml b/doc/classes/Area.xml
index c39c570be9..d40376414f 100644
--- a/doc/classes/Area.xml
+++ b/doc/classes/Area.xml
@@ -56,7 +56,8 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- If [code]true[/code], the given body overlaps the Area. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+ If [code]true[/code], the given physics body overlaps the Area. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+ The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</method>
<method name="set_collision_layer_bit">
@@ -183,14 +184,16 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- Emitted when a [PhysicsBody] object enters.
+ Emitted when a physics body enters.
+ The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_exited">
<argument index="0" name="body" type="Node">
</argument>
<description>
- Emitted when a [PhysicsBody] object exits.
+ Emitted when a physics body exits.
+ The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_shape_entered">
@@ -203,7 +206,8 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- Emitted when a [PhysicsBody] object enters, reporting which shapes overlapped.
+ Emitted when a physics body enters, reporting which shapes overlapped.
+ The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_shape_exited">
@@ -216,7 +220,8 @@
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- Emitted when a [PhysicsBody] object exits, reporting which shapes were overlapping.
+ Emitted when a physics body exits, reporting which shapes were overlapping.
+ The [code]body[/code] argument can either be a [PhysicsBody] or a [GridMap] instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
</signals>
diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml
index 8d28ddc889..4771a976b5 100644
--- a/doc/classes/Area2D.xml
+++ b/doc/classes/Area2D.xml
@@ -56,7 +56,8 @@
<argument index="0" name="body" type="Node">
</argument>
<description>
- If [code]true[/code], the given body overlaps the Area2D. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+ If [code]true[/code], the given physics body overlaps the Area2D. Note that the result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+ The [code]body[/code] argument can either be a [PhysicsBody2D] or a [TileMap] instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</method>
<method name="set_collision_layer_bit">
@@ -168,43 +169,47 @@
</description>
</signal>
<signal name="body_entered">
- <argument index="0" name="body" type="PhysicsBody2D">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object enters.
+ Emitted when a physics body enters.
+ The [code]body[/code] argument can either be a [PhysicsBody2D] or a [TileMap] instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_exited">
- <argument index="0" name="body" type="PhysicsBody2D">
+ <argument index="0" name="body" type="Node">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object exits.
+ Emitted when a physics body exits.
+ The [code]body[/code] argument can either be a [PhysicsBody2D] or a [TileMap] instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_shape_entered">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="PhysicsBody2D">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object enters, reporting which shapes overlapped.
+ Emitted when a physics body enters, reporting which shapes overlapped.
+ The [code]body[/code] argument can either be a [PhysicsBody2D] or a [TileMap] instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
<signal name="body_shape_exited">
<argument index="0" name="body_id" type="int">
</argument>
- <argument index="1" name="body" type="PhysicsBody2D">
+ <argument index="1" name="body" type="Node">
</argument>
<argument index="2" name="body_shape" type="int">
</argument>
<argument index="3" name="area_shape" type="int">
</argument>
<description>
- Emitted when a [PhysicsBody2D] object exits, reporting which shapes were overlapping.
+ Emitted when a physics body exits, reporting which shapes were overlapping.
+ The [code]body[/code] argument can either be a [PhysicsBody2D] or a [TileMap] instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
</description>
</signal>
</signals>
diff --git a/doc/classes/AudioEffectPitchShift.xml b/doc/classes/AudioEffectPitchShift.xml
index 7d6c5f2b20..8c22afb40f 100644
--- a/doc/classes/AudioEffectPitchShift.xml
+++ b/doc/classes/AudioEffectPitchShift.xml
@@ -12,10 +12,26 @@
<methods>
</methods>
<members>
+ <member name="fft_size" type="int" setter="set_fft_size" getter="get_fft_size" enum="AudioEffectPitchShift.FFT_Size">
+ </member>
+ <member name="oversampling" type="int" setter="set_oversampling" getter="get_oversampling">
+ </member>
<member name="pitch_scale" type="float" setter="set_pitch_scale" getter="get_pitch_scale">
Pitch value. Can range from 0 (-1 octave) to 16 (+16 octaves).
</member>
</members>
<constants>
+ <constant name="FFT_SIZE_256" value="0" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_512" value="1" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_1024" value="2" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_2048" value="3" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_4096" value="4" enum="FFT_Size">
+ </constant>
+ <constant name="FFT_SIZE_MAX" value="5" enum="FFT_Size">
+ </constant>
</constants>
</class>
diff --git a/doc/classes/CPUParticles2D.xml b/doc/classes/CPUParticles2D.xml
index e6df2d2f27..7283d5084c 100644
--- a/doc/classes/CPUParticles2D.xml
+++ b/doc/classes/CPUParticles2D.xml
@@ -99,7 +99,7 @@
Particles will be emitted inside this region. Use [enum EmissionShape] for values. Default value: [constant EMISSION_SHAPE_POINT].
</member>
<member name="emission_sphere_radius" type="float" setter="set_emission_sphere_radius" getter="get_emission_sphere_radius">
- The circle's radius if [member emission_shape] is set to [constant EMISSION_SHAPE_CIRCLE].
+ The sphere's radius if [member emission_shape] is set to [constant EMISSION_SHAPE_SPHERE].
</member>
<member name="emitting" type="bool" setter="set_emitting" getter="is_emitting">
If [code]true[/code], particles are being emitted. Default value: [code]true[/code].
@@ -271,7 +271,7 @@
All particles will be emitted from a single point.
</constant>
<constant name="EMISSION_SHAPE_SPHERE" value="1" enum="EmissionShape">
- Particles will be emitted on the surface of a sphere flattened to two dimensions.
+ Particles will be emitted on the surface of a sphere flattened to two dimensions.
</constant>
<constant name="EMISSION_SHAPE_RECTANGLE" value="2" enum="EmissionShape">
Particles will be emitted in the area of a rectangle.
diff --git a/doc/classes/CameraFeed.xml b/doc/classes/CameraFeed.xml
index 7f353f7a05..4611b9c507 100644
--- a/doc/classes/CameraFeed.xml
+++ b/doc/classes/CameraFeed.xml
@@ -45,10 +45,10 @@
<constant name="FEED_RGB" value="1" enum="FeedDataType">
Feed supplies RGB images.
</constant>
- <constant name="FEED_YCbCr" value="2" enum="FeedDataType">
+ <constant name="FEED_YCBCR" value="2" enum="FeedDataType">
Feed supplies YCbCr images that need to be converted to RGB.
</constant>
- <constant name="FEED_YCbCr_Sep" value="3" enum="FeedDataType">
+ <constant name="FEED_YCBCR_SEP" value="3" enum="FeedDataType">
Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.
</constant>
<constant name="FEED_UNSPECIFIED" value="0" enum="FeedPosition">
diff --git a/doc/classes/CameraServer.xml b/doc/classes/CameraServer.xml
index f492bda74f..ee41f08ec6 100644
--- a/doc/classes/CameraServer.xml
+++ b/doc/classes/CameraServer.xml
@@ -70,13 +70,13 @@
<constant name="FEED_RGBA_IMAGE" value="0" enum="FeedImage">
The RGBA camera image.
</constant>
- <constant name="FEED_YCbCr_IMAGE" value="0" enum="FeedImage">
+ <constant name="FEED_YCBCR_IMAGE" value="0" enum="FeedImage">
The YCbCr camera image.
</constant>
<constant name="FEED_Y_IMAGE" value="0" enum="FeedImage">
The Y component camera image.
</constant>
- <constant name="FEED_CbCr_IMAGE" value="1" enum="FeedImage">
+ <constant name="FEED_CBCR_IMAGE" value="1" enum="FeedImage">
The CbCr component camera image.
</constant>
</constants>
diff --git a/doc/classes/ColorPicker.xml b/doc/classes/ColorPicker.xml
index 32e6014c75..0ab91e9621 100644
--- a/doc/classes/ColorPicker.xml
+++ b/doc/classes/ColorPicker.xml
@@ -45,12 +45,17 @@
<member name="edit_alpha" type="bool" setter="set_edit_alpha" getter="is_editing_alpha">
If [code]true[/code], shows an alpha channel slider (transparency).
</member>
+ <member name="hsv_mode" type="bool" setter="set_hsv_mode" getter="is_hsv_mode">
+ If [code]true[/code], allows to edit color with Hue/Saturation/Value sliders.
+ [b]Note:[/b] Cannot be enabled if raw mode is on.
+ </member>
<member name="presets_enabled" type="bool" setter="set_presets_enabled" getter="are_presets_enabled">
</member>
<member name="presets_visible" type="bool" setter="set_presets_visible" getter="are_presets_visible">
</member>
<member name="raw_mode" type="bool" setter="set_raw_mode" getter="is_raw_mode">
If [code]true[/code], allows the color R, G, B component values to go beyond 1.0, which can be used for certain special operations that require it (like tinting without darkening or rendering sprites in HDR).
+ [b]Note:[/b] Cannot be enabled if hsv mode is on.
</member>
</members>
<signals>
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index ac46d34198..d446363a83 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -85,14 +85,16 @@
</return>
<description>
Returns the current engine version information in a Dictionary.
- "major" - Holds the major version number as an int
- "minor" - Holds the minor version number as an int
- "patch" - Holds the patch version number as an int
- "hex" - Holds the full version number encoded as an hexadecimal int with one byte (2 places) per number (see example below)
- "status" - Holds the status (e.g. "beta", "rc1", "rc2", ... "stable") as a String
- "build" - Holds the build name (e.g. "custom-build") as a String
- "string" - major + minor + patch + status + build in a single String
- The "hex" value is encoded as follows, from left to right: one byte for the major, one byte for the minor, one byte for the patch version. For example, "3.1.12" would be [code]0x03010C[/code]. Note that it's still an int internally, and printing it will give you its decimal representation, which is not particularly meaningful. Use hexadecimal literals for easy version comparisons from code:
+ [code]major[/code] - Holds the major version number as an int
+ [code]minor[/code] - Holds the minor version number as an int
+ [code]patch[/code] - Holds the patch version number as an int
+ [code]hex[/code] - Holds the full version number encoded as an hexadecimal int with one byte (2 places) per number (see example below)
+ [code]status[/code] - Holds the status (e.g. "beta", "rc1", "rc2", ... "stable") as a String
+ [code]build[/code] - Holds the build name (e.g. "custom_build") as a String
+ [code]hash[/code] - Holds the full Git commit hash as a String
+ [code]year[/code] - Holds the year the version was released in as an int
+ [code]string[/code] - [code]major[/code] + [code]minor[/code] + [code]patch[/code] + [code]status[/code] + [code]build[/code] in a single String
+ The [code]hex[/code] value is encoded as follows, from left to right: one byte for the major, one byte for the minor, one byte for the patch version. For example, "3.1.12" would be [code]0x03010C[/code]. Note that it's still an int internally, and printing it will give you its decimal representation, which is not particularly meaningful. Use hexadecimal literals for easy version comparisons from code:
[codeblock]
if Engine.get_version_info().hex &gt;= 0x030200:
# do things specific to version 3.2 or later
diff --git a/doc/classes/File.xml b/doc/classes/File.xml
index 30da143f88..32fa628bbf 100644
--- a/doc/classes/File.xml
+++ b/doc/classes/File.xml
@@ -115,7 +115,7 @@
<return type="int" enum="Error">
</return>
<description>
- Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [@GlobalScope].
+ Returns the last error that happened when trying to perform operations. Compare with the [code]ERR_FILE_*[/code] constants from [enum @GlobalScope.Error].
</description>
</method>
<method name="get_float" qualifiers="const">
@@ -241,7 +241,7 @@
<argument index="2" name="compression_mode" type="int" enum="File.CompressionMode" default="0">
</argument>
<description>
- Opens a compressed file for reading or writing. Use COMPRESSION_* constants to set [code]compression_mode[/code].
+ Opens a compressed file for reading or writing. Use [enum CompressionMode] constants to set [code]compression_mode[/code].
</description>
</method>
<method name="open_encrypted">
diff --git a/doc/classes/GDNativeLibraryResourceLoader.xml b/doc/classes/GDNativeLibraryResourceLoader.xml
deleted file mode 100644
index 1b98fa3889..0000000000
--- a/doc/classes/GDNativeLibraryResourceLoader.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNativeLibraryResourceLoader" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/GDNativeLibraryResourceSaver.xml b/doc/classes/GDNativeLibraryResourceSaver.xml
deleted file mode 100644
index 346d0d87d4..0000000000
--- a/doc/classes/GDNativeLibraryResourceSaver.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="GDNativeLibraryResourceSaver" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/IP.xml b/doc/classes/IP.xml
index 3616a9ec50..65b1700333 100644
--- a/doc/classes/IP.xml
+++ b/doc/classes/IP.xml
@@ -34,6 +34,22 @@
Returns all of the user's current IPv4 and IPv6 addresses as an array.
</description>
</method>
+ <method name="get_local_interfaces" qualifiers="const">
+ <return type="Array">
+ </return>
+ <description>
+ Returns all network adapters as an array.
+ Each adapter is a dictionary of the form:
+ [codeblock]
+ {
+ "index": "1", # Interface index.
+ "name": "eth0", # Interface name.
+ "friendly": "Ethernet One", # A friendly name (might be empty).
+ "addresses": ["192.168.1.101"], # An array of IP addresses associated to this interface.
+ }
+ [/codeblock]
+ </description>
+ </method>
<method name="get_resolve_item_address" qualifiers="const">
<return type="String">
</return>
diff --git a/doc/classes/ItemList.xml b/doc/classes/ItemList.xml
index ba3a7fe6d8..d78c930351 100644
--- a/doc/classes/ItemList.xml
+++ b/doc/classes/ItemList.xml
@@ -46,7 +46,7 @@
<return type="void">
</return>
<description>
- Ensure selection is visible, adjusting the scroll position as necessary.
+ Ensure current selection is visible, adjusting the scroll position as necessary.
</description>
</method>
<method name="get_item_at_position" qualifiers="const">
@@ -64,7 +64,7 @@
<return type="int">
</return>
<description>
- Returns count of items currently in the item list.
+ Returns the number of items currently in the list.
</description>
</method>
<method name="get_item_custom_bg_color" qualifiers="const">
@@ -73,6 +73,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the custom background color of the item specified by [code]idx[/code] index. Default value is [code]Color(0, 0, 0, 0)[/code].
</description>
</method>
<method name="get_item_custom_fg_color" qualifiers="const">
@@ -81,6 +82,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the custom foreground color of the item specified by [code]idx[/code] index. Default value is [code]Color(0, 0, 0, 0)[/code].
</description>
</method>
<method name="get_item_icon" qualifiers="const">
@@ -89,6 +91,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the icon associated with the specified index. Default value is [code]null[/code]
</description>
</method>
<method name="get_item_icon_modulate" qualifiers="const">
@@ -114,6 +117,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
+ Returns the metadata value of the specified index.
</description>
</method>
<method name="get_item_text" qualifiers="const">
@@ -122,7 +126,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Returns the text for specified item index.
+ Returns the text associated with the specified index.
</description>
</method>
<method name="get_item_tooltip" qualifiers="const">
@@ -131,21 +135,21 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Returns tooltip hint for specified item index.
+ Returns the tooltip hint associated with the specified index.
</description>
</method>
<method name="get_selected_items">
<return type="PoolIntArray">
</return>
<description>
- Returns the list of selected indexes.
+ Returns an array with the indexes of the selected items.
</description>
</method>
<method name="get_v_scroll">
<return type="VScrollBar">
</return>
<description>
- Returns the current vertical scroll bar for the List.
+ Returns the [Object] ID associated with the list.
</description>
</method>
<method name="is_anything_selected">
@@ -161,7 +165,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Returns whether or not the item at the specified index is disabled
+ Returns whether or not the item at the specified index is disabled.
</description>
</method>
<method name="is_item_icon_transposed" qualifiers="const">
@@ -207,7 +211,7 @@
<argument index="1" name="to_idx" type="int">
</argument>
<description>
- Moves item at index [code]from_idx[/code] to [code]to_idx[/code].
+ Moves item from index [code]from_idx[/code] to [code]to_idx[/code].
</description>
</method>
<method name="remove_item">
@@ -216,7 +220,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Remove item at specified index from the list.
+ Removes the item specified by [code]idx[/code] index from the list.
</description>
</method>
<method name="select">
@@ -239,6 +243,11 @@
<argument index="1" name="custom_bg_color" type="Color">
</argument>
<description>
+ Sets the background color of the item specified by [code]idx[/code] index to the specified [Color].
+ [codeblock]
+ var some_string = "Some text"
+ some_string.set_item_custom_bg_color(0,Color(1, 0, 0, 1) # This will set the background color of the first item of the control to red.
+ [/codeblock]
</description>
</method>
<method name="set_item_custom_fg_color">
@@ -249,6 +258,11 @@
<argument index="1" name="custom_fg_color" type="Color">
</argument>
<description>
+ Sets the foreground color of the item specified by [code]idx[/code] index to the specified [Color].
+ [codeblock]
+ var some_string = "Some text"
+ some_string.set_item_custom_fg_color(0,Color(1, 0, 0, 1) # This will set the foreground color of the first item of the control to red.
+ [/codeblock]
</description>
</method>
<method name="set_item_disabled">
@@ -259,8 +273,8 @@
<argument index="1" name="disabled" type="bool">
</argument>
<description>
- Disable (or enable) item at specified index.
- Disabled items are not be selectable and do not fire activation (Enter or double-click) signals.
+ Disable (or enable) item at the specified index.
+ Disabled items are not be selectable and do not trigger activation (Enter or double-click) signals.
</description>
</method>
<method name="set_item_icon">
@@ -271,7 +285,7 @@
<argument index="1" name="icon" type="Texture">
</argument>
<description>
- Set (or replace) icon of the item at the specified index.
+ Set (or replace) the icon's [Texture] associated with the specified index.
</description>
</method>
<method name="set_item_icon_modulate">
@@ -282,7 +296,7 @@
<argument index="1" name="modulate" type="Color">
</argument>
<description>
- Sets a modulating [Color] for item's icon at the specified index.
+ Sets a modulating [Color] of the item associated with the specified index.
</description>
</method>
<method name="set_item_icon_region">
@@ -313,7 +327,7 @@
<argument index="1" name="metadata" type="Variant">
</argument>
<description>
- Sets a value (of any type) to be stored with the item at the specified index.
+ Sets a value (of any type) to be stored with the item associated with the specified index.
</description>
</method>
<method name="set_item_selectable">
@@ -324,7 +338,7 @@
<argument index="1" name="selectable" type="bool">
</argument>
<description>
- Allow or disallow selection of the item at the specified index.
+ Allow or disallow selection of the item associated with the specified index.
</description>
</method>
<method name="set_item_text">
@@ -335,7 +349,7 @@
<argument index="1" name="text" type="String">
</argument>
<description>
- Sets text of item at specified index.
+ Sets text of the item associated with the specified index.
</description>
</method>
<method name="set_item_tooltip">
@@ -346,7 +360,7 @@
<argument index="1" name="tooltip" type="String">
</argument>
<description>
- Sets tooltip hint for item at specified index.
+ Sets tooltip hint for the item associated with the specified index.
</description>
</method>
<method name="set_item_tooltip_enabled">
@@ -357,7 +371,7 @@
<argument index="1" name="enable" type="bool">
</argument>
<description>
- Sets whether the tooltip is enabled for specified item index.
+ Sets whether the tooltip hint is enabled for specified item index.
</description>
</method>
<method name="sort_items_by_text">
@@ -373,7 +387,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
- Ensure item at specified index is not selected.
+ Ensure the item associated with the specified index is not selected.
</description>
</method>
<method name="unselect_all">
@@ -386,29 +400,38 @@
</methods>
<members>
<member name="allow_reselect" type="bool" setter="set_allow_reselect" getter="get_allow_reselect">
- If [code]true[/code], the currently selected item may be selected again.
+ If [code]true[/code], the currently selected item can be selected again.
</member>
<member name="allow_rmb_select" type="bool" setter="set_allow_rmb_select" getter="get_allow_rmb_select">
- If [code]true[/code], a right mouse button click can select items.
+ If [code]true[/code], right mouse button click can select items.
</member>
<member name="auto_height" type="bool" setter="set_auto_height" getter="has_auto_height">
+ If [code]true[/code], the control will automatically resize the height to fit its content.
</member>
<member name="fixed_column_width" type="int" setter="set_fixed_column_width" getter="get_fixed_column_width">
+ Sets the default column width in pixels.
+ If left to default value, each item will have a width equal to the width of its content and the columns will have an uneven width.
</member>
<member name="fixed_icon_size" type="Vector2" setter="set_fixed_icon_size" getter="get_fixed_icon_size">
+ Sets the default icon size in pixels.
</member>
<member name="icon_mode" type="int" setter="set_icon_mode" getter="get_icon_mode" enum="ItemList.IconMode">
+ Sets the default position of the icon to either [constant ICON_MODE_LEFT] or [constant ICON_MODE_TOP].
</member>
<member name="icon_scale" type="float" setter="set_icon_scale" getter="get_icon_scale">
+ Sets the icon size to its initial size multiplied by the specified scale. Default value is 1.0.
</member>
<member name="max_columns" type="int" setter="set_max_columns" getter="get_max_columns">
+ Sets the maximum columns the list will have.
+ If set to anything other than the default, the content will be split among the specified columns.
</member>
<member name="max_text_lines" type="int" setter="set_max_text_lines" getter="get_max_text_lines">
</member>
<member name="same_column_width" type="bool" setter="set_same_column_width" getter="is_same_column_width">
+ If set to [code]true[/code], all columns will have the same width specified by [member fixed_column_width].
</member>
<member name="select_mode" type="int" setter="set_select_mode" getter="get_select_mode" enum="ItemList.SelectMode">
- Allow single or multiple selection. See the [code]SELECT_*[/code] constants.
+ Allow single or multiple item selection. See the [enum SelectMode] constants.
</member>
</members>
<signals>
@@ -416,7 +439,7 @@
<argument index="0" name="index" type="int">
</argument>
<description>
- Fired when specified list item is activated via double click or Enter.
+ Triggered when specified list item is activated via double click or Enter.
</description>
</signal>
<signal name="item_rmb_selected">
@@ -425,7 +448,7 @@
<argument index="1" name="at_position" type="Vector2">
</argument>
<description>
- Fired when specified list item has been selected via right mouse clicking.
+ Triggered when specified list item has been selected via right mouse clicking.
The click position is also provided to allow appropriate popup of context menus
at the correct location.
[member allow_rmb_select] must be enabled.
@@ -435,7 +458,7 @@
<argument index="0" name="index" type="int">
</argument>
<description>
- Fired when specified item has been selected.
+ Triggered when specified item has been selected.
[member allow_reselect] must be enabled to reselect an item.
</description>
</signal>
@@ -445,17 +468,20 @@
<argument index="1" name="selected" type="bool">
</argument>
<description>
- Fired when a multiple selection is altered on a list allowing multiple selection.
+ Triggered when a multiple selection is altered on a list allowing multiple selection.
</description>
</signal>
<signal name="nothing_selected">
<description>
+ Triggered when a left mouse click is issued within the rect of the list but on empty space.
</description>
</signal>
<signal name="rmb_clicked">
<argument index="0" name="at_position" type="Vector2">
</argument>
<description>
+ Triggered when a right mouse click is issued within the rect of the list but on empty space.
+ [member allow_rmb_select] must be enabled.
</description>
</signal>
</signals>
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 2c680e828e..7b50021284 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -811,12 +811,12 @@
<member name="low_processor_usage_mode" type="bool" setter="set_low_processor_usage_mode" getter="is_in_low_processor_usage_mode">
If [code]true[/code], the engine optimizes for low processor usage by only refreshing the screen if needed. Can improve battery consumption on mobile.
</member>
- <member name="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size">
- The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value.
- </member>
<member name="max_window_size" type="Vector2" setter="set_max_window_size" getter="get_max_window_size">
The maximum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value.
</member>
+ <member name="min_window_size" type="Vector2" setter="set_min_window_size" getter="get_min_window_size">
+ The minimum size of the window (without counting window manager decorations). Does not affect fullscreen mode. Set to [code](0, 0)[/code] to reset to the system default value.
+ </member>
<member name="screen_orientation" type="int" setter="set_screen_orientation" getter="get_screen_orientation" enum="_OS.ScreenOrientation">
The current screen orientation.
</member>
diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml
index c9910360ed..548a0c18bb 100644
--- a/doc/classes/Object.xml
+++ b/doc/classes/Object.xml
@@ -374,6 +374,7 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
+ Set property into the object, after the current frame's physics step. This is equivalent to calling [method set] via [method call_deferred], i.e. [code]call_deferred("set", [property, value])[/code].
</description>
</method>
<method name="set_indexed">
diff --git a/doc/classes/PacketPeerUDP.xml b/doc/classes/PacketPeerUDP.xml
index 9843c16108..376818fb86 100644
--- a/doc/classes/PacketPeerUDP.xml
+++ b/doc/classes/PacketPeerUDP.xml
@@ -37,6 +37,29 @@
Returns whether this [PacketPeerUDP] is listening.
</description>
</method>
+ <method name="join_multicast_group">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="multicast_address" type="String">
+ </argument>
+ <argument index="1" name="interface_name" type="String">
+ </argument>
+ <description>
+ Join the multicast group specified by [code]multicast_address[/code] using the interface identified by [code]interface_name[/code].
+ You can join the same multicast group with multiple interfaces. Use [method IP.get_local_interfaces] to know which are available.
+ </description>
+ </method>
+ <method name="leave_multicast_group">
+ <return type="int" enum="Error">
+ </return>
+ <argument index="0" name="multicast_address" type="String">
+ </argument>
+ <argument index="1" name="interface_name" type="String">
+ </argument>
+ <description>
+ Remove the interface identified by [code]interface_name[/code] from the multicast group specified by [code]multicast_address[/code].
+ </description>
+ </method>
<method name="listen">
<return type="int" enum="Error">
</return>
diff --git a/doc/classes/ReferenceRect.xml b/doc/classes/ReferenceRect.xml
index 0e19e35e58..f6025fe2f9 100644
--- a/doc/classes/ReferenceRect.xml
+++ b/doc/classes/ReferenceRect.xml
@@ -4,7 +4,7 @@
Reference frame for GUI.
</brief_description>
<description>
- Reference frame for GUI. It's just like an empty control, except a red box is displayed while editing around its size at all times.
+ Reference frame for GUI. It's just like an empty control, except an outline border [member border_color] is displayed while editing around its size at all times.
</description>
<tutorials>
</tutorials>
@@ -12,6 +12,7 @@
</methods>
<members>
<member name="border_color" type="Color" setter="set_border_color" getter="get_border_color">
+ Determines the border [Color] of the [ReferenceRect].
</member>
</members>
<constants>
diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml
index 211bda1a09..acd608de6a 100644
--- a/doc/classes/Resource.xml
+++ b/doc/classes/Resource.xml
@@ -4,7 +4,7 @@
Base class for all resources.
</brief_description>
<description>
- Resource is the base class for all resource types, serving primarily as data containers. They are reference counted and freed when no longer in use. They are also loaded only once from disk, and further attempts to load the resource will return the same reference (all this in contrast to a [Node], which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource.
+ Resource is the base class for all Godot-specific resource types, serving primarily as data containers. They are reference counted and freed when no longer in use. They are also cached once loaded from disk, so that any further attempts to load a resource from a given path will return the same reference (all this in contrast to a [Node], which is not reference counted and can be instanced from disk as many times as desired). Resources can be saved externally on disk or bundled into another object, such as a [Node] or another resource.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/resources.html</link>
@@ -14,6 +14,7 @@
<return type="void">
</return>
<description>
+ Virtual function which can be overridden to customize the behavior value of [method setup_local_to_scene].
</description>
</method>
<method name="duplicate" qualifiers="const">
@@ -29,6 +30,7 @@
<return type="Node">
</return>
<description>
+ If [member resource_local_to_scene] is enabled and the resource was loaded from a [PackedScene] instantiation, returns the local scene where this resource's unique copy is in use. Otherwise, returns [code]null[/code].
</description>
</method>
<method name="get_rid" qualifiers="const">
@@ -42,6 +44,8 @@
<return type="void">
</return>
<description>
+ This method is called when a resource with [member resource_local_to_scene] enabled is loaded from a [PackedScene] instantiation. Its behavior can be customized by overriding [method _setup_local_to_scene] from script.
+ For most resources, this method performs no base logic. [ViewportTexture] performs custom logic to properly set the proxy texture and flags in the local viewport.
</description>
</method>
<method name="take_over_path">
@@ -50,12 +54,13 @@
<argument index="0" name="path" type="String">
</argument>
<description>
- Sets the path of the resource. Differs from [code]set_path()[/code], if another [Resource] exists with "path" it over-takes it, instead of failing.
+ Sets the path of the resource, potentially overriding an existing cache entry for this path. This differs from setting [member resource_path], as the latter would error out if another resource was already cached for the given path.
</description>
</method>
</methods>
<members>
<member name="resource_local_to_scene" type="bool" setter="set_local_to_scene" getter="is_local_to_scene">
+ If [code]true[/code], the resource will be made unique in each instance of its local scene. It can thus be modified in a scene instance without impacting other instances of that same scene.
</member>
<member name="resource_name" type="String" setter="set_name" getter="get_name">
The name of the resource. This is an optional identifier.
diff --git a/doc/classes/ResourceFormatDDS.xml b/doc/classes/ResourceFormatDDS.xml
deleted file mode 100644
index 9717052a5d..0000000000
--- a/doc/classes/ResourceFormatDDS.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatDDS" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatImporter.xml b/doc/classes/ResourceFormatImporter.xml
deleted file mode 100644
index e5c84e6db4..0000000000
--- a/doc/classes/ResourceFormatImporter.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatImporter" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml
index 925706b50c..f62191413a 100644
--- a/doc/classes/ResourceFormatLoader.xml
+++ b/doc/classes/ResourceFormatLoader.xml
@@ -4,9 +4,9 @@
Loads a specific resource type from a file.
</brief_description>
<description>
- Godot loads resources in the editor or in exported games using ResourceFormatLoaders. They get queried when you call [code]load[/code], or when a resource with internal dependencies is loaded. Each file type may load as a different resource type, so multiple ResourceFormatLoader are registered in the engine.
- Extending this class allows you to define your own. You should give it a global class name with [code]class_name[/code] for it to be registered. You may as well implement a [ResourceFormatSaver].
- Note: You can also extend [EditorImportPlugin] if the resource type you need exists but Godot is unable to load its format. Choosing one way over another depends if the format is suitable or not for the final exported game. Example: it's better to import .PNG textures as .STEX first, so they can be loaded with better efficiency on the graphics card.
+ Godot loads resources in the editor or in exported games using ResourceFormatLoaders. They are queried automatically via the [ResourceLoader] singleton, or when a resource with internal dependencies is loaded. Each file type may load as a different resource type, so multiple ResourceFormatLoaders are registered in the engine.
+ Extending this class allows you to define your own loader. Be sure to respect the documented return types and values. You should give it a global class name with [code]class_name[/code] for it to be registered. Like built-in ResourceFormatLoaders, it will be called automatically when loading resources of its handled type(s). You may also implement a [ResourceFormatSaver].
+ Note: You can also extend [EditorImportPlugin] if the resource type you need exists but Godot is unable to load its format. Choosing one way over another depends if the format is suitable or not for the final exported game. For example, it's better to import [code].png[/code] textures as [code].stex[/code] ([StreamTexture]) first, so they can be loaded with better efficiency on the graphics card.
</description>
<tutorials>
</tutorials>
@@ -19,7 +19,7 @@
<argument index="1" name="add_types" type="String">
</argument>
<description>
- If implemented, gets the dependencies of a given resource. If [code]add_types[/code] is [code]true[/code], paths should be appended [code]::TypeName[/code], where [code]TypeName[/code] is the class name of the dependency. Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]Resource[/code] for them.
+ If implemented, gets the dependencies of a given resource. If [code]add_types[/code] is [code]true[/code], paths should be appended [code]::TypeName[/code], where [code]TypeName[/code] is the class name of the dependency. Note that custom resource types defined by scripts aren't known by the [ClassDB], so you might just return [code]"Resource"[/code] for them.
</description>
</method>
<method name="get_recognized_extensions" qualifiers="virtual">
@@ -55,7 +55,7 @@
<argument index="1" name="original_path" type="String">
</argument>
<description>
- Loads a resource when the engine finds this loader to be compatible. If the loaded resource is the result of an import, [code]original_path[/code] will target the source file. Returns a resource object if succeeded, or an [code]ERR_*[/code] constant listed in [@GlobalScope] if it failed.
+ Loads a resource when the engine finds this loader to be compatible. If the loaded resource is the result of an import, [code]original_path[/code] will target the source file. Returns a [Resource] object on success, or an [enum @GlobalScope.Error] constant in case of failure.
</description>
</method>
<method name="rename_dependencies" qualifiers="virtual">
@@ -66,7 +66,8 @@
<argument index="1" name="renames" type="String">
</argument>
<description>
- If implemented, renames dependencies within the given resource and saves it. [code]renames[/code] is a dictionary [code]{ String =&gt; String }[/code] mapping old dependency paths to new paths. Returns [code]OK[/code] on success, or an [code]ERR_*[/code] constant listed in [@GlobalScope] in case of failure.
+ If implemented, renames dependencies within the given resource and saves it. [code]renames[/code] is a dictionary [code]{ String =&gt; String }[/code] mapping old dependency paths to new paths.
+ Returns [constant @GlobalScope.OK] on success, or an [enum @GlobalScope.Error] constant in case of failure.
</description>
</method>
</methods>
diff --git a/doc/classes/ResourceFormatLoaderBMFont.xml b/doc/classes/ResourceFormatLoaderBMFont.xml
deleted file mode 100644
index f5b26a6ff7..0000000000
--- a/doc/classes/ResourceFormatLoaderBMFont.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderBMFont" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderBinary.xml b/doc/classes/ResourceFormatLoaderBinary.xml
deleted file mode 100644
index cf4a2373dc..0000000000
--- a/doc/classes/ResourceFormatLoaderBinary.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderBinary" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderDynamicFont.xml b/doc/classes/ResourceFormatLoaderDynamicFont.xml
deleted file mode 100644
index af06ea0d8d..0000000000
--- a/doc/classes/ResourceFormatLoaderDynamicFont.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderDynamicFont" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderGDScript.xml b/doc/classes/ResourceFormatLoaderGDScript.xml
deleted file mode 100644
index 5bb9127978..0000000000
--- a/doc/classes/ResourceFormatLoaderGDScript.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderGDScript" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderImage.xml b/doc/classes/ResourceFormatLoaderImage.xml
deleted file mode 100644
index de53d2c076..0000000000
--- a/doc/classes/ResourceFormatLoaderImage.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderImage" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderNativeScript.xml b/doc/classes/ResourceFormatLoaderNativeScript.xml
deleted file mode 100644
index 7355f702b9..0000000000
--- a/doc/classes/ResourceFormatLoaderNativeScript.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderNativeScript" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderShader.xml b/doc/classes/ResourceFormatLoaderShader.xml
deleted file mode 100644
index 1bef7485fb..0000000000
--- a/doc/classes/ResourceFormatLoaderShader.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderShader" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderStreamTexture.xml b/doc/classes/ResourceFormatLoaderStreamTexture.xml
deleted file mode 100644
index 4bdc74acbc..0000000000
--- a/doc/classes/ResourceFormatLoaderStreamTexture.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderStreamTexture" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderText.xml b/doc/classes/ResourceFormatLoaderText.xml
deleted file mode 100644
index 92ad3179bf..0000000000
--- a/doc/classes/ResourceFormatLoaderText.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderText" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderTextureLayered.xml b/doc/classes/ResourceFormatLoaderTextureLayered.xml
deleted file mode 100644
index 69c3eedf63..0000000000
--- a/doc/classes/ResourceFormatLoaderTextureLayered.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderTextureLayered" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderTheora.xml b/doc/classes/ResourceFormatLoaderTheora.xml
deleted file mode 100644
index 1b5e30f09c..0000000000
--- a/doc/classes/ResourceFormatLoaderTheora.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderTheora" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatLoaderWebm.xml b/doc/classes/ResourceFormatLoaderWebm.xml
deleted file mode 100644
index a45e5d488d..0000000000
--- a/doc/classes/ResourceFormatLoaderWebm.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderWebm" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatPKM.xml b/doc/classes/ResourceFormatPKM.xml
deleted file mode 100644
index 6c442cd934..0000000000
--- a/doc/classes/ResourceFormatPKM.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatPKM" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatPVR.xml b/doc/classes/ResourceFormatPVR.xml
deleted file mode 100644
index d82f48f207..0000000000
--- a/doc/classes/ResourceFormatPVR.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatPVR" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml
index caa05dce26..c40f614aa2 100644
--- a/doc/classes/ResourceFormatSaver.xml
+++ b/doc/classes/ResourceFormatSaver.xml
@@ -4,8 +4,8 @@
Saves a specific resource type to a file.
</brief_description>
<description>
- The engine can save resources when you do it from the editor, or when you call [method ResourceSaver.save]. This is accomplished with multiple [ResourceFormatSaver]s, each handling its own format.
- By default, Godot saves resources as [code].tres[/code], [code].res[/code] or another built-in format, but you can choose to create your own format by extending this class. You should give it a global class name with [code]class_name[/code] for it to be registered. You may as well implement a [ResourceFormatLoader].
+ The engine can save resources when you do it from the editor, or when you use the [ResourceSaver] singleton. This is accomplished thanks to multiple [ResourceFormatSaver]s, each handling its own format and called automatically by the engine.
+ By default, Godot saves resources as [code].tres[/code] (text-based), [code].res[/code] (binary) or another built-in format, but you can choose to create your own format by extending this class. Be sure to respect the documented return types and values. You should give it a global class name with [code]class_name[/code] for it to be registered. Like built-in ResourceFormatSavers, it will be called automatically when saving resources of its recognized type(s). You may also implement a [ResourceFormatLoader].
</description>
<tutorials>
</tutorials>
@@ -16,7 +16,7 @@
<argument index="0" name="resource" type="Resource">
</argument>
<description>
- Gets the list of extensions for files this saver is able to write.
+ Returns the list of extensions available for saving the resource object, provided it is recognized (see [method recognize]).
</description>
</method>
<method name="recognize" qualifiers="virtual">
@@ -25,7 +25,7 @@
<argument index="0" name="resource" type="Resource">
</argument>
<description>
- Returns [code]true[/code] if the given resource object can be saved by this saver.
+ Returns whether the given resource object can be saved by this saver.
</description>
</method>
<method name="save" qualifiers="virtual">
@@ -38,7 +38,8 @@
<argument index="2" name="flags" type="int">
</argument>
<description>
- Saves the given resource object to a file. [code]flags[/code] is a bitmask composed with [code]FLAG_*[/code] constants defined in [ResourceSaver]. Returns [code]OK[/code] on success, or an [code]ERR_*[/code] constant listed in [@GlobalScope] if it failed.
+ Saves the given resource object to a file at the target [code]path[/code]. [code]flags[/code] is a bitmask composed with [enum ResourceSaver.SaverFlags] constants.
+ Returns [constant @GlobalScope.OK] on success, or an [enum @GlobalScope.Error] constant in case of failure.
</description>
</method>
</methods>
diff --git a/doc/classes/ResourceFormatSaverBinary.xml b/doc/classes/ResourceFormatSaverBinary.xml
deleted file mode 100644
index 32c286d0d9..0000000000
--- a/doc/classes/ResourceFormatSaverBinary.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatSaverBinary" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatSaverGDScript.xml b/doc/classes/ResourceFormatSaverGDScript.xml
deleted file mode 100644
index 0fe65e28b0..0000000000
--- a/doc/classes/ResourceFormatSaverGDScript.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatSaverGDScript" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatSaverNativeScript.xml b/doc/classes/ResourceFormatSaverNativeScript.xml
deleted file mode 100644
index 7a699a2cca..0000000000
--- a/doc/classes/ResourceFormatSaverNativeScript.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatSaverNativeScript" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatSaverShader.xml b/doc/classes/ResourceFormatSaverShader.xml
deleted file mode 100644
index 65ddee42fd..0000000000
--- a/doc/classes/ResourceFormatSaverShader.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatSaverShader" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceFormatSaverText.xml b/doc/classes/ResourceFormatSaverText.xml
deleted file mode 100644
index 921de81031..0000000000
--- a/doc/classes/ResourceFormatSaverText.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatSaverText" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceImporter.xml b/doc/classes/ResourceImporter.xml
deleted file mode 100644
index e0c0aa9a47..0000000000
--- a/doc/classes/ResourceImporter.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporter" inherits="Reference" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/ResourceInteractiveLoader.xml b/doc/classes/ResourceInteractiveLoader.xml
index bb9826999c..9d5a52deb2 100644
--- a/doc/classes/ResourceInteractiveLoader.xml
+++ b/doc/classes/ResourceInteractiveLoader.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceInteractiveLoader" inherits="Reference" category="Core" version="3.2">
<brief_description>
- Interactive Resource Loader.
+ Interactive [Resource] loader.
</brief_description>
<description>
- Interactive Resource Loader. This object is returned by ResourceLoader when performing an interactive load. It allows to load with high granularity, so this is mainly useful for displaying load bars/percentages.
+ Interactive [Resource] loader. This object is returned by [ResourceLoader] when performing an interactive load. It allows to load with high granularity, so this is mainly useful for displaying loading bars/percentages.
</description>
<tutorials>
</tutorials>
@@ -13,14 +13,14 @@
<return type="Resource">
</return>
<description>
- Returns the loaded resource (only if loaded). Otherwise, returns null.
+ Returns the loaded resource if the load operation completed successfully, [code]null[/code] otherwise.
</description>
</method>
<method name="get_stage" qualifiers="const">
<return type="int">
</return>
<description>
- Returns the load stage. The total amount of stages can be queried with [method get_stage_count]
+ Returns the load stage. The total amount of stages can be queried with [method get_stage_count].
</description>
</method>
<method name="get_stage_count" qualifiers="const">
@@ -34,13 +34,19 @@
<return type="int" enum="Error">
</return>
<description>
- Poll the load. If OK is returned, this means poll will have to be called again. If ERR_FILE_EOF is returned, them the load has finished and the resource can be obtained by calling [method get_resource].
+ Polls the loading operation, i.e. loads a data chunk up to the next stage.
+ Returns [constant @GlobalScope.OK] if the poll is successful but the load operation has not finished yet (intermediate stage). This means [method poll] will have to be called again until the last stage is completed.
+ Returns [constant @GlobalScope.ERR_FILE_EOF] if the load operation has completed successfully. The loaded resource can be obtained by calling [method get_resource].
+ Returns another [enum @GlobalScope.Error] code if the poll has failed.
</description>
</method>
<method name="wait">
<return type="int" enum="Error">
</return>
<description>
+ Polls the loading operation successively until the resource is completely loaded or a [method poll] fails.
+ Returns [constant @GlobalScope.ERR_FILE_EOF] if the load operation has completed successfully. The loaded resource can be obtained by calling [method get_resource].
+ Returns another [enum @GlobalScope.Error] code if a poll has failed, aborting the operation.
</description>
</method>
</methods>
diff --git a/doc/classes/ResourceLoader.xml b/doc/classes/ResourceLoader.xml
index 76b7c39191..558852704e 100644
--- a/doc/classes/ResourceLoader.xml
+++ b/doc/classes/ResourceLoader.xml
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceLoader" inherits="Object" category="Core" version="3.2">
<brief_description>
- Resource Loader.
+ Singleton used to load resource files.
</brief_description>
<description>
- Resource Loader. This is a static object accessible as [ResourceLoader]. GDScript has a simplified load() function, though.
+ Singleton used to load resource files from the filesystem.
+ It uses the many [ResourceFormatLoader] classes registered in the engine (either built-in or from a plugin) to load files into memory and convert them to a format that can be used by the engine.
+ GDScript has a simplified [method @GDScript.load] built-in method which can be used in most situations, leaving the use of [ResourceLoader] for more advanced scenarios.
</description>
<tutorials>
</tutorials>
@@ -17,6 +19,8 @@
<argument index="1" name="type_hint" type="String" default="&quot;&quot;">
</argument>
<description>
+ Returns whether a recognized resource exists for the given [code]path[/code].
+ An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader].
</description>
</method>
<method name="get_dependencies">
@@ -25,6 +29,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
+ Returns the dependencies for the resource at the given [code]path[/code].
</description>
</method>
<method name="get_recognized_extensions_for_type">
@@ -42,6 +47,7 @@
<argument index="0" name="path" type="String">
</argument>
<description>
+ Deprecated method. Use [method has_cached] or [method exists] instead.
</description>
</method>
<method name="has_cached">
@@ -50,6 +56,8 @@
<argument index="0" name="path" type="String">
</argument>
<description>
+ Returns whether a cached resource is available for the given [code]path[/code].
+ Once a resource has been loaded by the engine, it is cached in memory for faster access, and future calls to the [method load] or [method load_interactive] methods will use the cached version. The cached resource can be overridden by using [method Resource.take_over_path] on a new resource for that same path.
</description>
</method>
<method name="load">
@@ -62,6 +70,11 @@
<argument index="2" name="no_cache" type="bool" default="false">
</argument>
<description>
+ Loads a resource at the given [code]path[/code], caching the result for further access.
+ The registered [ResourceFormatLoader]s are queried sequentially to find the first one which can handle the file's extension, and then attempt loading. If loading fails, the remaining ResourceFormatLoaders are also attempted.
+ An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader].
+ If [code]no_cache[/code] is [code]true[/code], the resource cache will be bypassed and the resource will be loaded anew. Otherwise, the cached resource will be returned if it exists.
+ Returns an empty resource if no ResourceFormatLoader could handle the file.
</description>
</method>
<method name="load_interactive">
@@ -72,7 +85,8 @@
<argument index="1" name="type_hint" type="String" default="&quot;&quot;">
</argument>
<description>
- Load a resource interactively, the returned object allows to load with high granularity.
+ Starts loading a resource interactively. The returned [ResourceInteractiveLoader] object allows to load with high granularity, calling its [method ResourceInteractiveLoader.poll] method successively to load chunks.
+ An optional [code]type_hint[/code] can be used to further specify the [Resource] type that should be handled by the [ResourceFormatLoader].
</description>
</method>
<method name="set_abort_on_missing_resources">
diff --git a/doc/classes/ResourcePreloader.xml b/doc/classes/ResourcePreloader.xml
index d6c635b6eb..2b00c038e1 100644
--- a/doc/classes/ResourcePreloader.xml
+++ b/doc/classes/ResourcePreloader.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
This node is used to preload sub-resources inside a scene, so when the scene is loaded, all the resources are ready to use and can be retrieved from the preloader.
+ GDScript has a simplified [method @GDScript.preload] built-in method which can be used in most situations, leaving the use of [ResourcePreloader] for more advanced scenarios.
</description>
<tutorials>
</tutorials>
diff --git a/doc/classes/ResourceSaver.xml b/doc/classes/ResourceSaver.xml
index eac022f564..778ba4293f 100644
--- a/doc/classes/ResourceSaver.xml
+++ b/doc/classes/ResourceSaver.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ResourceSaver" inherits="Object" category="Core" version="3.2">
<brief_description>
- Resource saving interface.
+ Singleton for saving Godot-specific resource types.
</brief_description>
<description>
- Resource saving interface, used for saving resources to disk.
+ Singleton for saving Godot-specific resource types to the filesystem.
+ It uses the many [ResourceFormatSaver] classes registered in the engine (either built-in or from a plugin) to save engine-specific resource data to text-based (e.g. [code].tres[/code] or [code].tscn[/code]) or binary files (e.g. [code].res[/code] or [code].scn[/code]).
</description>
<tutorials>
</tutorials>
@@ -28,24 +29,33 @@
<argument index="2" name="flags" type="int" enum="ResourceSaver.SaverFlags" default="0">
</argument>
<description>
- Saves a resource to disk.
+ Saves a resource to disk to the given path, using a [ResourceFormatSaver] that recognizes the resource object.
+ The [code]flags[/code] bitmask can be specified to customize the save behavior.
+ Returns [constant @GlobalScope.OK] on success.
</description>
</method>
</methods>
<constants>
<constant name="FLAG_RELATIVE_PATHS" value="1" enum="SaverFlags">
+ Save the resource with a path relative to the scene which uses it.
</constant>
<constant name="FLAG_BUNDLE_RESOURCES" value="2" enum="SaverFlags">
+ Bundles external resources.
</constant>
<constant name="FLAG_CHANGE_PATH" value="4" enum="SaverFlags">
+ Change the [member Resource.resource_path] of the saved resource to match its new location.
</constant>
<constant name="FLAG_OMIT_EDITOR_PROPERTIES" value="8" enum="SaverFlags">
+ Do not save editor-specific metadata (identified by their [code]__editor[/code] prefix).
</constant>
<constant name="FLAG_SAVE_BIG_ENDIAN" value="16" enum="SaverFlags">
+ Save as big endian (see [member File.endian_swap]).
</constant>
<constant name="FLAG_COMPRESS" value="32" enum="SaverFlags">
+ Compress the resource on save using [constant File.COMPRESSION_ZSTD]. Only available for binary resource types.
</constant>
<constant name="FLAG_REPLACE_SUBRESOURCE_PATHS" value="64" enum="SaverFlags">
+ Take over the paths of the saved subresources (see [method Resource.take_over_path]).
</constant>
</constants>
</class>
diff --git a/doc/classes/ResourceSaverPNG.xml b/doc/classes/ResourceSaverPNG.xml
deleted file mode 100644
index 5ed4829f25..0000000000
--- a/doc/classes/ResourceSaverPNG.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceSaverPNG" inherits="ResourceFormatSaver" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/Sprite.xml b/doc/classes/Sprite.xml
index 26ff67cc74..097a5f2ed2 100644
--- a/doc/classes/Sprite.xml
+++ b/doc/classes/Sprite.xml
@@ -28,6 +28,8 @@
<argument index="0" name="pos" type="Vector2">
</argument>
<description>
+ Returns [code]true[/code], if the pixel at the given position is opaque and [code]false[/code] in other case.
+ Note: It also returns [code]false[/code], if the sprite's texture is null or if the given position is invalid.
</description>
</method>
</methods>
diff --git a/doc/classes/String.xml b/doc/classes/String.xml
index af7e5a395a..6395fe2ce8 100644
--- a/doc/classes/String.xml
+++ b/doc/classes/String.xml
@@ -388,6 +388,18 @@
Converts a string containing a hexadecimal number into an integer.
</description>
</method>
+ <method name="http_escape">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
+ <method name="http_unescape">
+ <return type="String">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="insert">
<return type="String">
</return>
@@ -757,10 +769,10 @@
</return>
<argument index="0" name="from" type="int">
</argument>
- <argument index="1" name="len" type="int">
+ <argument index="1" name="len" type="int" default="-1">
</argument>
<description>
- Returns part of the string from the position [code]from[/code] with length [code]len[/code].
+ Returns part of the string from the position [code]from[/code] with length [code]len[/code]. Argument [code]len[/code] is optional and using -1 will return remaining characters from given position.
</description>
</method>
<method name="to_ascii">
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 3e4b70f8f8..e818d753d8 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -44,6 +44,12 @@
Returns if the given line is foldable, that is, it has indented lines right below it.
</description>
</method>
+ <method name="center_viewport_to_cursor">
+ <return type="void">
+ </return>
+ <description>
+ </description>
+ </method>
<method name="clear_colors">
<return type="void">
</return>
@@ -105,7 +111,7 @@
<description>
Moves the cursor at the specified [code]line[/code] index.
If [code]adjust_viewport[/code] is set to true, the viewport will center at the cursor position after the move occurs. Default value is [code]true[/code].
- If [code]can_be_hidden[/code] is set to true, the specified [code]line[/code] can be hidden using [member set_line_as_hidden]. Default value is [code]true[/code].
+ If [code]can_be_hidden[/code] is set to true, the specified [code]line[/code] can be hidden using [method set_line_as_hidden]. Default value is [code]true[/code].
</description>
</method>
<method name="cut">
@@ -369,7 +375,7 @@
<return type="void">
</return>
<description>
- Unhide all lines that were previously set to hidden by [member set_line_as_hidden].
+ Unhide all lines that were previously set to hidden by [method set_line_as_hidden].
</description>
</method>
</methods>
@@ -404,7 +410,7 @@
If [code]true[/code], the fold gutter is visible. This enables folding groups of indented lines.
</member>
<member name="hiding_enabled" type="bool" setter="set_hiding_enabled" getter="is_hiding_enabled">
- If [code]true[/code], all lines that have been set to hidden by [member set_line_as_hidden], will not be visible.
+ If [code]true[/code], all lines that have been set to hidden by [method set_line_as_hidden], will not be visible.
</member>
<member name="highlight_all_occurrences" type="bool" setter="set_highlight_all_occurrences" getter="is_highlight_all_occurrences_enabled">
If [code]true[/code], all occurrences of the selected text will be highlighted.
@@ -515,15 +521,12 @@
</constants>
<theme_items>
<theme_item name="background_color" type="Color">
- Sets the background [Color] of this [TextEdit]. [member syntax_highlighting] has to be enabled.
</theme_item>
<theme_item name="bookmark_color" type="Color">
- Sets the [Color] of the bookmark marker. [member syntax_highlighting] has to be enabled.
</theme_item>
<theme_item name="brace_mismatch_color" type="Color">
</theme_item>
<theme_item name="breakpoint_color" type="Color">
- Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled.
</theme_item>
<theme_item name="caret_background_color" type="Color">
</theme_item>
@@ -550,7 +553,6 @@
<theme_item name="completion_selected_color" type="Color">
</theme_item>
<theme_item name="current_line_color" type="Color">
- Sets the current line highlight [Color]. [member highlight_current_line] has to be enabled.
</theme_item>
<theme_item name="executing_line_color" type="Color">
</theme_item>
@@ -561,48 +563,38 @@
<theme_item name="folded" type="Texture">
</theme_item>
<theme_item name="font" type="Font">
- Sets the default [Font].
</theme_item>
<theme_item name="font_color" type="Color">
- Sets the font [Color].
</theme_item>
<theme_item name="font_color_selected" type="Color">
</theme_item>
<theme_item name="function_color" type="Color">
</theme_item>
<theme_item name="line_number_color" type="Color">
- Sets the [Color] of the line numbers. [member show_line_numbers] has to be enabled.
</theme_item>
<theme_item name="line_spacing" type="int">
- Sets the spacing between the lines.
</theme_item>
<theme_item name="mark_color" type="Color">
- Sets the [Color] of marked text.
</theme_item>
<theme_item name="member_variable_color" type="Color">
</theme_item>
<theme_item name="normal" type="StyleBox">
- Sets the [StyleBox] of this [TextEdit].
</theme_item>
<theme_item name="number_color" type="Color">
</theme_item>
<theme_item name="read_only" type="StyleBox">
- Sets the [StyleBox] of this [TextEdit] when [member read_only] is enabled.
</theme_item>
<theme_item name="safe_line_number_color" type="Color">
</theme_item>
<theme_item name="selection_color" type="Color">
- Sets the highlight [Color] of text selections.
</theme_item>
<theme_item name="space" type="Texture">
</theme_item>
<theme_item name="symbol_color" type="Color">
</theme_item>
<theme_item name="tab" type="Texture">
- Sets a custom [Texture] for tab text characters.
</theme_item>
<theme_item name="word_highlighted_color" type="Color">
- Sets the highlight [Color] of multiple occurrences. [member highlight_all_occurrences] has to be enabled.
</theme_item>
</theme_items>
</class>
diff --git a/doc/classes/TranslationLoaderPO.xml b/doc/classes/TranslationLoaderPO.xml
deleted file mode 100644
index d9896e1807..0000000000
--- a/doc/classes/TranslationLoaderPO.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="TranslationLoaderPO" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/doc/classes/TranslationServer.xml b/doc/classes/TranslationServer.xml
index 400a6e31d5..268fb5b6a5 100644
--- a/doc/classes/TranslationServer.xml
+++ b/doc/classes/TranslationServer.xml
@@ -31,6 +31,7 @@
<return type="Array">
</return>
<description>
+ Returns an Array of all loaded locales of the game.
</description>
</method>
<method name="get_locale" qualifiers="const">
diff --git a/doc/classes/VisualShaderNodeGroupBase.xml b/doc/classes/VisualShaderNodeGroupBase.xml
index 37d48956f6..c2e9b9503b 100644
--- a/doc/classes/VisualShaderNodeGroupBase.xml
+++ b/doc/classes/VisualShaderNodeGroupBase.xml
@@ -109,6 +109,14 @@
<description>
</description>
</method>
+ <method name="is_valid_port_name" qualifiers="const">
+ <return type="bool">
+ </return>
+ <argument index="0" name="name" type="String">
+ </argument>
+ <description>
+ </description>
+ </method>
<method name="remove_input_port">
<return type="void">
</return>
diff --git a/drivers/dummy/texture_loader_dummy.h b/drivers/dummy/texture_loader_dummy.h
index 3038bffc95..0bc7fa226b 100644
--- a/drivers/dummy/texture_loader_dummy.h
+++ b/drivers/dummy/texture_loader_dummy.h
@@ -35,7 +35,6 @@
#include "scene/resources/texture.h"
class ResourceFormatDummyTexture : public ResourceFormatLoader {
- GDCLASS(ResourceFormatDummyTexture, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index a07c6832dc..ea29af7d9e 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -2920,16 +2920,16 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
VS::get_singleton()->texture_bind(camera_RGBA, 0);
- } else if (feed->get_datatype() == CameraFeed::FEED_YCbCr) {
- RID camera_YCbCr = feed->get_texture(CameraServer::FEED_YCbCr_IMAGE);
+ } else if (feed->get_datatype() == CameraFeed::FEED_YCBCR) {
+ RID camera_YCbCr = feed->get_texture(CameraServer::FEED_YCBCR_IMAGE);
VS::get_singleton()->texture_bind(camera_YCbCr, 0);
storage->shaders.copy.set_conditional(CopyShaderGLES2::YCBCR_TO_RGB, true);
- } else if (feed->get_datatype() == CameraFeed::FEED_YCbCr_Sep) {
+ } else if (feed->get_datatype() == CameraFeed::FEED_YCBCR_SEP) {
RID camera_Y = feed->get_texture(CameraServer::FEED_Y_IMAGE);
- RID camera_CbCr = feed->get_texture(CameraServer::FEED_CbCr_IMAGE);
+ RID camera_CbCr = feed->get_texture(CameraServer::FEED_CBCR_IMAGE);
VS::get_singleton()->texture_bind(camera_Y, 0);
VS::get_singleton()->texture_bind(camera_CbCr, 1);
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 70f1173a7d..9fe7e43b43 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -2427,6 +2427,18 @@ void RasterizerStorageGLES2::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
}
surface->data = array;
surface->index_data = p_index_array;
+#else
+ // Even on non-tools builds, a copy of the surface->data is needed in certain circumstances.
+ // Rigged meshes using the USE_SKELETON_SOFTWARE path need to read bone data
+ // from surface->data.
+
+ // if USE_SKELETON_SOFTWARE is active
+ if (!config.float_texture_supported) {
+ // if this geometry is used specifically for skinning
+ if (p_format & (VS::ARRAY_FORMAT_BONES | VS::ARRAY_FORMAT_WEIGHTS))
+ surface->data = array;
+ }
+ // An alternative is to always make a copy of surface->data.
#endif
surface->total_data_size += surface->array_byte_size + surface->index_array_byte_size;
@@ -4514,9 +4526,7 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
ERR_FAIL_COND(!inst);
} break;
default: {
- if (!inst) {
- ERR_FAIL();
- }
+ ERR_FAIL();
}
}
@@ -4561,15 +4571,10 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
ERR_FAIL_COND(!inst);
} break;
default: {
-
- if (!inst) {
- ERR_FAIL();
- }
+ ERR_FAIL();
}
}
- ERR_FAIL_COND(!inst);
-
inst->instance_list.remove(&p_instance->dependency_item);
}
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 30aa22732c..1f3af2f885 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -327,9 +327,6 @@ void RasterizerCanvasGLES3::_draw_polygon(const int *p_indices, int p_index_coun
uint32_t buffer_ofs = 0;
//vertex
-#ifdef DEBUG_ENABLED
- ERR_FAIL_COND(buffer_ofs > data.polygon_buffer_size);
-#endif
glBufferSubData(GL_ARRAY_BUFFER, buffer_ofs, sizeof(Vector2) * p_vertex_count, p_vertices);
glEnableVertexAttribArray(VS::ARRAY_VERTEX);
glVertexAttribPointer(VS::ARRAY_VERTEX, 2, GL_FLOAT, false, sizeof(Vector2), CAST_INT_TO_UCHAR_PTR(buffer_ofs));
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 7acb8a22bc..b3a1d32bf4 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -4297,7 +4297,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
use_mrt = use_mrt && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_TRANSPARENT];
use_mrt = use_mrt && !storage->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_NO_3D_EFFECTS];
use_mrt = use_mrt && state.debug_draw != VS::VIEWPORT_DEBUG_DRAW_OVERDRAW;
- use_mrt = use_mrt && env && (env->bg_mode != VS::ENV_BG_KEEP && env->bg_mode != VS::ENV_BG_CANVAS);
+ use_mrt = use_mrt && (env->bg_mode != VS::ENV_BG_KEEP && env->bg_mode != VS::ENV_BG_CANVAS);
glViewport(0, 0, storage->frame.current_rt->width, storage->frame.current_rt->height);
@@ -4454,16 +4454,16 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
RID camera_RGBA = feed->get_texture(CameraServer::FEED_RGBA_IMAGE);
VS::get_singleton()->texture_bind(camera_RGBA, 0);
- } else if (feed->get_datatype() == CameraFeed::FEED_YCbCr) {
- RID camera_YCbCr = feed->get_texture(CameraServer::FEED_YCbCr_IMAGE);
+ } else if (feed->get_datatype() == CameraFeed::FEED_YCBCR) {
+ RID camera_YCbCr = feed->get_texture(CameraServer::FEED_YCBCR_IMAGE);
VS::get_singleton()->texture_bind(camera_YCbCr, 0);
storage->shaders.copy.set_conditional(CopyShaderGLES3::YCBCR_TO_SRGB, true);
- } else if (feed->get_datatype() == CameraFeed::FEED_YCbCr_Sep) {
+ } else if (feed->get_datatype() == CameraFeed::FEED_YCBCR_SEP) {
RID camera_Y = feed->get_texture(CameraServer::FEED_Y_IMAGE);
- RID camera_CbCr = feed->get_texture(CameraServer::FEED_CbCr_IMAGE);
+ RID camera_CbCr = feed->get_texture(CameraServer::FEED_CBCR_IMAGE);
VS::get_singleton()->texture_bind(camera_Y, 0);
VS::get_singleton()->texture_bind(camera_CbCr, 1);
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index f8a3283869..96094dd0ad 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -6074,10 +6074,7 @@ void RasterizerStorageGLES3::particles_set_emitting(RID p_particles, bool p_emit
Particles *particles = particles_owner.getornull(p_particles);
ERR_FAIL_COND(!particles);
- if (p_emitting != particles->emitting) {
- // Restart is overridden by set_emitting
- particles->restart_request = false;
- }
+
particles->emitting = p_emitting;
}
@@ -6475,7 +6472,6 @@ void RasterizerStorageGLES3::update_particles() {
Particles *particles = particle_update_list.first()->self();
if (particles->restart_request) {
- particles->emitting = true; //restart from zero
particles->prev_ticks = 0;
particles->phase = 0;
particles->prev_phase = 0;
@@ -6713,9 +6709,7 @@ void RasterizerStorageGLES3::instance_add_dependency(RID p_base, RasterizerScene
ERR_FAIL_COND(!inst);
} break;
default: {
- if (!inst) {
- ERR_FAIL();
- }
+ ERR_FAIL();
}
}
@@ -6760,15 +6754,10 @@ void RasterizerStorageGLES3::instance_remove_dependency(RID p_base, RasterizerSc
ERR_FAIL_COND(!inst);
} break;
default: {
-
- if (!inst) {
- ERR_FAIL();
- }
+ ERR_FAIL();
}
}
- ERR_FAIL_COND(!inst);
-
inst->instance_list.remove(&p_instance->dependency_item);
}
diff --git a/drivers/png/image_loader_png.cpp b/drivers/png/image_loader_png.cpp
index 0bf432c78a..f257fafd93 100644
--- a/drivers/png/image_loader_png.cpp
+++ b/drivers/png/image_loader_png.cpp
@@ -32,186 +32,26 @@
#include "core/os/os.h"
#include "core/print_string.h"
+#include "drivers/png/png_driver_common.h"
#include <string.h>
-void ImageLoaderPNG::_read_png_data(png_structp png_ptr, png_bytep data, png_size_t p_length) {
-
- FileAccess *f = (FileAccess *)png_get_io_ptr(png_ptr);
- f->get_buffer((uint8_t *)data, p_length);
-}
-
-/*
-png_structp png_ptr = png_create_read_struct_2
- (PNG_LIBPNG_VER_STRING, (png_voidp)user_error_ptr,
- user_error_fn, user_warning_fn, (png_voidp)
- user_mem_ptr, user_malloc_fn, user_free_fn);
-*/
-static png_voidp _png_malloc_fn(png_structp png_ptr, png_size_t size) {
-
- return memalloc(size);
-}
-
-static void _png_free_fn(png_structp png_ptr, png_voidp ptr) {
-
- memfree(ptr);
-}
-
-static void _png_error_function(png_structp, png_const_charp text) {
-
- ERR_PRINT(text);
-}
-
-static void _png_warn_function(png_structp, png_const_charp text) {
-#ifdef TOOLS_ENABLED
- if (Engine::get_singleton()->is_editor_hint()) {
- if (String(text).begins_with("iCCP")) return; // silences annoying spam emitted to output every time the user opened assetlib
- }
-#endif
- WARN_PRINT(text);
-}
-
-typedef void(PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
-
-Error ImageLoaderPNG::_load_image(void *rf_up, png_rw_ptr p_func, Ref<Image> p_image) {
-
- png_structp png;
- png_infop info;
-
- //png = png_create_read_struct(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, NULL, NULL);
-
- png = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, (png_voidp)NULL, _png_error_function, _png_warn_function, (png_voidp)NULL,
- _png_malloc_fn, _png_free_fn);
-
- ERR_FAIL_COND_V(!png, ERR_OUT_OF_MEMORY);
-
- info = png_create_info_struct(png);
- if (!info) {
- png_destroy_read_struct(&png, NULL, NULL);
- ERR_PRINT("Out of Memory");
- return ERR_OUT_OF_MEMORY;
- }
-
- if (setjmp(png_jmpbuf(png))) {
-
- png_destroy_read_struct(&png, NULL, NULL);
- ERR_PRINT("PNG Corrupted");
- return ERR_FILE_CORRUPT;
- }
-
- png_set_read_fn(png, (void *)rf_up, p_func);
-
- png_uint_32 width, height;
- int depth, color;
-
- png_read_info(png, info);
- png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL);
-
- //https://svn.gov.pt/projects/ccidadao/repository/middleware-offline/trunk/_src/eidmw/FreeImagePTEiD/Source/FreeImage/PluginPNG.cpp
- //png_get_text(png,info,)
- /*
- printf("Image width:%i\n", width);
- printf("Image Height:%i\n", height);
- printf("Bit depth:%i\n", depth);
- printf("Color type:%i\n", color);
- */
-
- bool update_info = false;
-
- if (depth < 8) { //only bit dept 8 per channel is handled
-
- png_set_packing(png);
- update_info = true;
- };
-
- if (png_get_color_type(png, info) == PNG_COLOR_TYPE_PALETTE) {
- png_set_palette_to_rgb(png);
- update_info = true;
- }
-
- if (depth > 8) {
- png_set_strip_16(png);
- update_info = true;
- }
-
- if (png_get_valid(png, info, PNG_INFO_tRNS)) {
- //png_set_expand_gray_1_2_4_to_8(png);
- png_set_tRNS_to_alpha(png);
- update_info = true;
- }
-
- if (update_info) {
- png_read_update_info(png, info);
- png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL);
- }
-
- int components = 0;
-
- Image::Format fmt;
- switch (color) {
-
- case PNG_COLOR_TYPE_GRAY: {
-
- fmt = Image::FORMAT_L8;
- components = 1;
- } break;
- case PNG_COLOR_TYPE_GRAY_ALPHA: {
-
- fmt = Image::FORMAT_LA8;
- components = 2;
- } break;
- case PNG_COLOR_TYPE_RGB: {
-
- fmt = Image::FORMAT_RGB8;
- components = 3;
- } break;
- case PNG_COLOR_TYPE_RGB_ALPHA: {
-
- fmt = Image::FORMAT_RGBA8;
- components = 4;
- } break;
- default: {
+Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) {
- ERR_PRINT("INVALID PNG TYPE");
- png_destroy_read_struct(&png, &info, NULL);
- return ERR_UNAVAILABLE;
- } break;
+ const size_t buffer_size = f->get_len();
+ PoolVector<uint8_t> file_buffer;
+ Error err = file_buffer.resize(buffer_size);
+ if (err) {
+ f->close();
+ return err;
}
-
- //int rowsize = png_get_rowbytes(png, info);
- int rowsize = components * width;
-
- PoolVector<uint8_t> dstbuff;
-
- dstbuff.resize(rowsize * height);
-
- PoolVector<uint8_t>::Write dstbuff_write = dstbuff.write();
-
- uint8_t *data = dstbuff_write.ptr();
-
- uint8_t **row_p = memnew_arr(uint8_t *, height);
-
- for (unsigned int i = 0; i < height; i++) {
- row_p[i] = &data[components * width * i];
+ {
+ PoolVector<uint8_t>::Write writer = file_buffer.write();
+ f->get_buffer(writer.ptr(), buffer_size);
+ f->close();
}
-
- png_read_image(png, (png_bytep *)row_p);
-
- memdelete_arr(row_p);
-
- p_image->create(width, height, 0, fmt, dstbuff);
-
- png_destroy_read_struct(&png, &info, NULL);
-
- return OK;
-}
-
-Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) {
-
- Error err = _load_image(f, _read_png_data, p_image);
- f->close();
-
- return err;
+ PoolVector<uint8_t>::Read reader = file_buffer.read();
+ return PNGDriverCommon::png_to_image(reader.ptr(), buffer_size, p_image);
}
void ImageLoaderPNG::get_recognized_extensions(List<String> *p_extensions) const {
@@ -219,178 +59,53 @@ void ImageLoaderPNG::get_recognized_extensions(List<String> *p_extensions) const
p_extensions->push_back("png");
}
-struct PNGReadStatus {
-
- uint32_t offset;
- uint32_t size;
- const unsigned char *image;
-};
-
-static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t p_length) {
-
- PNGReadStatus *rstatus;
- rstatus = (PNGReadStatus *)png_get_io_ptr(png_ptr);
-
- png_size_t to_read = MIN(p_length, rstatus->size - rstatus->offset);
- memcpy(data, &rstatus->image[rstatus->offset], to_read);
- rstatus->offset += to_read;
-
- if (to_read < p_length) {
- memset(&data[to_read], 0, p_length - to_read);
- }
-}
-
-static Ref<Image> _load_mem_png(const uint8_t *p_png, int p_size) {
-
- PNGReadStatus prs;
- prs.image = p_png;
- prs.offset = 0;
- prs.size = p_size;
+Ref<Image> ImageLoaderPNG::load_mem_png(const uint8_t *p_png, int p_size) {
Ref<Image> img;
img.instance();
- Error err = ImageLoaderPNG::_load_image(&prs, user_read_data, img);
+
+ Error err = PNGDriverCommon::png_to_image(p_png, p_size, img);
ERR_FAIL_COND_V(err, Ref<Image>());
return img;
}
-static Ref<Image> _lossless_unpack_png(const PoolVector<uint8_t> &p_data) {
+Ref<Image> ImageLoaderPNG::lossless_unpack_png(const PoolVector<uint8_t> &p_data) {
- int len = p_data.size();
+ const int len = p_data.size();
ERR_FAIL_COND_V(len < 4, Ref<Image>());
PoolVector<uint8_t>::Read r = p_data.read();
ERR_FAIL_COND_V(r[0] != 'P' || r[1] != 'N' || r[2] != 'G' || r[3] != ' ', Ref<Image>());
- return _load_mem_png(&r[4], len - 4);
-}
-
-static void _write_png_data(png_structp png_ptr, png_bytep data, png_size_t p_length) {
-
- PoolVector<uint8_t> &v = *(PoolVector<uint8_t> *)png_get_io_ptr(png_ptr);
- int vs = v.size();
-
- v.resize(vs + p_length);
- PoolVector<uint8_t>::Write w = v.write();
- copymem(&w[vs], data, p_length);
+ return load_mem_png(&r[4], len - 4);
}
-static PoolVector<uint8_t> _lossless_pack_png(const Ref<Image> &p_image) {
-
- Ref<Image> img = p_image->duplicate();
-
- if (img->is_compressed())
- img->decompress();
-
- ERR_FAIL_COND_V(img->is_compressed(), PoolVector<uint8_t>());
-
- png_structp png_ptr;
- png_infop info_ptr;
- png_bytep *row_pointers;
-
- /* initialize stuff */
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+PoolVector<uint8_t> ImageLoaderPNG::lossless_pack_png(const Ref<Image> &p_image) {
- ERR_FAIL_COND_V(!png_ptr, PoolVector<uint8_t>());
+ PoolVector<uint8_t> out_buffer;
- info_ptr = png_create_info_struct(png_ptr);
-
- ERR_FAIL_COND_V(!info_ptr, PoolVector<uint8_t>());
-
- if (setjmp(png_jmpbuf(png_ptr))) {
+ // add Godot's own "PNG " prefix
+ if (out_buffer.resize(4) != OK) {
ERR_FAIL_V(PoolVector<uint8_t>());
}
- PoolVector<uint8_t> ret;
- ret.push_back('P');
- ret.push_back('N');
- ret.push_back('G');
- ret.push_back(' ');
- png_set_write_fn(png_ptr, &ret, _write_png_data, NULL);
-
- /* write header */
- if (setjmp(png_jmpbuf(png_ptr))) {
- ERR_FAIL_V(PoolVector<uint8_t>());
+ // scope for writer lifetime
+ {
+ // must be closed before call to image_to_png
+ PoolVector<uint8_t>::Write writer = out_buffer.write();
+ copymem(writer.ptr(), "PNG ", 4);
}
- int pngf = 0;
- int cs = 0;
-
- switch (img->get_format()) {
-
- case Image::FORMAT_L8: {
-
- pngf = PNG_COLOR_TYPE_GRAY;
- cs = 1;
- } break;
- case Image::FORMAT_LA8: {
-
- pngf = PNG_COLOR_TYPE_GRAY_ALPHA;
- cs = 2;
- } break;
- case Image::FORMAT_RGB8: {
-
- pngf = PNG_COLOR_TYPE_RGB;
- cs = 3;
- } break;
- case Image::FORMAT_RGBA8: {
-
- pngf = PNG_COLOR_TYPE_RGB_ALPHA;
- cs = 4;
- } break;
- default: {
-
- if (img->detect_alpha()) {
-
- img->convert(Image::FORMAT_RGBA8);
- pngf = PNG_COLOR_TYPE_RGB_ALPHA;
- cs = 4;
- } else {
-
- img->convert(Image::FORMAT_RGB8);
- pngf = PNG_COLOR_TYPE_RGB;
- cs = 3;
- }
- }
- }
-
- int w = img->get_width();
- int h = img->get_height();
- png_set_IHDR(png_ptr, info_ptr, w, h,
- 8, pngf, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
-
- png_write_info(png_ptr, info_ptr);
-
- /* write bytes */
- if (setjmp(png_jmpbuf(png_ptr))) {
+ Error err = PNGDriverCommon::image_to_png(p_image, out_buffer);
+ if (err) {
ERR_FAIL_V(PoolVector<uint8_t>());
}
- PoolVector<uint8_t>::Read r = img->get_data().read();
-
- row_pointers = (png_bytep *)memalloc(sizeof(png_bytep) * h);
- for (int i = 0; i < h; i++) {
-
- row_pointers[i] = (png_bytep)&r[i * w * cs];
- }
- png_write_image(png_ptr, row_pointers);
-
- memfree(row_pointers);
-
- /* end write */
- if (setjmp(png_jmpbuf(png_ptr))) {
-
- ERR_FAIL_V(PoolVector<uint8_t>());
- }
-
- png_write_end(png_ptr, NULL);
-
- return ret;
+ return out_buffer;
}
ImageLoaderPNG::ImageLoaderPNG() {
- Image::_png_mem_loader_func = _load_mem_png;
- Image::lossless_unpacker = _lossless_unpack_png;
- Image::lossless_packer = _lossless_pack_png;
+ Image::_png_mem_loader_func = load_mem_png;
+ Image::lossless_unpacker = lossless_unpack_png;
+ Image::lossless_packer = lossless_pack_png;
}
diff --git a/drivers/png/image_loader_png.h b/drivers/png/image_loader_png.h
index c3951979c3..cc789f95d6 100644
--- a/drivers/png/image_loader_png.h
+++ b/drivers/png/image_loader_png.h
@@ -33,17 +33,16 @@
#include "core/io/image_loader.h"
-#include <png.h>
-
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
class ImageLoaderPNG : public ImageFormatLoader {
-
- static void _read_png_data(png_structp png_ptr, png_bytep data, png_size_t p_length);
+private:
+ static PoolVector<uint8_t> lossless_pack_png(const Ref<Image> &p_image);
+ static Ref<Image> lossless_unpack_png(const PoolVector<uint8_t> &p_data);
+ static Ref<Image> load_mem_png(const uint8_t *p_png, int p_size);
public:
- static Error _load_image(void *rf_up, png_rw_ptr p_func, Ref<Image> p_image);
virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
ImageLoaderPNG();
diff --git a/drivers/png/png_driver_common.cpp b/drivers/png/png_driver_common.cpp
new file mode 100644
index 0000000000..0e849bf2fe
--- /dev/null
+++ b/drivers/png/png_driver_common.cpp
@@ -0,0 +1,205 @@
+/*************************************************************************/
+/* png_driver_common.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "png_driver_common.h"
+
+#include "core/os/os.h"
+
+#include <png.h>
+#include <string.h>
+
+namespace PNGDriverCommon {
+
+// Print any warnings.
+// On error, set explain and return true.
+// Call should be wrapped in ERR_FAIL_COND
+static bool check_error(const png_image &image) {
+ const png_uint_32 failed = PNG_IMAGE_FAILED(image);
+ if (failed & PNG_IMAGE_ERROR) {
+ ERR_EXPLAINC(image.message);
+ return true;
+ } else if (failed) {
+#ifdef TOOLS_ENABLED
+ // suppress this warning, to avoid log spam when opening assetlib
+ const static char *const noisy = "iCCP: known incorrect sRGB profile";
+ const Engine *const eng = Engine::get_singleton();
+ if (eng && eng->is_editor_hint() && !strcmp(image.message, noisy)) {
+ return false;
+ }
+#endif
+ WARN_PRINT(image.message);
+ }
+ return false;
+}
+
+Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image) {
+
+ png_image png_img;
+ zeromem(&png_img, sizeof(png_img));
+ png_img.version = PNG_IMAGE_VERSION;
+
+ // fetch image properties
+ int success = png_image_begin_read_from_memory(&png_img, p_source, p_size);
+ ERR_FAIL_COND_V(check_error(png_img), ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT);
+
+ // flags to be masked out of input format to give target format
+ const png_uint_32 format_mask = ~(
+ // convert component order to RGBA
+ PNG_FORMAT_FLAG_BGR | PNG_FORMAT_FLAG_AFIRST
+ // convert 16 bit components to 8 bit
+ | PNG_FORMAT_FLAG_LINEAR
+ // convert indexed image to direct color
+ | PNG_FORMAT_FLAG_COLORMAP);
+
+ png_img.format &= format_mask;
+
+ Image::Format dest_format;
+ switch (png_img.format) {
+ case PNG_FORMAT_GRAY:
+ dest_format = Image::FORMAT_L8;
+ break;
+ case PNG_FORMAT_GA:
+ dest_format = Image::FORMAT_LA8;
+ break;
+ case PNG_FORMAT_RGB:
+ dest_format = Image::FORMAT_RGB8;
+ break;
+ case PNG_FORMAT_RGBA:
+ dest_format = Image::FORMAT_RGBA8;
+ break;
+ default:
+ png_image_free(&png_img); // only required when we return before finish_read
+ ERR_PRINT("Unsupported png format");
+ return ERR_UNAVAILABLE;
+ }
+
+ const png_uint_32 stride = PNG_IMAGE_ROW_STRIDE(png_img);
+ PoolVector<uint8_t> buffer;
+ Error err = buffer.resize(PNG_IMAGE_BUFFER_SIZE(png_img, stride));
+ if (err) {
+ png_image_free(&png_img); // only required when we return before finish_read
+ return err;
+ }
+ PoolVector<uint8_t>::Write writer = buffer.write();
+
+ // read image data to buffer and release libpng resources
+ success = png_image_finish_read(&png_img, NULL, writer.ptr(), stride, NULL);
+ ERR_FAIL_COND_V(check_error(png_img), ERR_FILE_CORRUPT);
+ ERR_FAIL_COND_V(!success, ERR_FILE_CORRUPT);
+
+ p_image->create(png_img.width, png_img.height, 0, dest_format, buffer);
+
+ return OK;
+}
+
+Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer) {
+
+ Ref<Image> source_image = p_image->duplicate();
+
+ if (source_image->is_compressed())
+ source_image->decompress();
+
+ ERR_FAIL_COND_V(source_image->is_compressed(), FAILED);
+
+ png_image png_img;
+ zeromem(&png_img, sizeof(png_img));
+ png_img.version = PNG_IMAGE_VERSION;
+ png_img.width = source_image->get_width();
+ png_img.height = source_image->get_height();
+
+ switch (source_image->get_format()) {
+ case Image::FORMAT_L8:
+ png_img.format = PNG_FORMAT_GRAY;
+ break;
+ case Image::FORMAT_LA8:
+ png_img.format = PNG_FORMAT_GA;
+ break;
+ case Image::FORMAT_RGB8:
+ png_img.format = PNG_FORMAT_RGB;
+ break;
+ case Image::FORMAT_RGBA8:
+ png_img.format = PNG_FORMAT_RGBA;
+ break;
+ default:
+ if (source_image->detect_alpha()) {
+ source_image->convert(Image::FORMAT_RGBA8);
+ png_img.format = PNG_FORMAT_RGBA;
+ } else {
+ source_image->convert(Image::FORMAT_RGB8);
+ png_img.format = PNG_FORMAT_RGB;
+ }
+ }
+
+ const PoolVector<uint8_t> image_data = source_image->get_data();
+ const PoolVector<uint8_t>::Read reader = image_data.read();
+
+ // we may be passed a buffer with existing content we're expected to append to
+ const int buffer_offset = p_buffer.size();
+
+ const size_t png_size_estimate = PNG_IMAGE_PNG_SIZE_MAX(png_img);
+
+ // try with estimated size
+ size_t compressed_size = png_size_estimate;
+ int success = 0;
+ { // scope writer lifetime
+ Error err = p_buffer.resize(buffer_offset + png_size_estimate);
+ ERR_FAIL_COND_V(err, err);
+
+ PoolVector<uint8_t>::Write writer = p_buffer.write();
+ success = png_image_write_to_memory(&png_img, &writer[buffer_offset],
+ &compressed_size, 0, reader.ptr(), 0, NULL);
+ ERR_FAIL_COND_V(check_error(png_img), FAILED);
+ }
+ if (!success) {
+ if (compressed_size <= png_size_estimate) {
+ // buffer was big enough, must be some other error
+ ERR_FAIL_V(FAILED);
+ }
+
+ // write failed due to buffer size, resize and retry
+ Error err = p_buffer.resize(buffer_offset + compressed_size);
+ ERR_FAIL_COND_V(err, err);
+
+ PoolVector<uint8_t>::Write writer = p_buffer.write();
+ success = png_image_write_to_memory(&png_img, &writer[buffer_offset],
+ &compressed_size, 0, reader.ptr(), 0, NULL);
+ ERR_FAIL_COND_V(check_error(png_img), FAILED);
+ ERR_FAIL_COND_V(!success, FAILED);
+ }
+
+ // trim buffer size to content
+ Error err = p_buffer.resize(buffer_offset + compressed_size);
+ ERR_FAIL_COND_V(err, err);
+
+ return OK;
+}
+
+} // namespace PNGDriverCommon
diff --git a/editor/editor_name_dialog.cpp b/drivers/png/png_driver_common.h
index 63a91a594c..3ff87759fb 100644
--- a/editor/editor_name_dialog.cpp
+++ b/drivers/png/png_driver_common.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_name_dialog.cpp */
+/* png_driver_common.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,66 +28,21 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "editor_name_dialog.h"
+#ifndef PNG_DRIVER_COMMON_H
+#define PNG_DRIVER_COMMON_H
-#include "core/class_db.h"
-#include "core/os/keyboard.h"
+#include "core/image.h"
+#include "core/pool_vector.h"
-void EditorNameDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
+namespace PNGDriverCommon {
- Ref<InputEventKey> k = p_event;
+// Attempt to load png from buffer (p_source, p_size) into p_image
+Error png_to_image(const uint8_t *p_source, size_t p_size, Ref<Image> p_image);
- if (k.is_valid()) {
+// Append p_image, as a png, to p_buffer.
+// Contents of p_buffer is unspecified if error returned.
+Error image_to_png(const Ref<Image> &p_image, PoolVector<uint8_t> &p_buffer);
- if (!k->is_pressed())
- return;
+} // namespace PNGDriverCommon
- switch (k->get_scancode()) {
- case KEY_KP_ENTER:
- case KEY_ENTER: {
-
- if (get_hide_on_ok())
- hide();
- ok_pressed();
- accept_event();
- } break;
- case KEY_ESCAPE: {
-
- hide();
- accept_event();
- } break;
- }
- }
-}
-
-void EditorNameDialog::_post_popup() {
-
- ConfirmationDialog::_post_popup();
- name->clear();
- name->grab_focus();
-}
-
-void EditorNameDialog::ok_pressed() {
-
- if (name->get_text() != "") {
- emit_signal("name_confirmed", name->get_text());
- }
-}
-
-void EditorNameDialog::_bind_methods() {
-
- ClassDB::bind_method("_line_gui_input", &EditorNameDialog::_line_gui_input);
-
- ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
-}
-
-EditorNameDialog::EditorNameDialog() {
- makevb = memnew(VBoxContainer);
- add_child(makevb);
- name = memnew(LineEdit);
- makevb->add_child(name);
- name->set_margin(MARGIN_TOP, 5);
- name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
- name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
- name->connect("gui_input", this, "_line_gui_input");
-}
+#endif
diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp
index 9e8043cbea..89e8ee32cc 100644
--- a/drivers/png/resource_saver_png.cpp
+++ b/drivers/png/resource_saver_png.cpp
@@ -32,17 +32,9 @@
#include "core/image.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
+#include "drivers/png/png_driver_common.h"
#include "scene/resources/texture.h"
-#include <png.h>
-
-static void _write_png_data(png_structp png_ptr, png_bytep data, png_size_t p_length) {
-
- FileAccess *f = (FileAccess *)png_get_io_ptr(png_ptr);
- f->store_buffer((const uint8_t *)data, p_length);
-}
-
Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
Ref<ImageTexture> texture = p_resource;
@@ -55,129 +47,27 @@ Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32
Error err = save_image(p_path, img);
- if (err == OK) {
- }
-
return err;
};
Error ResourceSaverPNG::save_image(const String &p_path, const Ref<Image> &p_img) {
- Ref<Image> img = p_img->duplicate();
-
- if (img->is_compressed())
- img->decompress();
-
- ERR_FAIL_COND_V(img->is_compressed(), ERR_INVALID_PARAMETER);
-
- png_structp png_ptr;
- png_infop info_ptr;
- png_bytep *row_pointers;
-
- /* initialize stuff */
- png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-
- ERR_FAIL_COND_V(!png_ptr, ERR_CANT_CREATE);
+ PoolVector<uint8_t> buffer;
+ Error err = PNGDriverCommon::image_to_png(p_img, buffer);
+ ERR_FAIL_COND_V(err, err);
+ FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err);
+ ERR_FAIL_COND_V(err, err);
- info_ptr = png_create_info_struct(png_ptr);
+ PoolVector<uint8_t>::Read reader = buffer.read();
- ERR_FAIL_COND_V(!info_ptr, ERR_CANT_CREATE);
-
- if (setjmp(png_jmpbuf(png_ptr))) {
- ERR_FAIL_V(ERR_CANT_OPEN);
- }
- //change this
- Error err;
- FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE, &err);
- if (err) {
- ERR_FAIL_V(err);
- }
-
- png_set_write_fn(png_ptr, f, _write_png_data, NULL);
-
- /* write header */
- if (setjmp(png_jmpbuf(png_ptr))) {
- ERR_FAIL_V(ERR_CANT_OPEN);
+ file->store_buffer(reader.ptr(), buffer.size());
+ if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) {
+ memdelete(file);
+ return ERR_CANT_CREATE;
}
- int pngf = 0;
- int cs = 0;
-
- switch (img->get_format()) {
-
- case Image::FORMAT_L8: {
-
- pngf = PNG_COLOR_TYPE_GRAY;
- cs = 1;
- } break;
- case Image::FORMAT_LA8: {
-
- pngf = PNG_COLOR_TYPE_GRAY_ALPHA;
- cs = 2;
- } break;
- case Image::FORMAT_RGB8: {
-
- pngf = PNG_COLOR_TYPE_RGB;
- cs = 3;
- } break;
- case Image::FORMAT_RGBA8: {
-
- pngf = PNG_COLOR_TYPE_RGB_ALPHA;
- cs = 4;
- } break;
- default: {
-
- if (img->detect_alpha()) {
-
- img->convert(Image::FORMAT_RGBA8);
- pngf = PNG_COLOR_TYPE_RGB_ALPHA;
- cs = 4;
- } else {
-
- img->convert(Image::FORMAT_RGB8);
- pngf = PNG_COLOR_TYPE_RGB;
- cs = 3;
- }
- }
- }
-
- int w = img->get_width();
- int h = img->get_height();
- png_set_IHDR(png_ptr, info_ptr, w, h,
- 8, pngf, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
-
- png_write_info(png_ptr, info_ptr);
-
- /* write bytes */
- if (setjmp(png_jmpbuf(png_ptr))) {
- memdelete(f);
- ERR_FAIL_V(ERR_CANT_OPEN);
- }
-
- PoolVector<uint8_t>::Read r = img->get_data().read();
-
- row_pointers = (png_bytep *)memalloc(sizeof(png_bytep) * h);
- for (int i = 0; i < h; i++) {
-
- row_pointers[i] = (png_bytep)&r[i * w * cs];
- }
- png_write_image(png_ptr, row_pointers);
-
- memfree(row_pointers);
-
- /* end write */
- if (setjmp(png_jmpbuf(png_ptr))) {
-
- memdelete(f);
- ERR_FAIL_V(ERR_CANT_OPEN);
- }
-
- png_write_end(png_ptr, NULL);
- memdelete(f);
-
- /* cleanup heap allocation */
- png_destroy_write_struct(&png_ptr, &info_ptr);
+ file->close();
+ memdelete(file);
return OK;
}
@@ -186,6 +76,7 @@ bool ResourceSaverPNG::recognize(const RES &p_resource) const {
return (p_resource.is_valid() && p_resource->is_class("ImageTexture"));
}
+
void ResourceSaverPNG::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
if (Object::cast_to<Texture>(*p_resource)) {
diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h
index 584ccd4908..9267f2d678 100644
--- a/drivers/png/resource_saver_png.h
+++ b/drivers/png/resource_saver_png.h
@@ -35,7 +35,6 @@
#include "core/io/resource_saver.h"
class ResourceSaverPNG : public ResourceFormatSaver {
- GDCLASS(ResourceSaverPNG, ResourceFormatSaver)
public:
static Error save_image(const String &p_path, const Ref<Image> &p_img);
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index b5feaabc32..39ca9a823e 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -56,6 +56,7 @@
#endif // MINGW hack
#endif
#else // UNIX
+#include <net/if.h>
#include <netdb.h>
#ifdef ANDROID_ENABLED
// We could drop this file once we up our API level to 24,
@@ -77,6 +78,7 @@
static IP_Address _sockaddr2ip(struct sockaddr *p_addr) {
IP_Address ip;
+
if (p_addr->sa_family == AF_INET) {
struct sockaddr_in *addr = (struct sockaddr_in *)p_addr;
ip.set_ipv4((uint8_t *)&(addr->sin_addr));
@@ -129,24 +131,42 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
#if defined(UWP_ENABLED)
-void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
+void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
using namespace Windows::Networking;
using namespace Windows::Networking::Connectivity;
+ // Returns addresses, not interfaces.
auto hostnames = NetworkInformation::GetHostNames();
for (int i = 0; i < hostnames->Size; i++) {
- if (hostnames->GetAt(i)->Type == HostNameType::Ipv4 || hostnames->GetAt(i)->Type == HostNameType::Ipv6 && hostnames->GetAt(i)->IPInformation != nullptr) {
+ auto hostname = hostnames->GetAt(i);
+
+ if (hostname->Type != HostNameType::Ipv4 && hostname->Type != HostNameType::Ipv6)
+ continue;
- r_addresses->push_back(IP_Address(String(hostnames->GetAt(i)->CanonicalName->Data())));
+ String name = hostname->RawName->Data();
+ Map<String, Interface_Info>::Element *E = r_interfaces->find(name);
+ if (!E) {
+ Interface_Info info;
+ info.name = name;
+ info.name_friendly = hostname->DisplayName->Data();
+ info.index = 0;
+ E = r_interfaces->insert(name, info);
+ ERR_CONTINUE(!E);
}
+
+ Interface_Info &info = E->get();
+
+ IP_Address ip = IP_Address(hostname->CanonicalName->Data());
+ info.ip_addresses.push_front(ip);
}
-};
+}
+
#else
-void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
+void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
ULONG buf_size = 1024;
IP_ADAPTER_ADDRESSES *addrs;
@@ -173,29 +193,23 @@ void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
while (adapter != NULL) {
+ Interface_Info info;
+ info.name = adapter->AdapterName;
+ info.name_friendly = adapter->FriendlyName;
+ info.index = String::num_uint64(adapter->IfIndex);
+
IP_ADAPTER_UNICAST_ADDRESS *address = adapter->FirstUnicastAddress;
while (address != NULL) {
-
- IP_Address ip;
-
- if (address->Address.lpSockaddr->sa_family == AF_INET) {
-
- SOCKADDR_IN *ipv4 = reinterpret_cast<SOCKADDR_IN *>(address->Address.lpSockaddr);
-
- ip.set_ipv4((uint8_t *)&(ipv4->sin_addr));
- r_addresses->push_back(ip);
-
- } else if (address->Address.lpSockaddr->sa_family == AF_INET6) { // ipv6
-
- SOCKADDR_IN6 *ipv6 = reinterpret_cast<SOCKADDR_IN6 *>(address->Address.lpSockaddr);
-
- ip.set_ipv6(ipv6->sin6_addr.s6_addr);
- r_addresses->push_back(ip);
- };
-
+ int family = address->Address.lpSockaddr->sa_family;
+ if (family != AF_INET && family != AF_INET6)
+ continue;
+ info.ip_addresses.push_front(_sockaddr2ip(address->Address.lpSockaddr));
address = address->Next;
- };
+ }
adapter = adapter->Next;
+ // Only add interface if it has at least one IP
+ if (info.ip_addresses.size() > 0)
+ r_interfaces->insert(info.name, info);
};
memfree(addrs);
@@ -205,7 +219,7 @@ void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
#else // UNIX
-void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
+void IP_Unix::get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const {
struct ifaddrs *ifAddrStruct = NULL;
struct ifaddrs *ifa = NULL;
@@ -222,8 +236,18 @@ void IP_Unix::get_local_addresses(List<IP_Address> *r_addresses) const {
if (family != AF_INET && family != AF_INET6)
continue;
- IP_Address ip = _sockaddr2ip(ifa->ifa_addr);
- r_addresses->push_back(ip);
+ Map<String, Interface_Info>::Element *E = r_interfaces->find(ifa->ifa_name);
+ if (!E) {
+ Interface_Info info;
+ info.name = ifa->ifa_name;
+ info.name_friendly = ifa->ifa_name;
+ info.index = String::num_uint64(if_nametoindex(ifa->ifa_name));
+ E = r_interfaces->insert(ifa->ifa_name, info);
+ ERR_CONTINUE(!E);
+ }
+
+ Interface_Info &info = E->get();
+ info.ip_addresses.push_front(_sockaddr2ip(ifa->ifa_addr));
}
if (ifAddrStruct != NULL) freeifaddrs(ifAddrStruct);
diff --git a/drivers/unix/ip_unix.h b/drivers/unix/ip_unix.h
index e36535146e..f9bb626cc4 100644
--- a/drivers/unix/ip_unix.h
+++ b/drivers/unix/ip_unix.h
@@ -43,7 +43,7 @@ class IP_Unix : public IP {
static IP *_create_unix();
public:
- virtual void get_local_addresses(List<IP_Address> *r_addresses) const;
+ virtual void get_local_interfaces(Map<String, Interface_Info> *r_interfaces) const;
static void make_default();
IP_Unix();
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp
index 75d51c8503..4bde7789e2 100644
--- a/drivers/unix/net_socket_posix.cpp
+++ b/drivers/unix/net_socket_posix.cpp
@@ -59,6 +59,14 @@
#define MSG_NOSIGNAL SO_NOSIGPIPE
#endif
+// BSD calls this flag IPV6_JOIN_GROUP
+#if !defined(IPV6_ADD_MEMBERSHIP) && defined(IPV6_JOIN_GROUP)
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
+#endif
+#if !defined(IPV6_DROP_MEMBERSHIP) && defined(IPV6_LEAVE_GROUP)
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
+#endif
+
// Some custom defines to minimize ifdefs
#define SOCK_EMPTY -1
#define SOCK_BUF(x) x
@@ -227,6 +235,58 @@ bool NetSocketPosix::_can_use_ip(const IP_Address p_ip, const bool p_for_bind) c
return true;
}
+_FORCE_INLINE_ Error NetSocketPosix::_change_multicast_group(IP_Address p_ip, String p_if_name, bool p_add) {
+
+ ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED);
+ ERR_FAIL_COND_V(!_can_use_ip(p_ip, false), ERR_INVALID_PARAMETER);
+
+ // Need to force level and af_family to IP(v4) when using dual stacking and provided multicast group is IPv4
+ IP::Type type = _ip_type == IP::TYPE_ANY && p_ip.is_ipv4() ? IP::TYPE_IPV4 : _ip_type;
+ // This needs to be the proper level for the multicast group, no matter if the socket is dual stacking.
+ int level = type == IP::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6;
+ int ret = -1;
+
+ IP_Address if_ip;
+ uint32_t if_v6id = 0;
+ Map<String, IP::Interface_Info> if_info;
+ IP::get_singleton()->get_local_interfaces(&if_info);
+ for (Map<String, IP::Interface_Info>::Element *E = if_info.front(); E; E = E->next()) {
+ IP::Interface_Info &c = E->get();
+ if (c.name != p_if_name)
+ continue;
+
+ if_v6id = (uint32_t)c.index.to_int64();
+ if (type == IP::TYPE_IPV6)
+ break; // IPv6 uses index.
+
+ for (List<IP_Address>::Element *F = c.ip_addresses.front(); F; F = F->next()) {
+ if (!F->get().is_ipv4())
+ continue; // Wrong IP type
+ if_ip = F->get();
+ break;
+ }
+ break;
+ }
+
+ if (level == IPPROTO_IP) {
+ ERR_FAIL_COND_V(!if_ip.is_valid(), ERR_INVALID_PARAMETER);
+ struct ip_mreq greq;
+ int sock_opt = p_add ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP;
+ copymem(&greq.imr_multiaddr, p_ip.get_ipv4(), 4);
+ copymem(&greq.imr_interface, if_ip.get_ipv4(), 4);
+ ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq));
+ } else {
+ struct ipv6_mreq greq;
+ int sock_opt = p_add ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP;
+ copymem(&greq.ipv6mr_multiaddr, p_ip.get_ipv6(), 16);
+ greq.ipv6mr_interface = if_v6id;
+ ret = setsockopt(_sock, level, sock_opt, (const char *)&greq, sizeof(greq));
+ }
+ ERR_FAIL_COND_V(ret != 0, FAILED);
+
+ return OK;
+}
+
void NetSocketPosix::_set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream) {
_sock = p_sock;
_ip_type = p_ip_type;
@@ -421,7 +481,7 @@ Error NetSocketPosix::poll(PollType p_type, int p_timeout) const {
pfd.events = POLLOUT;
break;
case POLL_TYPE_IN_OUT:
- pfd.events = POLLOUT || POLLIN;
+ pfd.events = POLLOUT | POLLIN;
}
int ret = ::poll(&pfd, 1, p_timeout);
@@ -625,3 +685,11 @@ Ref<NetSocket> NetSocketPosix::accept(IP_Address &r_ip, uint16_t &r_port) {
ns->set_blocking_enabled(false);
return Ref<NetSocket>(ns);
}
+
+Error NetSocketPosix::join_multicast_group(const IP_Address &p_ip, String p_if_name) {
+ return _change_multicast_group(p_ip, p_if_name, true);
+}
+
+Error NetSocketPosix::leave_multicast_group(const IP_Address &p_ip, String p_if_name) {
+ return _change_multicast_group(p_ip, p_if_name, false);
+}
diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h
index b7fb3fdc94..cf0412311d 100644
--- a/drivers/unix/net_socket_posix.h
+++ b/drivers/unix/net_socket_posix.h
@@ -60,6 +60,7 @@ private:
NetError _get_socket_error();
void _set_socket(SOCKET_TYPE p_sock, IP::Type p_ip_type, bool p_is_stream);
+ _FORCE_INLINE_ Error _change_multicast_group(IP_Address p_ip, String p_if_name, bool p_add);
protected:
static NetSocket *_create_func();
@@ -93,6 +94,8 @@ public:
virtual void set_tcp_no_delay_enabled(bool p_enabled);
virtual void set_reuse_address_enabled(bool p_enabled);
virtual void set_reuse_port_enabled(bool p_enabled);
+ virtual Error join_multicast_group(const IP_Address &p_multi_address, String p_if_name);
+ virtual Error leave_multicast_group(const IP_Address &p_multi_address, String p_if_name);
NetSocketPosix();
~NetSocketPosix();
diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h
index 66c818f09d..49aab48719 100644
--- a/editor/animation_bezier_editor.h
+++ b/editor/animation_bezier_editor.h
@@ -35,7 +35,7 @@
class AnimationBezierTrackEdit : public Control {
- GDCLASS(AnimationBezierTrackEdit, Control)
+ GDCLASS(AnimationBezierTrackEdit, Control);
enum HandleMode {
HANDLE_MODE_FREE,
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 3295753bda..1bed5a9524 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1203,7 +1203,9 @@ AnimationTimelineEdit::AnimationTimelineEdit() {
////////////////////////////////////
void AnimationTrackEdit::_notification(int p_what) {
+
if (p_what == NOTIFICATION_DRAW) {
+
if (animation.is_null())
return;
ERR_FAIL_INDEX(track, animation->get_track_count());
@@ -1240,20 +1242,15 @@ void AnimationTrackEdit::_notification(int p_what) {
int ofs = in_group ? check->get_width() : 0; //not the best reference for margin but..
check_rect = Rect2(Point2(ofs, int(get_size().height - check->get_height()) / 2), check->get_size());
-
draw_texture(check, check_rect.position);
-
ofs += check->get_width() + hsep;
Ref<Texture> type_icon = type_icons[animation->track_get_type(track)];
-
draw_texture(type_icon, Point2(ofs, int(get_size().height - type_icon->get_height()) / 2));
ofs += type_icon->get_width() + hsep;
NodePath path = animation->track_get_path(track);
-
Node *node = NULL;
-
if (root && root->has_node(path)) {
node = root->get_node(path);
}
@@ -1308,12 +1305,11 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_line(Point2(limit, 0), Point2(limit, get_size().height), linecolor, Math::round(EDSCALE));
}
- // KEYFAMES //
+ // KEYFRAMES //
draw_bg(limit, get_size().width - timeline->get_buttons_width());
{
-
float scale = timeline->get_zoom_scale();
int limit_end = get_size().width - timeline->get_buttons_width();
@@ -1342,6 +1338,7 @@ void AnimationTrackEdit::_notification(int p_what) {
draw_fg(limit, get_size().width - timeline->get_buttons_width());
// BUTTONS //
+
{
Ref<Texture> wrap_icon[2] = {
@@ -1566,7 +1563,18 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
if (p_x < p_clip_left || p_x > p_clip_right)
return;
- Vector2 ofs(p_x - type_icon->get_width() / 2, int(get_size().height - type_icon->get_height()) / 2);
+ Ref<Texture> icon_to_draw = p_selected ? selected_icon : type_icon;
+
+ // Override type icon for invalid value keys, unless selected.
+ if (!p_selected && animation->track_get_type(track) == Animation::TYPE_VALUE) {
+ const Variant &v = animation->track_get_key_value(track, p_index);
+ Variant::Type valid_type = Variant::NIL;
+ if (!_is_value_key_valid(v, valid_type)) {
+ icon_to_draw = get_icon("KeyInvalid", "EditorIcons");
+ }
+ }
+
+ Vector2 ofs(p_x - icon_to_draw->get_width() / 2, int(get_size().height - icon_to_draw->get_height()) / 2);
if (animation->track_get_type(track) == Animation::TYPE_METHOD) {
Ref<Font> font = get_font("font", "Label");
@@ -1590,16 +1598,13 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool
}
text += ")";
- int limit = MAX(0, p_clip_right - p_x - type_icon->get_width());
+ int limit = MAX(0, p_clip_right - p_x - icon_to_draw->get_width());
if (limit > 0) {
- draw_string(font, Vector2(p_x + type_icon->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
+ draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height()) / 2 + font->get_ascent()), text, color, limit);
}
}
- if (p_selected) {
- draw_texture(selected_icon, ofs);
- } else {
- draw_texture(type_icon, ofs);
- }
+
+ draw_texture(icon_to_draw, ofs);
}
//helper
@@ -1764,6 +1769,27 @@ void AnimationTrackEdit::_path_entered(const String &p_text) {
undo_redo->commit_action();
}
+bool AnimationTrackEdit::_is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const {
+
+ RES res;
+ Vector<StringName> leftover_path;
+ Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
+
+ Object *obj = NULL;
+ if (res.is_valid()) {
+ obj = res.ptr();
+ } else if (node) {
+ obj = node;
+ }
+
+ bool prop_exists = false;
+ if (obj) {
+ r_valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
+ }
+
+ return (!prop_exists || Variant::can_convert(p_key_value.get_type(), r_valid_type));
+}
+
String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
if (check_rect.has_point(p_pos)) {
@@ -1834,29 +1860,10 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const {
} break;
case Animation::TYPE_VALUE: {
- Variant v = animation->track_get_key_value(track, key_idx);
- //text+="value: "+String(v)+"\n";
-
- bool prop_exists = false;
- Variant::Type valid_type = Variant::NIL;
- Object *obj = NULL;
-
- RES res;
- Vector<StringName> leftover_path;
- Node *node = root->get_node_and_resource(animation->track_get_path(track), res, leftover_path);
-
- if (res.is_valid()) {
- obj = res.ptr();
- } else if (node) {
- obj = node;
- }
-
- if (obj) {
- valid_type = obj->get_static_property_type_indexed(leftover_path, &prop_exists);
- }
-
+ const Variant &v = animation->track_get_key_value(track, key_idx);
text += "Type: " + Variant::get_type_name(v.get_type()) + "\n";
- if (prop_exists && !Variant::can_convert(v.get_type(), valid_type)) {
+ Variant::Type valid_type = Variant::NIL;
+ if (!_is_value_key_valid(v, valid_type)) {
text += "Value: " + String(v) + " (Invalid, expected type: " + Variant::get_type_name(valid_type) + ")\n";
} else {
text += "Value: " + String(v) + "\n";
@@ -2083,8 +2090,6 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
moving_selection_from_ofs = (mb->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale();
}
accept_event();
- } else {
- emit_signal("clear_selection");
}
}
@@ -2326,7 +2331,7 @@ void AnimationTrackEdit::set_in_group(bool p_enable) {
update();
}
-void AnimationTrackEdit::append_to_selection(const Rect2 &p_box) {
+void AnimationTrackEdit::append_to_selection(const Rect2 &p_box, bool p_deselection) {
Rect2 select_rect(timeline->get_name_limit(), 0, get_size().width - timeline->get_name_limit() - timeline->get_buttons_width(), get_size().height);
select_rect = select_rect.clip(p_box);
@@ -2339,7 +2344,10 @@ void AnimationTrackEdit::append_to_selection(const Rect2 &p_box) {
rect.position.x += offset;
if (select_rect.intersects(rect)) {
- emit_signal("select_key", i, false);
+ if (p_deselection)
+ emit_signal("deselect_key", i);
+ else
+ emit_signal("select_key", i, false);
}
}
}
@@ -4342,7 +4350,7 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
Rect2 local_rect = box_select_rect;
local_rect.position -= track_edits[i]->get_global_position();
- track_edits[i]->append_to_selection(local_rect);
+ track_edits[i]->append_to_selection(local_rect, mb->get_command());
}
if (_get_track_selected() == -1 && track_edits.size() > 0) { //minimal hack to make shortcuts work
@@ -4374,8 +4382,8 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
}
if (!box_selection->is_visible_in_tree()) {
- if (!mm->get_shift()) {
- _clear_selection(); //only append if shift is pressed
+ if (!mm->get_command() && !mm->get_shift()) {
+ _clear_selection();
}
box_selection->show();
}
@@ -4568,7 +4576,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) {
it->set_metadata(0, md);
}
- track_copy_dialog->popup_centered_minsize(Size2(300, 500) * EDSCALE);
+ track_copy_dialog->popup_centered_minsize(Size2(350, 500) * EDSCALE);
} break;
case EDIT_COPY_TRACKS_CONFIRM: {
@@ -4962,6 +4970,19 @@ void AnimationTrackEditor::_show_imported_anim_warning() const {
TTR("Warning: Editing imported animation"));
}
+void AnimationTrackEditor::_select_all_tracks_for_copy() {
+ TreeItem *track = track_copy_select->get_root()->get_children();
+ while (track) {
+ track->set_checked(0, selected_all_tracks);
+ track = track->get_next();
+ }
+ selected_all_tracks = !selected_all_tracks;
+ if (selected_all_tracks)
+ select_all_button->set_text(TTR("Select All"));
+ else
+ select_all_button->set_text(TTR("Select None"));
+}
+
void AnimationTrackEditor::_bind_methods() {
ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed);
@@ -5002,6 +5023,7 @@ void AnimationTrackEditor::_bind_methods() {
ClassDB::bind_method("_selection_changed", &AnimationTrackEditor::_selection_changed);
ClassDB::bind_method("_snap_mode_changed", &AnimationTrackEditor::_snap_mode_changed);
ClassDB::bind_method("_show_imported_anim_warning", &AnimationTrackEditor::_show_imported_anim_warning);
+ ClassDB::bind_method("_select_all_tracks_for_copy", &AnimationTrackEditor::_select_all_tracks_for_copy);
ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag")));
ADD_SIGNAL(MethodInfo("keying_changed"));
@@ -5284,9 +5306,22 @@ AnimationTrackEditor::AnimationTrackEditor() {
track_copy_dialog->set_title(TTR("Select tracks to copy:"));
track_copy_dialog->get_ok()->set_text(TTR("Copy"));
+ VBoxContainer *track_vbox = memnew(VBoxContainer);
+ track_copy_dialog->add_child(track_vbox);
+
+ selected_all_tracks = true;
+
track_copy_select = memnew(Tree);
+ track_copy_select->set_h_size_flags(SIZE_EXPAND_FILL);
+ track_copy_select->set_v_size_flags(SIZE_EXPAND_FILL);
track_copy_select->set_hide_root(true);
- track_copy_dialog->add_child(track_copy_select);
+ track_vbox->add_child(track_copy_select);
+ track_copy_options = memnew(HBoxContainer);
+ track_vbox->add_child(track_copy_options);
+ select_all_button = memnew(Button);
+ select_all_button->set_text(TTR("Select All"));
+ select_all_button->connect("pressed", this, "_select_all_tracks_for_copy");
+ track_copy_options->add_child(select_all_button);
track_copy_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_COPY_TRACKS_CONFIRM));
animation_changing_awaiting_update = false;
}
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h
index c64f663b3b..5f05c1de8c 100644
--- a/editor/animation_track_editor.h
+++ b/editor/animation_track_editor.h
@@ -31,6 +31,11 @@
#ifndef ANIMATION_TRACK_EDITOR_H
#define ANIMATION_TRACK_EDITOR_H
+#include "editor/editor_data.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_editor.h"
+#include "editor/property_selector.h"
+#include "scene/animation/animation_cache.h"
#include "scene/gui/control.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/menu_button.h"
@@ -40,17 +45,11 @@
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_rect.h"
#include "scene/gui/tool_button.h"
-
-#include "editor/property_selector.h"
-#include "editor_data.h"
-#include "editor_spin_slider.h"
-#include "property_editor.h"
-#include "scene/animation/animation_cache.h"
#include "scene/resources/animation.h"
#include "scene_tree_editor.h"
class AnimationTimelineEdit : public Range {
- GDCLASS(AnimationTimelineEdit, Range)
+ GDCLASS(AnimationTimelineEdit, Range);
Ref<Animation> animation;
int name_limit;
@@ -123,7 +122,7 @@ class AnimationTrackEditor;
class AnimationTrackEdit : public Control {
- GDCLASS(AnimationTrackEdit, Control)
+ GDCLASS(AnimationTrackEdit, Control);
enum {
MENU_CALL_MODE_CONTINUOUS,
@@ -175,8 +174,9 @@ class AnimationTrackEdit : public Control {
void _path_entered(const String &p_text);
void _play_position_draw();
- mutable int dropping_at;
+ bool _is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const;
+ mutable int dropping_at;
float insert_at_pos;
bool moving_selection_attempt;
int select_single_attempt;
@@ -231,13 +231,14 @@ public:
void cancel_drop();
void set_in_group(bool p_enable);
- void append_to_selection(const Rect2 &p_box);
+ void append_to_selection(const Rect2 &p_box, bool p_deselection);
AnimationTrackEdit();
};
class AnimationTrackEditPlugin : public Reference {
- GDCLASS(AnimationTrackEditPlugin, Reference)
+ GDCLASS(AnimationTrackEditPlugin, Reference);
+
public:
virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
virtual AnimationTrackEdit *create_audio_track_edit();
@@ -248,7 +249,7 @@ class AnimationTrackKeyEdit;
class AnimationBezierTrackEdit;
class AnimationTrackEditGroup : public Control {
- GDCLASS(AnimationTrackEditGroup, Control)
+ GDCLASS(AnimationTrackEditGroup, Control);
Ref<Texture> icon;
String node_name;
NodePath node;
@@ -271,7 +272,7 @@ public:
};
class AnimationTrackEditor : public VBoxContainer {
- GDCLASS(AnimationTrackEditor, VBoxContainer)
+ GDCLASS(AnimationTrackEditor, VBoxContainer);
enum {
EDIT_COPY_TRACKS,
@@ -445,6 +446,8 @@ class AnimationTrackEditor : public VBoxContainer {
ConfirmationDialog *scale_dialog;
SpinBox *scale;
+ void _select_all_tracks_for_copy();
+
void _edit_menu_pressed(int p_option);
int last_menu_track_opt;
@@ -458,8 +461,12 @@ class AnimationTrackEditor : public VBoxContainer {
void _selection_changed();
+ bool selected_all_tracks;
ConfirmationDialog *track_copy_dialog;
Tree *track_copy_select;
+ HBoxContainer *track_copy_options;
+ Button *select_all_button;
+
struct TrackClipboard {
NodePath full_path;
NodePath base_path;
diff --git a/editor/animation_track_editor_plugins.h b/editor/animation_track_editor_plugins.h
index a1ea7435b1..5f0ea6196c 100644
--- a/editor/animation_track_editor_plugins.h
+++ b/editor/animation_track_editor_plugins.h
@@ -34,7 +34,7 @@
#include "editor/animation_track_editor.h"
class AnimationTrackEditBool : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditBool, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditBool, AnimationTrackEdit);
Ref<Texture> icon_checked;
Ref<Texture> icon_unchecked;
@@ -46,7 +46,7 @@ public:
};
class AnimationTrackEditColor : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditColor, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditColor, AnimationTrackEdit);
public:
virtual int get_key_height() const;
@@ -57,7 +57,7 @@ public:
};
class AnimationTrackEditAudio : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditAudio, AnimationTrackEdit);
ObjectID id;
@@ -78,7 +78,7 @@ public:
};
class AnimationTrackEditSpriteFrame : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditSpriteFrame, AnimationTrackEdit);
ObjectID id;
@@ -92,7 +92,7 @@ public:
};
class AnimationTrackEditSubAnim : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditSubAnim, AnimationTrackEdit);
ObjectID id;
@@ -106,7 +106,7 @@ public:
};
class AnimationTrackEditTypeAudio : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditTypeAudio, AnimationTrackEdit);
void _preview_changed(ObjectID p_which);
@@ -134,7 +134,7 @@ public:
};
class AnimationTrackEditTypeAnimation : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditTypeAnimation, AnimationTrackEdit);
ObjectID id;
@@ -149,7 +149,7 @@ public:
};
class AnimationTrackEditVolumeDB : public AnimationTrackEdit {
- GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit)
+ GDCLASS(AnimationTrackEditVolumeDB, AnimationTrackEdit);
public:
virtual void draw_bg(int p_clip_left, int p_clip_right);
@@ -159,7 +159,8 @@ public:
};
class AnimationTrackEditDefaultPlugin : public AnimationTrackEditPlugin {
- GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin)
+ GDCLASS(AnimationTrackEditDefaultPlugin, AnimationTrackEditPlugin);
+
public:
virtual AnimationTrackEdit *create_value_track_edit(Object *p_object, Variant::Type p_type, const String &p_property, PropertyHint p_hint, const String &p_hint_string, int p_usage);
virtual AnimationTrackEdit *create_audio_track_edit();
diff --git a/editor/audio_stream_preview.h b/editor/audio_stream_preview.h
index 3b8975e3aa..fca0aabac1 100644
--- a/editor/audio_stream_preview.h
+++ b/editor/audio_stream_preview.h
@@ -36,7 +36,7 @@
#include "servers/audio/audio_stream.h"
class AudioStreamPreview : public Reference {
- GDCLASS(AudioStreamPreview, Reference)
+ GDCLASS(AudioStreamPreview, Reference);
friend class AudioStream;
Vector<uint8_t> preview;
float length;
@@ -52,7 +52,7 @@ public:
};
class AudioStreamPreviewGenerator : public Node {
- GDCLASS(AudioStreamPreviewGenerator, Node)
+ GDCLASS(AudioStreamPreviewGenerator, Node);
static AudioStreamPreviewGenerator *singleton;
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index e471993fc7..848921d870 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -587,6 +587,26 @@ FindReplaceBar::FindReplaceBar() {
/*** CODE EDITOR ****/
+// This function should be used to handle shortcuts that could otherwise
+// be handled too late if they weren't handled here.
+void CodeTextEditor::_input(const Ref<InputEvent> &event) {
+
+ const Ref<InputEventKey> key_event = event;
+ if (!key_event.is_valid() || !key_event->is_pressed())
+ return;
+
+ if (ED_IS_SHORTCUT("script_text_editor/move_up", key_event)) {
+ move_lines_up();
+ accept_event();
+ return;
+ }
+ if (ED_IS_SHORTCUT("script_text_editor/move_down", key_event)) {
+ move_lines_down();
+ accept_event();
+ return;
+ }
+}
+
void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
@@ -1197,6 +1217,11 @@ void CodeTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
text_editor->select(p_line, p_begin, p_line, p_end);
}
+void CodeTextEditor::goto_line_centered(int p_line) {
+ goto_line(p_line);
+ text_editor->call_deferred("center_viewport_to_cursor");
+}
+
void CodeTextEditor::set_executing_line(int p_line) {
text_editor->set_executing_line(p_line);
}
@@ -1375,6 +1400,9 @@ void CodeTextEditor::_notification(int p_what) {
warning_button->set_icon(get_icon("NodeWarning", "EditorIcons"));
add_constant_override("separation", 4 * EDSCALE);
} break;
+ case NOTIFICATION_VISIBILITY_CHANGED: {
+ set_process_input(is_visible_in_tree());
+ } break;
default:
break;
}
@@ -1454,6 +1482,7 @@ void CodeTextEditor::remove_all_bookmarks() {
void CodeTextEditor::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("_input"), &CodeTextEditor::_input);
ClassDB::bind_method("_text_editor_gui_input", &CodeTextEditor::_text_editor_gui_input);
ClassDB::bind_method("_line_col_changed", &CodeTextEditor::_line_col_changed);
ClassDB::bind_method("_text_changed", &CodeTextEditor::_text_changed);
diff --git a/editor/code_editor.h b/editor/code_editor.h
index 0ef8ec7061..c0989f9704 100644
--- a/editor/code_editor.h
+++ b/editor/code_editor.h
@@ -165,6 +165,7 @@ class CodeTextEditor : public VBoxContainer {
void _font_resize_timeout();
bool _add_font_size(int p_delta);
+ void _input(const Ref<InputEvent> &event);
void _text_editor_gui_input(const Ref<InputEvent> &p_event);
void _zoom_in();
void _zoom_out();
@@ -218,6 +219,7 @@ public:
void goto_line(int p_line);
void goto_line_selection(int p_line, int p_begin, int p_end);
+ void goto_line_centered(int p_line);
void set_executing_line(int p_line);
void clear_executing_line();
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index 03c4b25f5c..0eddbc3ceb 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -44,7 +44,7 @@
class CreateDialog : public ConfirmationDialog {
- GDCLASS(CreateDialog, ConfirmationDialog)
+ GDCLASS(CreateDialog, ConfirmationDialog);
Vector<String> favorite_list;
Tree *favorites;
diff --git a/editor/editor_audio_buses.h b/editor/editor_audio_buses.h
index 20890fd3b5..8781e6ff6c 100644
--- a/editor/editor_audio_buses.h
+++ b/editor/editor_audio_buses.h
@@ -52,7 +52,7 @@ class EditorAudioBuses;
class EditorAudioBus : public PanelContainer {
- GDCLASS(EditorAudioBus, PanelContainer)
+ GDCLASS(EditorAudioBus, PanelContainer);
Ref<Texture> disabled_vu;
LineEdit *track_name;
@@ -155,7 +155,7 @@ public:
class EditorAudioBuses : public VBoxContainer {
- GDCLASS(EditorAudioBuses, VBoxContainer)
+ GDCLASS(EditorAudioBuses, VBoxContainer);
HBoxContainer *top_hb;
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index 913eb35f8a..9f0b4250a3 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -789,7 +789,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() {
}
}
- if (!info.is_singleton && !info.in_editor) {
+ if (!info.is_singleton && !info.in_editor && info.node != NULL) {
memdelete(info.node);
info.node = NULL;
}
diff --git a/editor/editor_export.h b/editor/editor_export.h
index bd864c528c..7c01abe0e9 100644
--- a/editor/editor_export.h
+++ b/editor/editor_export.h
@@ -44,7 +44,8 @@ struct EditorProgress;
class EditorExportPreset : public Reference {
- GDCLASS(EditorExportPreset, Reference)
+ GDCLASS(EditorExportPreset, Reference);
+
public:
enum ExportFilter {
EXPORT_ALL_RESOURCES,
@@ -152,7 +153,7 @@ struct SharedObject {
class EditorExportPlatform : public Reference {
- GDCLASS(EditorExportPlatform, Reference)
+ GDCLASS(EditorExportPlatform, Reference);
public:
typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total);
@@ -272,7 +273,7 @@ public:
};
class EditorExportPlugin : public Reference {
- GDCLASS(EditorExportPlugin, Reference)
+ GDCLASS(EditorExportPlugin, Reference);
friend class EditorExportPlatform;
@@ -388,7 +389,7 @@ public:
class EditorExportPlatformPC : public EditorExportPlatform {
- GDCLASS(EditorExportPlatformPC, EditorExportPlatform)
+ GDCLASS(EditorExportPlatformPC, EditorExportPlatform);
Ref<ImageTexture> logo;
String name;
@@ -440,7 +441,7 @@ public:
class EditorExportTextSceneToBinaryPlugin : public EditorExportPlugin {
- GDCLASS(EditorExportTextSceneToBinaryPlugin, EditorExportPlugin)
+ GDCLASS(EditorExportTextSceneToBinaryPlugin, EditorExportPlugin);
public:
virtual void _export_file(const String &p_path, const String &p_type, const Set<String> &p_features);
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp
index 36a8772faf..c6646eb28b 100644
--- a/editor/editor_feature_profile.cpp
+++ b/editor/editor_feature_profile.cpp
@@ -42,7 +42,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = {
TTRC("Scene Tree Editing"),
TTRC("Import Dock"),
TTRC("Node Dock"),
- TTRC("Filesystem Dock")
+ TTRC("FileSystem and Import Docks")
};
const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = {
@@ -378,18 +378,21 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
switch (p_action) {
case PROFILE_CLEAR: {
+
EditorSettings::get_singleton()->set("_default_feature_profile", "");
EditorSettings::get_singleton()->save();
current_profile = "";
current.unref();
+
_update_profile_list();
+ _emit_current_profile_changed();
} break;
case PROFILE_SET: {
String selected = _get_selected_profile();
ERR_FAIL_COND(selected == String());
if (selected == current_profile) {
- return; //nothing to do here
+ return; // Nothing to do here.
}
EditorSettings::get_singleton()->set("_default_feature_profile", selected);
EditorSettings::get_singleton()->save();
@@ -397,7 +400,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
current = edited;
_update_profile_list();
-
+ _emit_current_profile_changed();
} break;
case PROFILE_IMPORT: {
@@ -415,6 +418,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) {
new_profile_name->grab_focus();
} break;
case PROFILE_ERASE: {
+
String selected = _get_selected_profile();
ERR_FAIL_COND(selected == String());
@@ -809,7 +813,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
profile_actions[PROFILE_CLEAR]->set_disabled(true);
profile_actions[PROFILE_CLEAR]->connect("pressed", this, "_profile_action", varray(PROFILE_CLEAR));
- main_vbc->add_margin_child(TTR("Current Profile"), name_hbc);
+ main_vbc->add_margin_child(TTR("Current Profile:"), name_hbc);
HBoxContainer *profiles_hbc = memnew(HBoxContainer);
profile_list = memnew(OptionButton);
@@ -844,7 +848,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
profile_actions[PROFILE_EXPORT]->set_disabled(true);
profile_actions[PROFILE_EXPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_EXPORT));
- main_vbc->add_margin_child(TTR("Available Profiles"), profiles_hbc);
+ main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc);
h_split = memnew(HSplitContainer);
h_split->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -855,9 +859,8 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL);
class_list = memnew(Tree);
- class_list_vbc->add_margin_child(TTR("Enabled Classes"), class_list, true);
+ class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true);
class_list->set_hide_root(true);
- class_list->set_hide_folding(true);
class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
class_list->connect("cell_selected", this, "_class_list_item_selected");
class_list->connect("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED);
diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h
index 494e8b5833..0550509ba2 100644
--- a/editor/editor_inspector.h
+++ b/editor/editor_inspector.h
@@ -48,7 +48,8 @@ public:
class EditorProperty : public Container {
- GDCLASS(EditorProperty, Container)
+ GDCLASS(EditorProperty, Container);
+
private:
String label;
int text_size;
@@ -167,7 +168,7 @@ public:
};
class EditorInspectorPlugin : public Reference {
- GDCLASS(EditorInspectorPlugin, Reference)
+ GDCLASS(EditorInspectorPlugin, Reference);
friend class EditorInspector;
struct AddedEditor {
diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp
new file mode 100644
index 0000000000..36f7b30016
--- /dev/null
+++ b/editor/editor_layouts_dialog.cpp
@@ -0,0 +1,138 @@
+/*************************************************************************/
+/* editor_layouts_dialog.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
+#include "editor_layouts_dialog.h"
+#include "core/class_db.h"
+#include "core/io/config_file.h"
+#include "core/os/keyboard.h"
+#include "editor/editor_settings.h"
+#include "scene/gui/item_list.h"
+#include "scene/gui/line_edit.h"
+
+void EditorLayoutsDialog::_line_gui_input(const Ref<InputEvent> &p_event) {
+ Ref<InputEventKey> k = p_event;
+
+ if (k.is_valid()) {
+
+ if (!k->is_pressed())
+ return;
+
+ switch (k->get_scancode()) {
+ case KEY_KP_ENTER:
+ case KEY_ENTER: {
+
+ if (get_hide_on_ok())
+ hide();
+ ok_pressed();
+ accept_event();
+ } break;
+ case KEY_ESCAPE: {
+
+ hide();
+ accept_event();
+ } break;
+ }
+ }
+}
+
+void EditorLayoutsDialog::_bind_methods() {
+ ClassDB::bind_method("_line_gui_input", &EditorLayoutsDialog::_line_gui_input);
+
+ ADD_SIGNAL(MethodInfo("name_confirmed", PropertyInfo(Variant::STRING, "name")));
+}
+
+void EditorLayoutsDialog::ok_pressed() {
+
+ if (layout_names->is_anything_selected()) {
+
+ Vector<int> const selected_items = layout_names->get_selected_items();
+ for (int i = 0; i < selected_items.size(); ++i) {
+
+ emit_signal("name_confirmed", layout_names->get_item_text(selected_items[i]));
+ }
+ } else if (name->is_visible() && name->get_text() != "") {
+
+ emit_signal("name_confirmed", name->get_text());
+ }
+}
+
+void EditorLayoutsDialog::_post_popup() {
+
+ ConfirmationDialog::_post_popup();
+ name->clear();
+ layout_names->clear();
+
+ Ref<ConfigFile> config;
+ config.instance();
+ Error err = config->load(EditorSettings::get_singleton()->get_editor_layouts_config());
+ if (err != OK) {
+
+ return;
+ }
+
+ List<String> layouts;
+ config.ptr()->get_sections(&layouts);
+
+ for (List<String>::Element *E = layouts.front(); E; E = E->next()) {
+
+ layout_names->add_item(**E);
+ }
+}
+
+EditorLayoutsDialog::EditorLayoutsDialog() {
+
+ makevb = memnew(VBoxContainer);
+ add_child(makevb);
+ makevb->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ makevb->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+
+ layout_names = memnew(ItemList);
+ makevb->add_child(layout_names);
+ layout_names->set_visible(true);
+ layout_names->set_margin(MARGIN_TOP, 5);
+ layout_names->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ layout_names->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+ layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL);
+ layout_names->set_select_mode(ItemList::SELECT_MULTI);
+ layout_names->set_allow_rmb_select(true);
+
+ name = memnew(LineEdit);
+ makevb->add_child(name);
+ name->set_margin(MARGIN_TOP, 5);
+ name->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 5);
+ name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -5);
+ name->connect("gui_input", this, "_line_gui_input");
+ name->connect("focus_entered", layout_names, "unselect_all");
+}
+
+void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
+
+ name->set_visible(p_enabled);
+}
diff --git a/editor/editor_name_dialog.h b/editor/editor_layouts_dialog.h
index 314fc27124..5e3a1d5a46 100644
--- a/editor/editor_name_dialog.h
+++ b/editor/editor_layouts_dialog.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_name_dialog.h */
+/* editor_layouts_dialog.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,18 +28,21 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITOR_NAME_DIALOG_H
-#define EDITOR_NAME_DIALOG_H
+#ifndef EDITOR_LAYOUTS_DIALOG_H
+#define EDITOR_LAYOUTS_DIALOG_H
#include "scene/gui/dialogs.h"
-#include "scene/gui/line_edit.h"
-class EditorNameDialog : public ConfirmationDialog {
+class LineEdit;
+class ItemList;
- GDCLASS(EditorNameDialog, ConfirmationDialog);
+class EditorLayoutsDialog : public ConfirmationDialog {
+
+ GDCLASS(EditorLayoutsDialog, ConfirmationDialog);
- VBoxContainer *makevb;
LineEdit *name;
+ ItemList *layout_names;
+ VBoxContainer *makevb;
void _line_gui_input(const Ref<InputEvent> &p_event);
@@ -49,9 +52,9 @@ protected:
virtual void _post_popup();
public:
- LineEdit *get_line_edit() { return name; }
+ EditorLayoutsDialog();
- EditorNameDialog();
+ void set_name_line_enabled(bool p_enabled);
};
-#endif // EDITOR_NAME_DIALOG_H
+#endif // EDITOR_LAYOUTS_DIALOG_H
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index b6d28dce29..1f08f3d787 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -2475,6 +2475,13 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
OS::get_singleton()->set_window_fullscreen(!OS::get_singleton()->is_window_fullscreen());
} break;
+ case SETTINGS_TOGGLE_CONSOLE: {
+
+ bool was_visible = OS::get_singleton()->is_console_visible();
+ OS::get_singleton()->set_console_visible(!was_visible);
+ EditorSettings::get_singleton()->set_setting("interface/editor/hide_console_window", !was_visible);
+
+ } break;
case SETTINGS_PICK_MAIN_SCENE: {
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
@@ -4249,6 +4256,7 @@ void EditorNode::_layout_menu_option(int p_id) {
layout_dialog->set_title(TTR("Save Layout"));
layout_dialog->get_ok()->set_text(TTR("Save"));
layout_dialog->popup_centered();
+ layout_dialog->set_name_line_enabled(true);
} break;
case SETTINGS_LAYOUT_DELETE: {
@@ -4256,6 +4264,7 @@ void EditorNode::_layout_menu_option(int p_id) {
layout_dialog->set_title(TTR("Delete Layout"));
layout_dialog->get_ok()->set_text(TTR("Delete"));
layout_dialog->popup_centered();
+ layout_dialog->set_name_line_enabled(false);
} break;
case SETTINGS_LAYOUT_DEFAULT: {
@@ -5044,7 +5053,9 @@ void EditorNode::_feature_profile_changed() {
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB));
- if (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) || profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB)) {
+ if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) ||
+ (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed()) ||
+ (profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) {
_editor_select(EDITOR_2D);
}
} else {
@@ -5056,6 +5067,7 @@ void EditorNode::_feature_profile_changed() {
node_dock->set_visible(true);
filesystem_dock->set_visible(true);
main_editor_buttons[EDITOR_3D]->set_visible(true);
+ main_editor_buttons[EDITOR_SCRIPT]->set_visible(true);
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true);
}
@@ -5871,6 +5883,9 @@ EditorNode::EditorNode() {
#else
p->add_shortcut(ED_SHORTCUT("editor/fullscreen_mode", TTR("Toggle Fullscreen"), KEY_MASK_SHIFT | KEY_F11), SETTINGS_TOGGLE_FULLSCREEN);
#endif
+#ifdef WINDOWS_ENABLED
+ p->add_item(TTR("Toggle System Console"), SETTINGS_TOGGLE_CONSOLE);
+#endif
p->add_separator();
if (OS::get_singleton()->get_data_path() == OS::get_singleton()->get_config_path()) {
@@ -6016,10 +6031,10 @@ EditorNode::EditorNode() {
progress_hb = memnew(BackgroundProgress);
- layout_dialog = memnew(EditorNameDialog);
+ layout_dialog = memnew(EditorLayoutsDialog);
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);
- layout_dialog->set_size(Size2(175, 70) * EDSCALE);
+ layout_dialog->set_size(Size2(225, 270) * EDSCALE);
layout_dialog->connect("name_confirmed", this, "_dialog_action");
update_menu = memnew(MenuButton);
diff --git a/editor/editor_node.h b/editor/editor_node.h
index f3bc95c409..46b9befcd6 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -41,8 +41,8 @@
#include "editor/editor_feature_profile.h"
#include "editor/editor_folding.h"
#include "editor/editor_inspector.h"
+#include "editor/editor_layouts_dialog.h"
#include "editor/editor_log.h"
-#include "editor/editor_name_dialog.h"
#include "editor/editor_plugin.h"
#include "editor/editor_resource_preview.h"
#include "editor/editor_run.h"
@@ -85,6 +85,7 @@
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/gui/viewport_container.h"
+
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -193,6 +194,7 @@ private:
SETTINGS_MANAGE_EXPORT_TEMPLATES,
SETTINGS_MANAGE_FEATURE_PROFILES,
SETTINGS_PICK_MAIN_SCENE,
+ SETTINGS_TOGGLE_CONSOLE,
SETTINGS_TOGGLE_FULLSCREEN,
SETTINGS_HELP,
SCENE_TAB_CLOSE,
@@ -307,7 +309,7 @@ private:
int overridden_default_layout;
Ref<ConfigFile> default_layout;
PopupMenu *editor_layouts;
- EditorNameDialog *layout_dialog;
+ EditorLayoutsDialog *layout_dialog;
ConfirmationDialog *custom_build_manage_templates;
ConfirmationDialog *install_android_build_template;
diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h
index c28e607c89..0d700cd9b6 100644
--- a/editor/editor_plugin.h
+++ b/editor/editor_plugin.h
@@ -60,7 +60,8 @@ class EditorToolAddons;
class ScriptEditor;
class EditorInterface : public Node {
- GDCLASS(EditorInterface, Node)
+ GDCLASS(EditorInterface, Node);
+
protected:
static void _bind_methods();
static EditorInterface *singleton;
diff --git a/editor/editor_profiler.h b/editor/editor_profiler.h
index e62213887d..46c13d257a 100644
--- a/editor/editor_profiler.h
+++ b/editor/editor_profiler.h
@@ -42,7 +42,7 @@
class EditorProfiler : public VBoxContainer {
- GDCLASS(EditorProfiler, VBoxContainer)
+ GDCLASS(EditorProfiler, VBoxContainer);
public:
struct Metric {
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 45acd1b6d4..d5f4d54e5c 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -599,7 +599,8 @@ EditorPropertyFlags::EditorPropertyFlags() {
///////////////////// LAYERS /////////////////////////
class EditorPropertyLayersGrid : public Control {
- GDCLASS(EditorPropertyLayersGrid, Control)
+ GDCLASS(EditorPropertyLayersGrid, Control);
+
public:
uint32_t value;
Vector<Rect2> flag_rects;
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 574767890c..02d9349f2d 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -40,7 +40,7 @@
#include "scene/gui/color_picker.h"
class EditorPropertyNil : public EditorProperty {
- GDCLASS(EditorPropertyNil, EditorProperty)
+ GDCLASS(EditorPropertyNil, EditorProperty);
LineEdit *text;
public:
@@ -49,7 +49,7 @@ public:
};
class EditorPropertyText : public EditorProperty {
- GDCLASS(EditorPropertyText, EditorProperty)
+ GDCLASS(EditorPropertyText, EditorProperty);
LineEdit *text;
bool updating;
@@ -66,7 +66,7 @@ public:
};
class EditorPropertyMultilineText : public EditorProperty {
- GDCLASS(EditorPropertyMultilineText, EditorProperty)
+ GDCLASS(EditorPropertyMultilineText, EditorProperty);
TextEdit *text;
AcceptDialog *big_text_dialog;
@@ -87,7 +87,7 @@ public:
};
class EditorPropertyTextEnum : public EditorProperty {
- GDCLASS(EditorPropertyTextEnum, EditorProperty)
+ GDCLASS(EditorPropertyTextEnum, EditorProperty);
OptionButton *options;
void _option_selected(int p_which);
@@ -102,7 +102,7 @@ public:
};
class EditorPropertyPath : public EditorProperty {
- GDCLASS(EditorPropertyPath, EditorProperty)
+ GDCLASS(EditorPropertyPath, EditorProperty);
Vector<String> extensions;
bool folder;
bool global;
@@ -127,7 +127,8 @@ public:
};
class EditorPropertyClassName : public EditorProperty {
- GDCLASS(EditorPropertyClassName, EditorProperty)
+ GDCLASS(EditorPropertyClassName, EditorProperty);
+
private:
CreateDialog *dialog;
Button *property;
@@ -146,7 +147,8 @@ public:
};
class EditorPropertyMember : public EditorProperty {
- GDCLASS(EditorPropertyMember, EditorProperty)
+ GDCLASS(EditorPropertyMember, EditorProperty);
+
public:
enum Type {
MEMBER_METHOD_OF_VARIANT_TYPE, ///< a method of a type
@@ -179,7 +181,7 @@ public:
};
class EditorPropertyCheck : public EditorProperty {
- GDCLASS(EditorPropertyCheck, EditorProperty)
+ GDCLASS(EditorPropertyCheck, EditorProperty);
CheckBox *checkbox;
void _checkbox_pressed();
@@ -193,7 +195,7 @@ public:
};
class EditorPropertyEnum : public EditorProperty {
- GDCLASS(EditorPropertyEnum, EditorProperty)
+ GDCLASS(EditorPropertyEnum, EditorProperty);
OptionButton *options;
void _option_selected(int p_which);
@@ -209,7 +211,7 @@ public:
};
class EditorPropertyFlags : public EditorProperty {
- GDCLASS(EditorPropertyFlags, EditorProperty)
+ GDCLASS(EditorPropertyFlags, EditorProperty);
VBoxContainer *vbox;
Vector<CheckBox *> flags;
Vector<int> flag_indices;
@@ -228,7 +230,8 @@ public:
class EditorPropertyLayersGrid;
class EditorPropertyLayers : public EditorProperty {
- GDCLASS(EditorPropertyLayers, EditorProperty)
+ GDCLASS(EditorPropertyLayers, EditorProperty);
+
public:
enum LayerType {
LAYER_PHYSICS_2D,
@@ -257,7 +260,7 @@ public:
};
class EditorPropertyInteger : public EditorProperty {
- GDCLASS(EditorPropertyInteger, EditorProperty)
+ GDCLASS(EditorPropertyInteger, EditorProperty);
EditorSpinSlider *spin;
bool setting;
void _value_changed(double p_val);
@@ -272,7 +275,7 @@ public:
};
class EditorPropertyObjectID : public EditorProperty {
- GDCLASS(EditorPropertyObjectID, EditorProperty)
+ GDCLASS(EditorPropertyObjectID, EditorProperty);
Button *edit;
String base_type;
void _edit_pressed();
@@ -287,7 +290,7 @@ public:
};
class EditorPropertyFloat : public EditorProperty {
- GDCLASS(EditorPropertyFloat, EditorProperty)
+ GDCLASS(EditorPropertyFloat, EditorProperty);
EditorSpinSlider *spin;
bool setting;
void _value_changed(double p_val);
@@ -302,7 +305,7 @@ public:
};
class EditorPropertyEasing : public EditorProperty {
- GDCLASS(EditorPropertyEasing, EditorProperty)
+ GDCLASS(EditorPropertyEasing, EditorProperty);
Control *easing_draw;
PopupMenu *preset;
bool full;
@@ -335,7 +338,7 @@ public:
};
class EditorPropertyVector2 : public EditorProperty {
- GDCLASS(EditorPropertyVector2, EditorProperty)
+ GDCLASS(EditorPropertyVector2, EditorProperty);
EditorSpinSlider *spin[2];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -351,7 +354,7 @@ public:
};
class EditorPropertyRect2 : public EditorProperty {
- GDCLASS(EditorPropertyRect2, EditorProperty)
+ GDCLASS(EditorPropertyRect2, EditorProperty);
EditorSpinSlider *spin[4];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -367,7 +370,7 @@ public:
};
class EditorPropertyVector3 : public EditorProperty {
- GDCLASS(EditorPropertyVector3, EditorProperty)
+ GDCLASS(EditorPropertyVector3, EditorProperty);
EditorSpinSlider *spin[3];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -383,7 +386,7 @@ public:
};
class EditorPropertyPlane : public EditorProperty {
- GDCLASS(EditorPropertyPlane, EditorProperty)
+ GDCLASS(EditorPropertyPlane, EditorProperty);
EditorSpinSlider *spin[4];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -399,7 +402,7 @@ public:
};
class EditorPropertyQuat : public EditorProperty {
- GDCLASS(EditorPropertyQuat, EditorProperty)
+ GDCLASS(EditorPropertyQuat, EditorProperty);
EditorSpinSlider *spin[4];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -415,7 +418,7 @@ public:
};
class EditorPropertyAABB : public EditorProperty {
- GDCLASS(EditorPropertyAABB, EditorProperty)
+ GDCLASS(EditorPropertyAABB, EditorProperty);
EditorSpinSlider *spin[6];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -431,7 +434,7 @@ public:
};
class EditorPropertyTransform2D : public EditorProperty {
- GDCLASS(EditorPropertyTransform2D, EditorProperty)
+ GDCLASS(EditorPropertyTransform2D, EditorProperty);
EditorSpinSlider *spin[6];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -447,7 +450,7 @@ public:
};
class EditorPropertyBasis : public EditorProperty {
- GDCLASS(EditorPropertyBasis, EditorProperty)
+ GDCLASS(EditorPropertyBasis, EditorProperty);
EditorSpinSlider *spin[9];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -463,7 +466,7 @@ public:
};
class EditorPropertyTransform : public EditorProperty {
- GDCLASS(EditorPropertyTransform, EditorProperty)
+ GDCLASS(EditorPropertyTransform, EditorProperty);
EditorSpinSlider *spin[12];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -479,7 +482,7 @@ public:
};
class EditorPropertyColor : public EditorProperty {
- GDCLASS(EditorPropertyColor, EditorProperty)
+ GDCLASS(EditorPropertyColor, EditorProperty);
ColorPickerButton *picker;
void _color_changed(const Color &p_color);
void _popup_closed();
@@ -494,7 +497,7 @@ public:
};
class EditorPropertyNodePath : public EditorProperty {
- GDCLASS(EditorPropertyNodePath, EditorProperty)
+ GDCLASS(EditorPropertyNodePath, EditorProperty);
Button *assign;
Button *clear;
SceneTreeDialog *scene_tree;
@@ -517,7 +520,7 @@ public:
};
class EditorPropertyRID : public EditorProperty {
- GDCLASS(EditorPropertyRID, EditorProperty)
+ GDCLASS(EditorPropertyRID, EditorProperty);
Label *label;
public:
@@ -526,7 +529,7 @@ public:
};
class EditorPropertyResource : public EditorProperty {
- GDCLASS(EditorPropertyResource, EditorProperty)
+ GDCLASS(EditorPropertyResource, EditorProperty);
enum MenuOption {
@@ -605,7 +608,7 @@ public:
/// \brief The EditorInspectorDefaultPlugin class
///
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);
public:
virtual bool can_handle(Object *p_object);
diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h
index ff759105c3..18519c754a 100644
--- a/editor/editor_properties_array_dict.h
+++ b/editor/editor_properties_array_dict.h
@@ -78,7 +78,7 @@ public:
};
class EditorPropertyArray : public EditorProperty {
- GDCLASS(EditorPropertyArray, EditorProperty)
+ GDCLASS(EditorPropertyArray, EditorProperty);
PopupMenu *change_type;
bool updating;
@@ -117,7 +117,7 @@ public:
};
class EditorPropertyDictionary : public EditorProperty {
- GDCLASS(EditorPropertyDictionary, EditorProperty)
+ GDCLASS(EditorPropertyDictionary, EditorProperty);
PopupMenu *change_type;
bool updating;
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 58e3cc6fc1..5e04bf4953 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -345,6 +345,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/unfocused_low_processor_mode_sleep_usec", 50000); // 20 FPS
hints["interface/editor/unfocused_low_processor_mode_sleep_usec"] = PropertyInfo(Variant::REAL, "interface/editor/unfocused_low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "1,100000,1", PROPERTY_USAGE_DEFAULT);
_initial_set("interface/editor/separate_distraction_mode", false);
+ _initial_set("interface/editor/hide_console_window", false);
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
_initial_set("interface/editor/quit_confirmation", true);
diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h
index ceff878e7f..1523c20f48 100644
--- a/editor/editor_spin_slider.h
+++ b/editor/editor_spin_slider.h
@@ -36,7 +36,7 @@
#include "scene/gui/texture_rect.h"
class EditorSpinSlider : public Range {
- GDCLASS(EditorSpinSlider, Range)
+ GDCLASS(EditorSpinSlider, Range);
String label;
int updown_offset;
diff --git a/editor/export_template_manager.h b/editor/export_template_manager.h
index 608830c990..ad3ab507b3 100644
--- a/editor/export_template_manager.h
+++ b/editor/export_template_manager.h
@@ -41,7 +41,7 @@
class ExportTemplateVersion;
class ExportTemplateManager : public ConfirmationDialog {
- GDCLASS(ExportTemplateManager, ConfirmationDialog)
+ GDCLASS(ExportTemplateManager, ConfirmationDialog);
AcceptDialog *template_downloader;
VBoxContainer *template_list;
diff --git a/editor/find_in_files.h b/editor/find_in_files.h
index 5f728a104b..178b9a2080 100644
--- a/editor/find_in_files.h
+++ b/editor/find_in_files.h
@@ -36,7 +36,8 @@
// Performs the actual search
class FindInFiles : public Node {
- GDCLASS(FindInFiles, Node)
+ GDCLASS(FindInFiles, Node);
+
public:
static const char *SIGNAL_RESULT_FOUND;
static const char *SIGNAL_FINISHED;
@@ -93,7 +94,8 @@ class HBoxContainer;
// Prompts search parameters
class FindInFilesDialog : public AcceptDialog {
- GDCLASS(FindInFilesDialog, AcceptDialog)
+ GDCLASS(FindInFilesDialog, AcceptDialog);
+
public:
static const char *SIGNAL_FIND_REQUESTED;
static const char *SIGNAL_REPLACE_REQUESTED;
@@ -138,7 +140,8 @@ class ProgressBar;
// Display search results
class FindInFilesPanel : public Control {
- GDCLASS(FindInFilesPanel, Control)
+ GDCLASS(FindInFilesPanel, Control);
+
public:
static const char *SIGNAL_RESULT_SELECTED;
static const char *SIGNAL_FILES_MODIFIED;
diff --git a/editor/icons/icon_GUI_toggle_off.svg b/editor/icons/icon_GUI_toggle_off.svg
index aea0f85f96..928b55b201 100644
--- a/editor/icons/icon_GUI_toggle_off.svg
+++ b/editor/icons/icon_GUI_toggle_off.svg
@@ -1,5 +1 @@
-<svg width="42" height="26" version="1.1" viewBox="0 0 42 25.999998" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1026.4)">
-<path d="m13 1027.4c-6.6307 0-12 5.3663-12 11.998 0 6.6318 5.3693 12.002 12 12.002h16c6.6307 0 12-5.3702 12-12.002 0-6.6317-5.3693-11.998-12-11.998zm0 2.0003h16c5.5573 0 10 4.4395 10 9.9977 0 5.5583-4.4427 10.002-10 10.002h-16c-5.5573 0-10-4.4434-10-10.002 0-5.5582 4.4427-9.9977 10-9.9977zm7 4.9969a1.0001 1.0003 0 0 0 -1 1.0002v8.0013a1 1.0002 0 0 0 1 1.0002 1 1.0002 0 0 0 1 -1.0002v-3.0005h2a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0001h-2v-2.0003h4a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0002zm9 0a1.0001 1.0003 0 0 0 -1 1.0002v8.0013a1 1.0002 0 0 0 1 1.0002 1 1.0002 0 0 0 1 -1.0002v-3.0005h2a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0001h-2v-2.0003h4a1 1.0002 0 0 0 1 -1.0002 1 1.0002 0 0 0 -1 -1.0002zm-17 0c-2.7496 0-5 2.2508-5 5.0008 0 2.7501 2.2504 5.0009 5 5.0009s5-2.2508 5-5.0009c0-2.75-2.2504-5.0008-5-5.0008zm0 2.0004c1.6687 0 3 1.3315 3 3.0004 0 1.669-1.3313 3.0005-3 3.0005s-3-1.3315-3-3.0005c0-1.6689 1.3313-3.0004 3-3.0004z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".78431" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
-</g>
-</svg>
+<svg height="26" viewBox="0 0 42 25.999998" width="42" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><rect fill-opacity=".188235" height="16" rx="9" stroke-width="55.8958" width="38" x="2" y="5"/><circle cx="10" cy="13" r="5" stroke-width="97.3613"/></g></svg>
diff --git a/editor/icons/icon_GUI_toggle_on.svg b/editor/icons/icon_GUI_toggle_on.svg
index c0a11810d4..a79a8290b1 100644
--- a/editor/icons/icon_GUI_toggle_on.svg
+++ b/editor/icons/icon_GUI_toggle_on.svg
@@ -1,5 +1 @@
-<svg width="42" height="26" version="1.1" viewBox="0 0 42 25.999998" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1026.4)">
-<path d="m13 1027.4c-6.6307 0-12 5.3662-12 11.998s5.3693 12.002 12 12.002h16c6.6307 0 12-5.3702 12-12.002s-5.3693-11.998-12-11.998zm17 6.9972a1 1.0002 0 0 1 1 1.0001v8.0014a1.0001 1.0003 0 0 1 -1.752 0.6623l-5.248-6.001v5.3387a1 1.0002 0 0 1 -1 1.0001 1 1.0002 0 0 1 -1 -1.0001v-8.0014a1.0001 1.0003 0 0 1 1.752 -0.6583l5.248 6.001v-5.3427a1 1.0002 0 0 1 1 -1.0001zm-15 0c2.7496 0 5 2.2507 5 5.0008s-2.2504 5.0008-5 5.0008-5-2.2507-5-5.0008 2.2504-5.0008 5-5.0008zm0 2.0003c-1.6687 0-3 1.3315-3 3.0005s1.3313 3.0005 3 3.0005 3-1.3315 3-3.0005-1.3313-3.0005-3-3.0005z" color="#000000" color-rendering="auto" dominant-baseline="auto" fill="#e0e0e0" fill-opacity=".78431" image-rendering="auto" shape-rendering="auto" solid-color="#000000" style="font-feature-settings:normal;font-variant-alternates:normal;font-variant-caps:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-position:normal;isolation:auto;mix-blend-mode:normal;shape-padding:0;text-decoration-color:#000000;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-orientation:mixed;text-transform:none;white-space:normal"/>
-</g>
-</svg>
+<svg height="26" viewBox="0 0 42 25.999998" width="42" xmlns="http://www.w3.org/2000/svg"><path d="m11 5c-4.986 0-9 3.568-9 8s4.014 8 9 8h20c4.986 0 9-3.568 9-8s-4.014-8-9-8zm21 3a5 5 0 0 1 5 5 5 5 0 0 1 -5 5 5 5 0 0 1 -5-5 5 5 0 0 1 5-5z" fill="#e0e0e0" stroke-width="55.8958"/></svg>
diff --git a/editor/icons/icon_key_valid.svg b/editor/icons/icon_key_valid.svg
deleted file mode 100644
index 4a3fab4754..0000000000
--- a/editor/icons/icon_key_valid.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="8" height="8" version="1.1" viewBox="0 0 8 8" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1044.4)">
-<rect transform="rotate(-45)" x="-741.53" y="741.08" width="6.1027" height="6.1027" ry=".76286" fill="#fff"/>
-</g>
-</svg>
diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h
index d396dd6d5b..b3eb7ae83b 100644
--- a/editor/import/editor_import_plugin.h
+++ b/editor/import/editor_import_plugin.h
@@ -34,7 +34,8 @@
#include "core/io/resource_importer.h"
class EditorImportPlugin : public ResourceImporter {
- GDCLASS(EditorImportPlugin, Reference)
+ GDCLASS(EditorImportPlugin, Reference);
+
protected:
static void _bind_methods();
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index c97021433b..2bfc77325f 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -1326,9 +1326,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
if (bct.has("index")) {
Ref<Texture> t = _get_texture(state, bct["index"]);
material->set_texture(SpatialMaterial::TEXTURE_METALLIC, t);
- material->set_metallic_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_BLUE);
material->set_texture(SpatialMaterial::TEXTURE_ROUGHNESS, t);
- material->set_roughness_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_GREEN);
if (!mr.has("metallicFactor")) {
material->set_metallic(1);
}
@@ -1353,7 +1351,6 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
Dictionary bct = d["occlusionTexture"];
if (bct.has("index")) {
material->set_texture(SpatialMaterial::TEXTURE_AMBIENT_OCCLUSION, _get_texture(state, bct["index"]));
- material->set_ao_texture_channel(SpatialMaterial::TEXTURE_CHANNEL_RED);
material->set_feature(SpatialMaterial::FEATURE_AMBIENT_OCCLUSION, true);
}
}
diff --git a/editor/import/resource_importer_bitmask.h b/editor/import/resource_importer_bitmask.h
index 166fa998e4..6ae7608ff2 100644
--- a/editor/import/resource_importer_bitmask.h
+++ b/editor/import/resource_importer_bitmask.h
@@ -37,7 +37,7 @@
class StreamBitMap;
class ResourceImporterBitMap : public ResourceImporter {
- GDCLASS(ResourceImporterBitMap, ResourceImporter)
+ GDCLASS(ResourceImporterBitMap, ResourceImporter);
public:
virtual String get_importer_name() const;
diff --git a/editor/import/resource_importer_csv_translation.h b/editor/import/resource_importer_csv_translation.h
index 6785b68d87..c2753b326f 100644
--- a/editor/import/resource_importer_csv_translation.h
+++ b/editor/import/resource_importer_csv_translation.h
@@ -34,7 +34,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterCSVTranslation : public ResourceImporter {
- GDCLASS(ResourceImporterCSVTranslation, ResourceImporter)
+ GDCLASS(ResourceImporterCSVTranslation, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import/resource_importer_image.cpp b/editor/import/resource_importer_image.cpp
index 1259e81be7..ed8ea5497a 100644
--- a/editor/import/resource_importer_image.cpp
+++ b/editor/import/resource_importer_image.cpp
@@ -77,9 +77,8 @@ void ResourceImporterImage::get_import_options(List<ImportOption> *r_options, in
Error ResourceImporterImage::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
- if (!f) {
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
- }
+
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
size_t len = f->get_len();
diff --git a/editor/import/resource_importer_image.h b/editor/import/resource_importer_image.h
index 3d5b99db2c..beadf5a8ea 100644
--- a/editor/import/resource_importer_image.h
+++ b/editor/import/resource_importer_image.h
@@ -35,7 +35,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterImage : public ResourceImporter {
- GDCLASS(ResourceImporterImage, ResourceImporter)
+ GDCLASS(ResourceImporterImage, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import/resource_importer_layered_texture.h b/editor/import/resource_importer_layered_texture.h
index 6b393886b7..d6acbbabca 100644
--- a/editor/import/resource_importer_layered_texture.h
+++ b/editor/import/resource_importer_layered_texture.h
@@ -37,7 +37,7 @@
class StreamTexture;
class ResourceImporterLayeredTexture : public ResourceImporter {
- GDCLASS(ResourceImporterLayeredTexture, ResourceImporter)
+ GDCLASS(ResourceImporterLayeredTexture, ResourceImporter);
bool is_3d;
static const char *compression_formats[];
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index e950421476..868f67fd77 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -215,7 +215,6 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
bool generate_tangents = p_generate_tangents;
Vector3 scale_mesh = p_scale_mesh;
- bool flip_faces = false;
int mesh_flags = p_optimize ? Mesh::ARRAY_COMPRESS_DEFAULT : 0;
Vector<Vector3> vertices;
@@ -293,7 +292,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
int idx = j;
- if (!flip_faces && idx < 2) {
+ if (idx < 2) {
idx = 1 ^ idx;
}
diff --git a/editor/import/resource_importer_obj.h b/editor/import/resource_importer_obj.h
index b2a53f582c..b96bc1b656 100644
--- a/editor/import/resource_importer_obj.h
+++ b/editor/import/resource_importer_obj.h
@@ -47,7 +47,8 @@ public:
};
class ResourceImporterOBJ : public ResourceImporter {
- GDCLASS(ResourceImporterOBJ, ResourceImporter)
+ GDCLASS(ResourceImporterOBJ, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import/resource_importer_scene.h b/editor/import/resource_importer_scene.h
index b10c4da2e5..e89f862c1b 100644
--- a/editor/import/resource_importer_scene.h
+++ b/editor/import/resource_importer_scene.h
@@ -90,7 +90,7 @@ public:
};
class ResourceImporterScene : public ResourceImporter {
- GDCLASS(ResourceImporterScene, ResourceImporter)
+ GDCLASS(ResourceImporterScene, ResourceImporter);
Set<Ref<EditorSceneImporter> > importers;
diff --git a/editor/import/resource_importer_texture.h b/editor/import/resource_importer_texture.h
index ef74e4e41e..da712bf84d 100644
--- a/editor/import/resource_importer_texture.h
+++ b/editor/import/resource_importer_texture.h
@@ -37,7 +37,7 @@
class StreamTexture;
class ResourceImporterTexture : public ResourceImporter {
- GDCLASS(ResourceImporterTexture, ResourceImporter)
+ GDCLASS(ResourceImporterTexture, ResourceImporter);
protected:
enum {
diff --git a/editor/import/resource_importer_texture_atlas.h b/editor/import/resource_importer_texture_atlas.h
index 042deacfe3..3c6fc343c4 100644
--- a/editor/import/resource_importer_texture_atlas.h
+++ b/editor/import/resource_importer_texture_atlas.h
@@ -34,7 +34,7 @@
#include "core/image.h"
#include "core/io/resource_importer.h"
class ResourceImporterTextureAtlas : public ResourceImporter {
- GDCLASS(ResourceImporterTextureAtlas, ResourceImporter)
+ GDCLASS(ResourceImporterTextureAtlas, ResourceImporter);
struct PackData {
Rect2 region;
diff --git a/editor/import/resource_importer_wav.h b/editor/import/resource_importer_wav.h
index f993f9e7bc..24481ea46b 100644
--- a/editor/import/resource_importer_wav.h
+++ b/editor/import/resource_importer_wav.h
@@ -34,7 +34,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterWAV : public ResourceImporter {
- GDCLASS(ResourceImporterWAV, ResourceImporter)
+ GDCLASS(ResourceImporterWAV, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index b307ec649a..6918fe7977 100644
--- a/editor/import_dock.cpp
+++ b/editor/import_dock.cpp
@@ -32,7 +32,8 @@
#include "editor_node.h"
class ImportDockParameters : public Object {
- GDCLASS(ImportDockParameters, Object)
+ GDCLASS(ImportDockParameters, Object);
+
public:
Map<StringName, Variant> values;
List<PropertyInfo> properties;
diff --git a/editor/import_dock.h b/editor/import_dock.h
index 77a34e80eb..c839e19d67 100644
--- a/editor/import_dock.h
+++ b/editor/import_dock.h
@@ -43,7 +43,7 @@
class ImportDockParameters;
class ImportDock : public VBoxContainer {
- GDCLASS(ImportDock, VBoxContainer)
+ GDCLASS(ImportDock, VBoxContainer);
Label *imported;
OptionButton *import_as;
diff --git a/editor/pane_drag.h b/editor/pane_drag.h
index c9631bb870..36c5953d84 100644
--- a/editor/pane_drag.h
+++ b/editor/pane_drag.h
@@ -35,7 +35,7 @@
class PaneDrag : public Control {
- GDCLASS(PaneDrag, Control)
+ GDCLASS(PaneDrag, Control);
bool mouse_over;
diff --git a/editor/plugins/animation_blend_space_1d_editor.h b/editor/plugins/animation_blend_space_1d_editor.h
index ae4db184e4..4a924b46c1 100644
--- a/editor/plugins/animation_blend_space_1d_editor.h
+++ b/editor/plugins/animation_blend_space_1d_editor.h
@@ -43,7 +43,7 @@
class AnimationNodeBlendSpace1DEditor : public AnimationTreeNodeEditorPlugin {
- GDCLASS(AnimationNodeBlendSpace1DEditor, AnimationTreeNodeEditorPlugin)
+ GDCLASS(AnimationNodeBlendSpace1DEditor, AnimationTreeNodeEditorPlugin);
Ref<AnimationNodeBlendSpace1D> blend_space;
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 5204565c06..a8866a1a87 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -58,6 +58,7 @@ void AnimationPlayerEditor::_node_removed(Node *p_node) {
}
void AnimationPlayerEditor::_notification(int p_what) {
+
switch (p_what) {
case NOTIFICATION_PROCESS: {
@@ -84,17 +85,13 @@ void AnimationPlayerEditor::_notification(int p_what) {
EditorNode::get_singleton()->get_inspector()->refresh();
} else if (last_active) {
- //need the last frame after it stopped
-
+ // Need the last frame after it stopped.
frame->set_value(player->get_current_animation_position());
}
last_active = player->is_playing();
- //seek->set_val(player->get_position());
updating = false;
-
} break;
-
case NOTIFICATION_ENTER_TREE: {
tool_anim->get_popup()->connect("id_pressed", this, "_animation_tool_menu");
@@ -107,12 +104,10 @@ void AnimationPlayerEditor::_notification(int p_what) {
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
} break;
-
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
add_style_override("panel", editor->get_gui_base()->get_stylebox("panel", "Panel"));
} break;
-
case NOTIFICATION_THEME_CHANGED: {
autoplay->set_icon(get_icon("AutoPlay", "EditorIcons"));
@@ -144,9 +139,6 @@ void AnimationPlayerEditor::_notification(int p_what) {
ITEM_ICON(TOOL_EDIT_TRANSITIONS, "Blend");
ITEM_ICON(TOOL_EDIT_RESOURCE, "Edit");
ITEM_ICON(TOOL_REMOVE_ANIM, "Remove");
- //ITEM_ICON(TOOL_COPY_ANIM, "Copy");
- //ITEM_ICON(TOOL_PASTE_ANIM, "Paste");
-
} break;
}
}
@@ -197,8 +189,6 @@ void AnimationPlayerEditor::_play_pressed() {
//unstop
stop->set_pressed(false);
- //unpause
- //pause->set_pressed(false);
}
void AnimationPlayerEditor::_play_from_pressed() {
@@ -224,8 +214,6 @@ void AnimationPlayerEditor::_play_from_pressed() {
//unstop
stop->set_pressed(false);
- //unpause
- //pause->set_pressed(false);
}
void AnimationPlayerEditor::_play_bw_pressed() {
@@ -245,8 +233,6 @@ void AnimationPlayerEditor::_play_bw_pressed() {
//unstop
stop->set_pressed(false);
- //unpause
- //pause->set_pressed(false);
}
void AnimationPlayerEditor::_play_bw_from_pressed() {
@@ -269,8 +255,6 @@ void AnimationPlayerEditor::_play_bw_from_pressed() {
//unstop
stop->set_pressed(false);
- //unpause
- //pause->set_pressed(false);
}
void AnimationPlayerEditor::_stop_pressed() {
@@ -281,14 +265,8 @@ void AnimationPlayerEditor::_stop_pressed() {
player->stop(false);
play->set_pressed(false);
stop->set_pressed(true);
- //pause->set_pressed(false);
- //player->set_pause(false);
}
-void AnimationPlayerEditor::_pause_pressed() {
-
- //player->set_pause( pause->is_pressed() );
-}
void AnimationPlayerEditor::_animation_selected(int p_which) {
if (updating)
@@ -469,13 +447,17 @@ void AnimationPlayerEditor::_animation_remove_confirmed() {
if (player->get_autoplay() == current) {
undo_redo->add_do_method(player, "set_autoplay", "");
undo_redo->add_undo_method(player, "set_autoplay", current);
- // Avoid having the autoplay icon linger around if there is only one animation in the player
+ // Avoid having the autoplay icon linger around if there is only one animation in the player.
undo_redo->add_do_method(this, "_animation_player_changed", player);
}
undo_redo->add_do_method(player, "remove_animation", current);
undo_redo->add_undo_method(player, "add_animation", current, anim);
undo_redo->add_do_method(this, "_animation_player_changed", player);
undo_redo->add_undo_method(this, "_animation_player_changed", player);
+ if (animation->get_item_count() == 1) {
+ undo_redo->add_do_method(this, "_stop_onion_skinning");
+ undo_redo->add_undo_method(this, "_start_onion_skinning");
+ }
undo_redo->commit_action();
}
@@ -545,6 +527,10 @@ void AnimationPlayerEditor::_animation_name_edited() {
undo_redo->add_undo_method(player, "remove_animation", new_name);
undo_redo->add_do_method(this, "_animation_player_changed", player);
undo_redo->add_undo_method(this, "_animation_player_changed", player);
+ if (animation->get_item_count() == 0) {
+ undo_redo->add_do_method(this, "_start_onion_skinning");
+ undo_redo->add_undo_method(this, "_stop_onion_skinning");
+ }
undo_redo->commit_action();
_select_anim_by_name(new_name);
@@ -844,7 +830,8 @@ void AnimationPlayerEditor::_update_player() {
animation->set_disabled(animlist.size() == 0);
autoplay->set_disabled(animlist.size() == 0);
tool_anim->set_disabled(player == NULL);
- onion_skinning->set_disabled(player == NULL);
+ onion_toggle->set_disabled(animlist.size() == 0);
+ onion_skinning->set_disabled(animlist.size() == 0);
pin->set_disabled(player == NULL);
if (!player) {
@@ -895,17 +882,25 @@ void AnimationPlayerEditor::_update_player() {
void AnimationPlayerEditor::edit(AnimationPlayer *p_player) {
- if (onion.enabled)
- _start_onion_skinning();
-
if (player && pin->is_pressed())
- return; //ignore, pinned
+ return; // Ignore, pinned.
player = p_player;
if (player) {
_update_player();
+
+ if (onion.enabled) {
+ if (animation->get_item_count() > 0)
+ _start_onion_skinning();
+ else
+ _stop_onion_skinning();
+ }
+
track_editor->show_select_node_warning(false);
} else {
+ if (onion.enabled)
+ _stop_onion_skinning();
+
track_editor->show_select_node_warning(true);
}
}
@@ -915,13 +910,13 @@ void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_o
if (!onion.can_overlay)
return;
- // Can happen on viewport resize, at least
+ // Can happen on viewport resize, at least.
if (!_are_onion_layers_valid())
return;
RID ci = p_overlay->get_canvas_item();
Rect2 src_rect = p_overlay->get_global_rect();
- // Re-flip since captures are already flipped
+ // Re-flip since captures are already flipped.
src_rect.position.y = onion.capture_size.y - (src_rect.position.y + src_rect.size.y);
src_rect.size.y *= -1;
@@ -955,7 +950,7 @@ void AnimationPlayerEditor::forward_canvas_force_draw_over_viewport(Control *p_o
}
cidx++;
- } while (cidx < base_cidx + onion.steps); // In case there's the present capture at the end, skip it
+ } while (cidx < base_cidx + onion.steps); // In case there's the present capture at the end, skip it.
}
}
@@ -1053,7 +1048,7 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) {
_update_player();
if (blend_editor.dialog->is_visible_in_tree())
- _animation_blend(); //update
+ _animation_blend(); // Update.
}
}
@@ -1092,8 +1087,6 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_drag)
_seek_value_changed(p_pos, !p_drag);
EditorNode::get_singleton()->get_inspector()->refresh();
-
- //seekit
}
void AnimationPlayerEditor::_hide_anim_editors() {
@@ -1113,8 +1106,9 @@ void AnimationPlayerEditor::_animation_about_to_show_menu() {
void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
String current;
- if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count())
+ if (animation->get_selected() >= 0 && animation->get_selected() < animation->get_item_count()) {
current = animation->get_item_text(animation->get_selected());
+ }
Ref<Animation> anim;
if (current != String()) {
@@ -1124,33 +1118,39 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
switch (p_option) {
case TOOL_NEW_ANIM: {
+
_animation_new();
} break;
-
case TOOL_LOAD_ANIM: {
+
_animation_load();
- break;
} break;
case TOOL_SAVE_ANIM: {
+
if (anim.is_valid()) {
_animation_save(anim);
}
} break;
case TOOL_SAVE_AS_ANIM: {
+
if (anim.is_valid()) {
_animation_save_as(anim);
}
} break;
case TOOL_DUPLICATE_ANIM: {
+
_animation_duplicate();
} break;
case TOOL_RENAME_ANIM: {
+
_animation_rename();
} break;
case TOOL_EDIT_TRANSITIONS: {
+
_animation_blend();
} break;
case TOOL_REMOVE_ANIM: {
+
_animation_remove();
} break;
case TOOL_COPY_ANIM: {
@@ -1163,9 +1163,7 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
String current2 = animation->get_item_text(animation->get_selected());
Ref<Animation> anim2 = player->get_animation(current2);
- //editor->edit_resource(anim2);
EditorSettings::get_singleton()->set_resource_clipboard(anim2);
-
} break;
case TOOL_PASTE_ANIM: {
@@ -1197,7 +1195,6 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
undo_redo->commit_action();
_select_anim_by_name(name);
-
} break;
case TOOL_EDIT_RESOURCE: {
@@ -1210,7 +1207,6 @@ void AnimationPlayerEditor::_animation_tool_menu(int p_option) {
String current2 = animation->get_item_text(animation->get_selected());
Ref<Animation> anim2 = player->get_animation(current2);
editor->edit_resource(anim2);
-
} break;
}
}
@@ -1232,22 +1228,19 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) {
_stop_onion_skinning();
} break;
-
case ONION_SKINNING_PAST: {
- // Ensure at least one of past/future is checjed
+ // Ensure at least one of past/future is checked.
onion.past = onion.future ? !onion.past : true;
menu->set_item_checked(idx, onion.past);
} break;
-
case ONION_SKINNING_FUTURE: {
- // Ensure at least one of past/future is checjed
+ // Ensure at least one of past/future is checked.
onion.future = onion.past ? !onion.future : true;
menu->set_item_checked(idx, onion.future);
} break;
-
- case ONION_SKINNING_1_STEP: // Fall-through
+ case ONION_SKINNING_1_STEP: // Fall-through.
case ONION_SKINNING_2_STEPS:
case ONION_SKINNING_3_STEPS: {
@@ -1257,19 +1250,16 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) {
menu->set_item_checked(one_frame_idx + i, onion.steps == i + 1);
}
} break;
-
case ONION_SKINNING_DIFFERENCES_ONLY: {
onion.differences_only = !onion.differences_only;
menu->set_item_checked(idx, onion.differences_only);
} break;
-
case ONION_SKINNING_FORCE_WHITE_MODULATE: {
onion.force_white_modulate = !onion.force_white_modulate;
menu->set_item_checked(idx, onion.force_white_modulate);
} break;
-
case ONION_SKINNING_INCLUDE_GIZMOS: {
onion.include_gizmos = !onion.include_gizmos;
@@ -1306,7 +1296,7 @@ void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) {
void AnimationPlayerEditor::_editor_visibility_changed() {
- if (is_visible()) {
+ if (is_visible() && animation->get_item_count() > 0) {
_start_onion_skinning();
}
}
@@ -1332,7 +1322,7 @@ void AnimationPlayerEditor::_allocate_onion_layers() {
for (int i = 0; i < captures; i++) {
bool is_present = onion.differences_only && i == captures - 1;
- // Each capture is a viewport with a canvas item attached that renders a full-size rect with the contents of the main viewport
+ // Each capture is a viewport with a canvas item attached that renders a full-size rect with the contents of the main viewport.
onion.captures.write[i] = VS::get_singleton()->viewport_create();
VS::get_singleton()->viewport_set_usage(onion.captures[i], VS::VIEWPORT_USAGE_2D);
VS::get_singleton()->viewport_set_size(onion.captures[i], capture_size.width, capture_size.height);
@@ -1342,7 +1332,7 @@ void AnimationPlayerEditor::_allocate_onion_layers() {
VS::get_singleton()->viewport_attach_canvas(onion.captures[i], onion.capture.canvas);
}
- // Reset the capture canvas item to the current root viewport texture (defensive)
+ // Reset the capture canvas item to the current root viewport texture (defensive).
VS::get_singleton()->canvas_item_clear(onion.capture.canvas_item);
VS::get_singleton()->canvas_item_add_texture_rect(onion.capture.canvas_item, Rect2(Point2(), capture_size), get_tree()->get_root()->get_texture()->get_rid());
@@ -1362,7 +1352,7 @@ void AnimationPlayerEditor::_free_onion_layers() {
void AnimationPlayerEditor::_prepare_onion_layers_1() {
- // This would be called per viewport and we want to act once only
+ // This would be called per viewport and we want to act once only.
int64_t frame = get_tree()->get_frame();
if (frame == onion.last_frame)
return;
@@ -1374,14 +1364,14 @@ void AnimationPlayerEditor::_prepare_onion_layers_1() {
onion.last_frame = frame;
- // Refresh viewports with no onion layers overlaid
+ // Refresh viewports with no onion layers overlaid.
onion.can_overlay = false;
plugin->update_overlays();
if (player->is_playing())
return;
- // And go to next step afterwards
+ // And go to next step afterwards.
call_deferred("_prepare_onion_layers_2");
}
@@ -1394,7 +1384,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
if (!_are_onion_layers_valid())
_allocate_onion_layers();
- // Hide superfluous elements that would make the overlay unnecessary cluttered
+ // Hide superfluous elements that would make the overlay unnecessary cluttered.
Dictionary canvas_edit_state;
Dictionary spatial_edit_state;
if (SpatialEditor::get_singleton()->is_visible()) {
@@ -1415,7 +1405,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
vp[i] = d;
}
new_state["viewports"] = vp;
- // TODO: Save/restore only affected entries
+ // TODO: Save/restore only affected entries.
SpatialEditor::get_singleton()->set_state(new_state);
} else { // CanvasItemEditor
// 2D
@@ -1426,11 +1416,11 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
new_state["show_guides"] = false;
new_state["show_helpers"] = false;
new_state["show_zoom_control"] = false;
- // TODO: Save/restore only affected entries
+ // TODO: Save/restore only affected entries.
CanvasItemEditor::get_singleton()->set_state(new_state);
}
- // Tweak the root viewport to ensure it's rendered before our target
+ // Tweak the root viewport to ensure it's rendered before our target.
RID root_vp = get_tree()->get_root()->get_viewport_rid();
Rect2 root_vp_screen_rect = get_tree()->get_root()->get_attach_to_screen_rect();
VS::get_singleton()->viewport_attach_to_screen(root_vp, Rect2());
@@ -1438,7 +1428,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
RID present_rid;
if (onion.differences_only) {
- // Capture present scene as it is
+ // Capture present scene as it is.
VS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, RID());
present_rid = onion.captures[onion.captures.size() - 1];
VS::get_singleton()->viewport_set_active(present_rid, true);
@@ -1447,11 +1437,11 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
VS::get_singleton()->viewport_set_active(present_rid, false);
}
- // Backup current animation state
+ // Backup current animation state.
AnimatedValuesBackup values_backup = player->backup_animated_values();
float cpos = player->get_current_animation_position();
- // Render every past/future step with the capture shader
+ // Render every past/future step with the capture shader.
VS::get_singleton()->canvas_item_set_material(onion.capture.canvas_item, onion.capture.material->get_rid());
onion.capture.material->set_shader_param("bkg_color", GLOBAL_GET("rendering/environment/default_clear_color"));
@@ -1465,7 +1455,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
for (int step_off = step_off_a; step_off <= step_off_b; step_off++) {
if (step_off == 0) {
- // Skip present step and switch to the color of future
+ // Skip present step and switch to the color of future.
if (!onion.force_white_modulate)
onion.capture.material->set_shader_param("dir_color", EDITOR_GET("editors/animation/onion_layers_future_color"));
continue;
@@ -1477,8 +1467,8 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
onion.captures_valid.write[cidx] = valid;
if (valid) {
player->seek(pos, true);
- get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials
- values_backup.update_skeletons(); // Needed for Skeletons (2D & 3D)
+ get_tree()->flush_transform_notifications(); // Needed for transforms of Spatials.
+ values_backup.update_skeletons(); // Needed for Skeletons (2D & 3D).
VS::get_singleton()->viewport_set_active(onion.captures[cidx], true);
VS::get_singleton()->viewport_set_parent_viewport(root_vp, onion.captures[cidx]);
@@ -1489,18 +1479,18 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
cidx++;
}
- // Restore root viewport
+ // Restore root viewport.
VS::get_singleton()->viewport_set_parent_viewport(root_vp, RID());
VS::get_singleton()->viewport_attach_to_screen(root_vp, root_vp_screen_rect);
VS::get_singleton()->viewport_set_update_mode(root_vp, VS::VIEWPORT_UPDATE_WHEN_VISIBLE);
// Restore animation state
// (Seeking with update=true wouldn't do the trick because the current value of the properties
- // may not match their value for the current point in the animation)
+ // may not match their value for the current point in the animation).
player->seek(cpos, false);
player->restore_animated_values(values_backup);
- // Restor state of main editors
+ // Restor state of main editors.
if (SpatialEditor::get_singleton()->is_visible()) {
// 3D
SpatialEditor::get_singleton()->set_state(spatial_edit_state);
@@ -1509,14 +1499,14 @@ void AnimationPlayerEditor::_prepare_onion_layers_2() {
CanvasItemEditor::get_singleton()->set_state(canvas_edit_state);
}
- // Update viewports with skin layers overlaid for the actual engine loop render
+ // Update viewports with skin layers overlaid for the actual engine loop render.
onion.can_overlay = true;
plugin->update_overlays();
}
void AnimationPlayerEditor::_start_onion_skinning() {
- // FIXME: Using "idle_frame" makes onion layers update one frame behind 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"));
}
@@ -1537,6 +1527,7 @@ void AnimationPlayerEditor::_stop_onion_skinning() {
}
void AnimationPlayerEditor::_pin_pressed() {
+
EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor()->update_tree();
}
@@ -1549,7 +1540,6 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_play_bw_from_pressed"), &AnimationPlayerEditor::_play_bw_from_pressed);
ClassDB::bind_method(D_METHOD("_stop_pressed"), &AnimationPlayerEditor::_stop_pressed);
ClassDB::bind_method(D_METHOD("_autoplay_pressed"), &AnimationPlayerEditor::_autoplay_pressed);
- ClassDB::bind_method(D_METHOD("_pause_pressed"), &AnimationPlayerEditor::_pause_pressed);
ClassDB::bind_method(D_METHOD("_animation_selected"), &AnimationPlayerEditor::_animation_selected);
ClassDB::bind_method(D_METHOD("_animation_name_edited"), &AnimationPlayerEditor::_animation_name_edited);
ClassDB::bind_method(D_METHOD("_animation_new"), &AnimationPlayerEditor::_animation_new);
@@ -1564,10 +1554,7 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_seek_value_changed"), &AnimationPlayerEditor::_seek_value_changed, DEFVAL(true));
ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed);
ClassDB::bind_method(D_METHOD("_blend_edited"), &AnimationPlayerEditor::_blend_edited);
- //ClassDB::bind_method(D_METHOD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed);
ClassDB::bind_method(D_METHOD("_scale_changed"), &AnimationPlayerEditor::_scale_changed);
- //ClassDB::bind_method(D_METHOD("_editor_store_all"),&AnimationPlayerEditor::_editor_store_all);
- //ClassDB::bind_method(D_METHOD("_editor_load_all"),&AnimationPlayerEditor::_editor_load_all);
ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed);
ClassDB::bind_method(D_METHOD("_animation_key_editor_seek"), &AnimationPlayerEditor::_animation_key_editor_seek);
ClassDB::bind_method(D_METHOD("_animation_key_editor_anim_len_changed"), &AnimationPlayerEditor::_animation_key_editor_anim_len_changed);
@@ -1582,6 +1569,8 @@ void AnimationPlayerEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_editor_visibility_changed"), &AnimationPlayerEditor::_editor_visibility_changed);
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_1"), &AnimationPlayerEditor::_prepare_onion_layers_1);
ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2);
+ ClassDB::bind_method(D_METHOD("_start_onion_skinning"), &AnimationPlayerEditor::_start_onion_skinning);
+ ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning);
ClassDB::bind_method(D_METHOD("_pin_pressed"), &AnimationPlayerEditor::_pin_pressed);
}
diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h
index dedce16bbc..398ef6ff14 100644
--- a/editor/plugins/animation_player_editor_plugin.h
+++ b/editor/plugins/animation_player_editor_plugin.h
@@ -170,7 +170,6 @@ class AnimationPlayerEditor : public VBoxContainer {
void _play_bw_from_pressed();
void _autoplay_pressed();
void _stop_pressed();
- void _pause_pressed();
void _animation_selected(int p_which);
void _animation_new();
void _animation_rename();
diff --git a/editor/plugins/animation_tree_editor_plugin.h b/editor/plugins/animation_tree_editor_plugin.h
index 4a7f933bbf..4ecbf2e05e 100644
--- a/editor/plugins/animation_tree_editor_plugin.h
+++ b/editor/plugins/animation_tree_editor_plugin.h
@@ -41,7 +41,8 @@
#include "scene/gui/tree.h"
class AnimationTreeNodeEditorPlugin : public VBoxContainer {
- GDCLASS(AnimationTreeNodeEditorPlugin, VBoxContainer)
+ GDCLASS(AnimationTreeNodeEditorPlugin, VBoxContainer);
+
public:
virtual bool can_edit(const Ref<AnimationNode> &p_node) = 0;
virtual void edit(const Ref<AnimationNode> &p_node) = 0;
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index fbf01a9405..3c24fd19b6 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -731,6 +731,8 @@ Vector2 CanvasItemEditor::_position_to_anchor(const Control *p_control, Vector2
ERR_FAIL_COND_V(!p_control, Vector2());
Rect2 parent_rect = p_control->get_parent_anchorable_rect();
+ ERR_FAIL_COND_V(parent_rect.size.x == 0, Vector2());
+ ERR_FAIL_COND_V(parent_rect.size.y == 0, Vector2());
return (p_control->get_transform().xform(position) - parent_rect.position) / parent_rect.size;
}
@@ -3348,9 +3350,6 @@ void CanvasItemEditor::_notification(int p_what) {
presets_menu->set_visible(true);
anchor_mode_button->set_visible(true);
- // Set the pressed state of the node
- anchor_mode_button->set_pressed(anchors_mode);
-
// Disable if the selected node is child of a container
if (has_container_parents) {
presets_menu->set_disabled(true);
@@ -3521,6 +3520,7 @@ void CanvasItemEditor::_selection_changed() {
}
}
anchors_mode = (nbValidControls == nbAnchorsMode);
+ anchor_mode_button->set_pressed(anchors_mode);
}
void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
@@ -3742,6 +3742,7 @@ void CanvasItemEditor::_set_anchors_and_margins_preset(Control::LayoutPreset p_p
undo_redo->commit_action();
anchors_mode = false;
+ anchor_mode_button->set_pressed(anchors_mode);
}
void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() {
@@ -3766,6 +3767,7 @@ void CanvasItemEditor::_set_anchors_and_margins_to_keep_ratio() {
undo_redo->add_undo_method(control, "set_meta", "_edit_use_anchors_", use_anchors);
anchors_mode = true;
+ anchor_mode_button->set_pressed(anchors_mode);
}
}
@@ -3912,7 +3914,6 @@ void CanvasItemEditor::_button_toggle_anchor_mode(bool p_status) {
}
anchors_mode = p_status;
-
viewport->update();
}
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
index 1622ce17b2..7c2116f06b 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp
@@ -75,6 +75,10 @@ void CPUParticles2DEditorPlugin::_menu_callback(int p_idx) {
emission_mask->popup_centered_minsize();
} break;
+ case MENU_RESTART: {
+
+ particles->restart();
+ }
}
}
@@ -265,6 +269,8 @@ CPUParticles2DEditorPlugin::CPUParticles2DEditorPlugin(EditorNode *p_node) {
menu = memnew(MenuButton);
menu->get_popup()->add_item(TTR("Load Emission Mask"), MENU_LOAD_EMISSION_MASK);
+ menu->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true);
diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.h b/editor/plugins/cpu_particles_2d_editor_plugin.h
index f715abd87b..84bbfff095 100644
--- a/editor/plugins/cpu_particles_2d_editor_plugin.h
+++ b/editor/plugins/cpu_particles_2d_editor_plugin.h
@@ -44,7 +44,8 @@ class CPUParticles2DEditorPlugin : public EditorPlugin {
enum {
MENU_LOAD_EMISSION_MASK,
- MENU_CLEAR_EMISSION_MASK
+ MENU_CLEAR_EMISSION_MASK,
+ MENU_RESTART
};
enum EmissionMode {
diff --git a/editor/plugins/cpu_particles_editor_plugin.cpp b/editor/plugins/cpu_particles_editor_plugin.cpp
index 70be9b95bb..93ffce41fa 100644
--- a/editor/plugins/cpu_particles_editor_plugin.cpp
+++ b/editor/plugins/cpu_particles_editor_plugin.cpp
@@ -62,6 +62,12 @@ void CPUParticlesEditor::_menu_option(int p_option) {
emission_tree_dialog->popup_centered_ratio();
} break;
+
+ case MENU_OPTION_RESTART: {
+
+ node->restart();
+
+ } break;
}
}
@@ -108,6 +114,8 @@ CPUParticlesEditor::CPUParticlesEditor() {
options->set_text(TTR("CPUParticles"));
options->get_popup()->add_item(TTR("Create Emission Points From Mesh"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH);
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", this, "_menu_option");
}
diff --git a/editor/plugins/cpu_particles_editor_plugin.h b/editor/plugins/cpu_particles_editor_plugin.h
index 09b0adbe5d..674f00dc9f 100644
--- a/editor/plugins/cpu_particles_editor_plugin.h
+++ b/editor/plugins/cpu_particles_editor_plugin.h
@@ -43,6 +43,7 @@ class CPUParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE,
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
+ MENU_OPTION_RESTART
};
diff --git a/editor/plugins/curve_editor_plugin.h b/editor/plugins/curve_editor_plugin.h
index b034368b6a..be774a9696 100644
--- a/editor/plugins/curve_editor_plugin.h
+++ b/editor/plugins/curve_editor_plugin.h
@@ -37,7 +37,8 @@
// Edits a y(x) curve
class CurveEditor : public Control {
- GDCLASS(CurveEditor, Control)
+ GDCLASS(CurveEditor, Control);
+
public:
CurveEditor();
@@ -120,14 +121,16 @@ private:
};
class EditorInspectorPluginCurve : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorPluginCurve, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorPluginCurve, EditorInspectorPlugin);
+
public:
virtual bool can_handle(Object *p_object);
virtual void parse_begin(Object *p_object);
};
class CurveEditorPlugin : public EditorPlugin {
- GDCLASS(CurveEditorPlugin, EditorPlugin)
+ GDCLASS(CurveEditorPlugin, EditorPlugin);
+
public:
CurveEditorPlugin(EditorNode *p_node);
@@ -135,7 +138,8 @@ public:
};
class CurvePreviewGenerator : public EditorResourcePreviewGenerator {
- GDCLASS(CurvePreviewGenerator, EditorResourcePreviewGenerator)
+ GDCLASS(CurvePreviewGenerator, EditorResourcePreviewGenerator);
+
public:
virtual bool handles(const String &p_type) const;
virtual Ref<Texture> generate(const Ref<Resource> &p_from, const Size2 p_size) const;
diff --git a/editor/plugins/editor_preview_plugins.h b/editor/plugins/editor_preview_plugins.h
index 16b1f3082b..12d693b10a 100644
--- a/editor/plugins/editor_preview_plugins.h
+++ b/editor/plugins/editor_preview_plugins.h
@@ -36,7 +36,8 @@
void post_process_preview(Ref<Image> p_image);
class EditorTexturePreviewPlugin : public EditorResourcePreviewGenerator {
- GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator)
+ GDCLASS(EditorTexturePreviewPlugin, EditorResourcePreviewGenerator);
+
public:
virtual bool handles(const String &p_type) const;
virtual bool generate_small_preview_automatically() const;
@@ -46,7 +47,8 @@ public:
};
class EditorImagePreviewPlugin : public EditorResourcePreviewGenerator {
- GDCLASS(EditorImagePreviewPlugin, EditorResourcePreviewGenerator)
+ GDCLASS(EditorImagePreviewPlugin, EditorResourcePreviewGenerator);
+
public:
virtual bool handles(const String &p_type) const;
virtual bool generate_small_preview_automatically() const;
@@ -56,7 +58,8 @@ public:
};
class EditorBitmapPreviewPlugin : public EditorResourcePreviewGenerator {
- GDCLASS(EditorBitmapPreviewPlugin, EditorResourcePreviewGenerator)
+ GDCLASS(EditorBitmapPreviewPlugin, EditorResourcePreviewGenerator);
+
public:
virtual bool handles(const String &p_type) const;
virtual bool generate_small_preview_automatically() const;
@@ -77,7 +80,7 @@ public:
class EditorMaterialPreviewPlugin : public EditorResourcePreviewGenerator {
- GDCLASS(EditorMaterialPreviewPlugin, EditorResourcePreviewGenerator)
+ GDCLASS(EditorMaterialPreviewPlugin, EditorResourcePreviewGenerator);
RID scenario;
RID sphere;
@@ -123,7 +126,7 @@ public:
class EditorMeshPreviewPlugin : public EditorResourcePreviewGenerator {
- GDCLASS(EditorMeshPreviewPlugin, EditorResourcePreviewGenerator)
+ GDCLASS(EditorMeshPreviewPlugin, EditorResourcePreviewGenerator);
RID scenario;
RID mesh_instance;
@@ -151,7 +154,7 @@ public:
class EditorFontPreviewPlugin : public EditorResourcePreviewGenerator {
- GDCLASS(EditorFontPreviewPlugin, EditorResourcePreviewGenerator)
+ GDCLASS(EditorFontPreviewPlugin, EditorResourcePreviewGenerator);
RID viewport;
RID viewport_texture;
diff --git a/editor/plugins/gradient_editor_plugin.h b/editor/plugins/gradient_editor_plugin.h
index 91790abee8..a87a5fe0ba 100644
--- a/editor/plugins/gradient_editor_plugin.h
+++ b/editor/plugins/gradient_editor_plugin.h
@@ -36,7 +36,7 @@
#include "scene/gui/gradient_edit.h"
class GradientEditor : public GradientEdit {
- GDCLASS(GradientEditor, GradientEdit)
+ GDCLASS(GradientEditor, GradientEdit);
bool editing;
Ref<Gradient> gradient;
@@ -54,7 +54,8 @@ public:
};
class EditorInspectorPluginGradient : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorPluginGradient, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorPluginGradient, EditorInspectorPlugin);
+
public:
virtual bool can_handle(Object *p_object);
virtual void parse_begin(Object *p_object);
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index c3f14c27e5..1405127ab3 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -78,7 +78,7 @@ public:
};
class EditorInspectorPluginMaterial : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorPluginMaterial, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorPluginMaterial, EditorInspectorPlugin);
Ref<Environment> env;
public:
@@ -99,7 +99,8 @@ public:
};
class SpatialMaterialConversionPlugin : public EditorResourceConversionPlugin {
- GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin)
+ GDCLASS(SpatialMaterialConversionPlugin, EditorResourceConversionPlugin);
+
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
@@ -107,7 +108,8 @@ public:
};
class ParticlesMaterialConversionPlugin : public EditorResourceConversionPlugin {
- GDCLASS(ParticlesMaterialConversionPlugin, EditorResourceConversionPlugin)
+ GDCLASS(ParticlesMaterialConversionPlugin, EditorResourceConversionPlugin);
+
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
@@ -115,7 +117,8 @@ public:
};
class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin {
- GDCLASS(CanvasItemMaterialConversionPlugin, EditorResourceConversionPlugin)
+ GDCLASS(CanvasItemMaterialConversionPlugin, EditorResourceConversionPlugin);
+
public:
virtual String converts_to() const;
virtual bool handles(const Ref<Resource> &p_resource) const;
diff --git a/editor/plugins/mesh_editor_plugin.h b/editor/plugins/mesh_editor_plugin.h
index 8ada2dac90..4c2a81ed70 100644
--- a/editor/plugins/mesh_editor_plugin.h
+++ b/editor/plugins/mesh_editor_plugin.h
@@ -73,7 +73,8 @@ public:
};
class EditorInspectorPluginMesh : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorPluginMesh, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorPluginMesh, EditorInspectorPlugin);
+
public:
virtual bool can_handle(Object *p_object);
virtual void parse_begin(Object *p_object);
diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp
index 6fabdc93c6..e68bca55cb 100644
--- a/editor/plugins/particles_2d_editor_plugin.cpp
+++ b/editor/plugins/particles_2d_editor_plugin.cpp
@@ -96,12 +96,16 @@ void Particles2DEditorPlugin::_menu_callback(int p_idx) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", particles, cpu_particles, true, false);
- ur->add_do_reference(particles);
+ ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, particles, false, false);
- ur->add_undo_reference(this);
+ ur->add_undo_reference(particles);
ur->commit_action();
} break;
+ case MENU_RESTART: {
+
+ particles->restart();
+ }
}
}
@@ -380,6 +384,8 @@ Particles2DEditorPlugin::Particles2DEditorPlugin(EditorNode *p_node) {
// menu->get_popup()->add_item(TTR("Clear Emission Mask"), MENU_CLEAR_EMISSION_MASK);
menu->get_popup()->add_separator();
menu->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
+ menu->get_popup()->add_separator();
+ menu->get_popup()->add_item(TTR("Restart"), MENU_RESTART);
menu->set_text(TTR("Particles"));
menu->set_switch_on_hover(true);
toolbar->add_child(menu);
diff --git a/editor/plugins/particles_2d_editor_plugin.h b/editor/plugins/particles_2d_editor_plugin.h
index 35b874fb25..0f092aaa4f 100644
--- a/editor/plugins/particles_2d_editor_plugin.h
+++ b/editor/plugins/particles_2d_editor_plugin.h
@@ -47,7 +47,8 @@ class Particles2DEditorPlugin : public EditorPlugin {
MENU_GENERATE_VISIBILITY_RECT,
MENU_LOAD_EMISSION_MASK,
MENU_CLEAR_EMISSION_MASK,
- MENU_OPTION_CONVERT_TO_CPU_PARTICLES
+ MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
+ MENU_RESTART
};
enum EmissionMode {
diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp
index 3f4f66a26d..f05e7d65d3 100644
--- a/editor/plugins/particles_editor_plugin.cpp
+++ b/editor/plugins/particles_editor_plugin.cpp
@@ -315,12 +315,17 @@ void ParticlesEditor::_menu_option(int p_option) {
UndoRedo *ur = EditorNode::get_singleton()->get_undo_redo();
ur->create_action(TTR("Convert to CPUParticles"));
ur->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", node, cpu_particles, true, false);
- ur->add_do_reference(node);
+ ur->add_do_reference(cpu_particles);
ur->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock(), "replace_node", cpu_particles, node, false, false);
- ur->add_undo_reference(this);
+ ur->add_undo_reference(node);
ur->commit_action();
} break;
+ case MENU_OPTION_RESTART: {
+
+ node->restart();
+
+ } break;
}
}
@@ -471,6 +476,8 @@ ParticlesEditor::ParticlesEditor() {
options->get_popup()->add_item(TTR("Create Emission Points From Node"), MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE);
options->get_popup()->add_separator();
options->get_popup()->add_item(TTR("Convert to CPUParticles"), MENU_OPTION_CONVERT_TO_CPU_PARTICLES);
+ options->get_popup()->add_separator();
+ options->get_popup()->add_item(TTR("Restart"), MENU_OPTION_RESTART);
options->get_popup()->connect("id_pressed", this, "_menu_option");
diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h
index b1b3e3c1c0..5d05fbd4ac 100644
--- a/editor/plugins/particles_editor_plugin.h
+++ b/editor/plugins/particles_editor_plugin.h
@@ -42,7 +42,7 @@
class ParticlesEditorBase : public Control {
- GDCLASS(ParticlesEditorBase, Control)
+ GDCLASS(ParticlesEditorBase, Control);
protected:
Spatial *base_node;
@@ -86,6 +86,7 @@ class ParticlesEditor : public ParticlesEditorBase {
MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH,
MENU_OPTION_CLEAR_EMISSION_VOLUME,
MENU_OPTION_CONVERT_TO_CPU_PARTICLES,
+ MENU_OPTION_RESTART,
};
diff --git a/editor/plugins/root_motion_editor_plugin.h b/editor/plugins/root_motion_editor_plugin.h
index e7fd597235..af5d8fc122 100644
--- a/editor/plugins/root_motion_editor_plugin.h
+++ b/editor/plugins/root_motion_editor_plugin.h
@@ -37,7 +37,7 @@
#include "scene/animation/animation_tree.h"
class EditorPropertyRootMotion : public EditorProperty {
- GDCLASS(EditorPropertyRootMotion, EditorProperty)
+ GDCLASS(EditorPropertyRootMotion, EditorProperty);
Button *assign;
Button *clear;
NodePath base_hint;
@@ -60,7 +60,7 @@ public:
};
class EditorInspectorRootMotionPlugin : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorRootMotionPlugin, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorRootMotionPlugin, EditorInspectorPlugin);
public:
virtual bool can_handle(Object *p_object);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index df9ce73914..1b00889e9a 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -306,8 +306,11 @@ void ScriptEditor::_goto_script_line(REF p_script, int p_line) {
editor->push_item(p_script.ptr());
ScriptEditorBase *current = _get_current_editor();
- if (current)
+ if (ScriptTextEditor *script_text_editor = Object::cast_to<ScriptTextEditor>(current)) {
+ script_text_editor->goto_line_centered(p_line);
+ } else if (current) {
current->goto_line(p_line, true);
+ }
}
}
}
@@ -1249,7 +1252,7 @@ void ScriptEditor::_menu_option(int p_option) {
if (p_option >= WINDOW_SELECT_BASE) {
tab_container->set_current_tab(p_option - WINDOW_SELECT_BASE);
- script_list->select(p_option - WINDOW_SELECT_BASE);
+ _update_script_names();
}
}
}
@@ -1376,6 +1379,8 @@ void ScriptEditor::_notification(int p_what) {
script_forward->set_icon(get_icon("Forward", "EditorIcons"));
script_back->set_icon(get_icon("Back", "EditorIcons"));
members_overview_alphabeta_sort_button->set_icon(get_icon("Sort", "EditorIcons"));
+ filter_scripts->set_right_icon(get_icon("Search", "EditorIcons"));
+ filter_methods->set_right_icon(get_icon("Search", "EditorIcons"));
} break;
case NOTIFICATION_READY: {
@@ -1633,8 +1638,12 @@ void ScriptEditor::_update_members_overview() {
}
for (int i = 0; i < functions.size(); i++) {
- members_overview->add_item(functions[i].get_slice(":", 0));
- members_overview->set_item_metadata(i, functions[i].get_slice(":", 1).to_int() - 1);
+ String filter = filter_methods->get_text();
+ String name = functions[i].get_slice(":", 0);
+ if (filter == "" || filter.is_subsequence_ofi(name)) {
+ members_overview->add_item(name);
+ members_overview->set_item_metadata(members_overview->get_item_count() - 1, functions[i].get_slice(":", 1).to_int() - 1);
+ }
}
String path = se->get_edited_resource()->get_path();
@@ -1853,20 +1862,26 @@ void ScriptEditor::_update_script_names() {
_sort_list_on_update = false;
}
+ Vector<_ScriptEditorItemData> sedata_filtered;
for (int i = 0; i < sedata.size(); i++) {
+ String filter = filter_scripts->get_text();
+ if (filter == "" || filter.is_subsequence_ofi(sedata[i].name)) {
+ sedata_filtered.push_back(sedata[i]);
+ }
+ }
- script_list->add_item(sedata[i].name, sedata[i].icon);
+ for (int i = 0; i < sedata_filtered.size(); i++) {
+ script_list->add_item(sedata_filtered[i].name, sedata_filtered[i].icon);
int index = script_list->get_item_count() - 1;
- script_list->set_item_tooltip(index, sedata[i].tooltip);
- script_list->set_item_metadata(index, sedata[i].index);
- if (sedata[i].used) {
-
+ script_list->set_item_tooltip(index, sedata_filtered[i].tooltip);
+ script_list->set_item_metadata(index, sedata_filtered[i].index); /* Saving as metadata the script's index in the tab container and not the filtered one */
+ if (sedata_filtered[i].used) {
script_list->set_item_custom_bg_color(index, Color(88 / 255.0, 88 / 255.0, 60 / 255.0));
}
- if (tab_container->get_current_tab() == sedata[i].index) {
+ if (tab_container->get_current_tab() == sedata_filtered[i].index) {
script_list->select(index);
- script_name_label->set_text(sedata[i].name);
- script_icon->set_texture(sedata[i].icon);
+ script_name_label->set_text(sedata_filtered[i].name);
+ script_icon->set_texture(sedata_filtered[i].icon);
}
}
@@ -1903,9 +1918,7 @@ Ref<TextFile> ScriptEditor::_load_text_file(const String &p_path, Error *r_error
Ref<TextFile> text_res(text_file);
Error err = text_file->load_text(path);
- if (err != OK) {
- ERR_FAIL_COND_V(err != OK, RES());
- }
+ ERR_FAIL_COND_V(err != OK, RES());
text_file->set_file_path(local_path);
text_file->set_path(local_path, true);
@@ -2049,7 +2062,7 @@ bool ScriptEditor::edit(const RES &p_resource, int p_line, int p_col, bool p_gra
if (should_open) {
if (tab_container->get_current_tab() != i) {
_go_to_tab(i);
- script_list->select(script_list->find_metadata(i));
+ _update_script_names();
}
if (is_visible_in_tree())
se->ensure_focus();
@@ -2427,7 +2440,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node);
EditorHelp *eh = Object::cast_to<EditorHelp>(node);
if (se || eh) {
- int new_index = script_list->get_item_at_position(p_point);
+ int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point));
tab_container->move_child(node, new_index);
tab_container->set_current_tab(new_index);
_update_script_names();
@@ -2444,7 +2457,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(node);
EditorHelp *eh = Object::cast_to<EditorHelp>(node);
if (se || eh) {
- int new_index = script_list->get_item_at_position(p_point);
+ int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point));
tab_container->move_child(node, new_index);
tab_container->set_current_tab(new_index);
_update_script_names();
@@ -2455,7 +2468,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
Vector<String> files = d["files"];
- int new_index = script_list->get_item_at_position(p_point);
+ int new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point));
int num_tabs_before = tab_container->get_child_count();
for (int i = 0; i < files.size(); i++) {
String file = files[i];
@@ -2467,7 +2480,7 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
if (tab_container->get_child_count() > num_tabs_before) {
tab_container->move_child(tab_container->get_child(tab_container->get_child_count() - 1), new_index);
num_tabs_before = tab_container->get_child_count();
- } else {
+ } else { /* Maybe script was already open */
tab_container->move_child(tab_container->get_child(tab_container->get_current_tab()), new_index);
}
}
@@ -2962,6 +2975,14 @@ void ScriptEditor::_on_find_in_files_modified_files(PoolStringArray paths) {
_update_modified_scripts_for_external_editor();
}
+void ScriptEditor::_filter_scripts_text_changed(const String &p_newtext) {
+ _update_script_names();
+}
+
+void ScriptEditor::_filter_methods_text_changed(const String &p_newtext) {
+ _update_members_overview();
+}
+
void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action);
@@ -3013,6 +3034,8 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_toggle_members_overview_alpha_sort", &ScriptEditor::_toggle_members_overview_alpha_sort);
ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed);
+ ClassDB::bind_method("_filter_scripts_text_changed", &ScriptEditor::_filter_scripts_text_changed);
+ ClassDB::bind_method("_filter_methods_text_changed", &ScriptEditor::_filter_methods_text_changed);
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);
ClassDB::bind_method("_on_find_in_files_requested", &ScriptEditor::_on_find_in_files_requested);
ClassDB::bind_method("_start_find_in_files", &ScriptEditor::_start_find_in_files);
@@ -3059,8 +3082,18 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
script_split->add_child(list_split);
list_split->set_v_size_flags(SIZE_EXPAND_FILL);
+ scripts_vbox = memnew(VBoxContainer);
+ scripts_vbox->set_v_size_flags(SIZE_EXPAND_FILL);
+ list_split->add_child(scripts_vbox);
+
+ filter_scripts = memnew(LineEdit);
+ filter_scripts->set_placeholder(TTR("Filter scripts"));
+ filter_scripts->set_clear_button_enabled(true);
+ filter_scripts->connect("text_changed", this, "_filter_scripts_text_changed");
+ scripts_vbox->add_child(filter_scripts);
+
script_list = memnew(ItemList);
- list_split->add_child(script_list);
+ scripts_vbox->add_child(script_list);
script_list->set_custom_minimum_size(Size2(150, 90) * EDSCALE); //need to give a bit of limit to avoid it from disappearing
script_list->set_v_size_flags(SIZE_EXPAND_FILL);
script_split->set_split_offset(140);
@@ -3096,6 +3129,12 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
buttons_hbox->add_child(members_overview_alphabeta_sort_button);
+ filter_methods = memnew(LineEdit);
+ filter_methods->set_placeholder(TTR("Filter methods"));
+ filter_methods->set_clear_button_enabled(true);
+ filter_methods->connect("text_changed", this, "_filter_methods_text_changed");
+ overview_vbox->add_child(filter_methods);
+
members_overview = memnew(ItemList);
overview_vbox->add_child(members_overview);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 549af1ca31..4ad2156779 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -38,6 +38,7 @@
#include "editor/editor_plugin.h"
#include "editor/script_create_dialog.h"
#include "scene/gui/item_list.h"
+#include "scene/gui/line_edit.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/split_container.h"
#include "scene/gui/tab_container.h"
@@ -49,7 +50,7 @@
class ScriptEditorQuickOpen : public ConfirmationDialog {
- GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog)
+ GDCLASS(ScriptEditorQuickOpen, ConfirmationDialog);
LineEdit *search_box;
Tree *search_options;
@@ -76,7 +77,7 @@ class ScriptEditorDebugger;
class ScriptEditorBase : public VBoxContainer {
- GDCLASS(ScriptEditorBase, VBoxContainer)
+ GDCLASS(ScriptEditorBase, VBoxContainer);
protected:
static void _bind_methods();
@@ -213,6 +214,9 @@ class ScriptEditor : public PanelContainer {
ItemList *script_list;
HSplitContainer *script_split;
ItemList *members_overview;
+ LineEdit *filter_scripts;
+ LineEdit *filter_methods;
+ VBoxContainer *scripts_vbox;
VBoxContainer *overview_vbox;
HBoxContainer *buttons_hbox;
Label *filename;
@@ -341,6 +345,8 @@ class ScriptEditor : public PanelContainer {
void _update_members_overview_visibility();
void _update_members_overview();
void _toggle_members_overview_alpha_sort(bool p_alphabetic_sort);
+ void _filter_scripts_text_changed(const String &p_newtext);
+ void _filter_methods_text_changed(const String &p_newtext);
void _update_script_names();
void _update_script_connections();
bool _sort_list_on_update;
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index ce0859a1f6..9bf3a9f0eb 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -237,7 +237,7 @@ void ScriptTextEditor::_load_theme_settings() {
text_edit->add_color_override("safe_line_number_color", safe_line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
- text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("font_color_selected", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_color_override("current_line_color", current_line_color);
@@ -487,6 +487,11 @@ void ScriptTextEditor::goto_line_selection(int p_line, int p_begin, int p_end) {
code_editor->goto_line_selection(p_line, p_begin, p_end);
}
+void ScriptTextEditor::goto_line_centered(int p_line) {
+
+ code_editor->goto_line_centered(p_line);
+}
+
void ScriptTextEditor::set_executing_line(int p_line) {
code_editor->set_executing_line(p_line);
}
diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h
index 24d40a5eec..89975e061e 100644
--- a/editor/plugins/script_text_editor.h
+++ b/editor/plugins/script_text_editor.h
@@ -201,6 +201,7 @@ public:
virtual void goto_line(int p_line, bool p_with_error = false);
void goto_line_selection(int p_line, int p_begin, int p_end);
+ void goto_line_centered(int p_line);
virtual void set_executing_line(int p_line);
virtual void clear_executing_line();
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index f9ca38b919..d02817f6e8 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -124,7 +124,7 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_override("line_number_color", line_number_color);
get_text_edit()->add_color_override("caret_color", caret_color);
get_text_edit()->add_color_override("caret_background_color", caret_background_color);
- get_text_edit()->add_color_override("font_selected_color", text_selected_color);
+ get_text_edit()->add_color_override("font_color_selected", text_selected_color);
get_text_edit()->add_color_override("selection_color", selection_color);
get_text_edit()->add_color_override("brace_mismatch_color", brace_mismatch_color);
get_text_edit()->add_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index a1c0b732fa..7f7ae8f273 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -1275,13 +1275,13 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
_edit.mode = TRANSFORM_TRANSLATE;
}
- if (cursor.region_select && nav_mode == NAVIGATION_NONE) {
+ if (cursor.region_select) {
cursor.region_end = m->get_position();
surface->update();
return;
}
- if (_edit.mode == TRANSFORM_NONE && nav_mode == NAVIGATION_NONE)
+ if (_edit.mode == TRANSFORM_NONE)
return;
Vector3 ray_pos = _get_ray_pos(m->get_position());
diff --git a/editor/plugins/spatial_editor_plugin.h b/editor/plugins/spatial_editor_plugin.h
index f3a1e657cc..701b9e8144 100644
--- a/editor/plugins/spatial_editor_plugin.h
+++ b/editor/plugins/spatial_editor_plugin.h
@@ -178,6 +178,12 @@ public:
GIZMO_GRID_LAYER = 25
};
+ enum NavigationScheme {
+ NAVIGATION_GODOT,
+ NAVIGATION_MAYA,
+ NAVIGATION_MODO,
+ };
+
private:
int index;
String name;
@@ -260,12 +266,6 @@ private:
PopupMenu *selection_menu;
- enum NavigationScheme {
- NAVIGATION_GODOT,
- NAVIGATION_MAYA,
- NAVIGATION_MODO,
- };
-
enum NavigationZoomStyle {
NAVIGATION_ZOOM_VERTICAL,
NAVIGATION_ZOOM_HORIZONTAL
@@ -431,7 +431,8 @@ public:
class SpatialEditorViewportContainer : public Container {
- GDCLASS(SpatialEditorViewportContainer, Container)
+ GDCLASS(SpatialEditorViewportContainer, Container);
+
public:
enum View {
VIEW_USE_1_VIEWPORT,
diff --git a/editor/plugins/style_box_editor_plugin.h b/editor/plugins/style_box_editor_plugin.h
index 95d21b2c44..d31a28b3e4 100644
--- a/editor/plugins/style_box_editor_plugin.h
+++ b/editor/plugins/style_box_editor_plugin.h
@@ -56,7 +56,8 @@ public:
};
class EditorInspectorPluginStyleBox : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorPluginStyleBox, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorPluginStyleBox, EditorInspectorPlugin);
+
public:
virtual bool can_handle(Object *p_object);
virtual void parse_begin(Object *p_object);
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index eeef3397d2..787813336d 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -116,7 +116,7 @@ void TextEditor::_load_theme_settings() {
text_edit->add_color_override("line_number_color", line_number_color);
text_edit->add_color_override("caret_color", caret_color);
text_edit->add_color_override("caret_background_color", caret_background_color);
- text_edit->add_color_override("font_selected_color", text_selected_color);
+ text_edit->add_color_override("font_color_selected", text_selected_color);
text_edit->add_color_override("selection_color", selection_color);
text_edit->add_color_override("brace_mismatch_color", brace_mismatch_color);
text_edit->add_color_override("current_line_color", current_line_color);
diff --git a/editor/plugins/text_editor.h b/editor/plugins/text_editor.h
index e91909e0ea..277e93fd39 100644
--- a/editor/plugins/text_editor.h
+++ b/editor/plugins/text_editor.h
@@ -35,7 +35,7 @@
class TextEditor : public ScriptEditorBase {
- GDCLASS(TextEditor, ScriptEditorBase)
+ GDCLASS(TextEditor, ScriptEditorBase);
private:
CodeTextEditor *code_editor;
diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h
index bcbda1fbd7..ed25783303 100644
--- a/editor/plugins/texture_editor_plugin.h
+++ b/editor/plugins/texture_editor_plugin.h
@@ -54,7 +54,8 @@ public:
};
class EditorInspectorPluginTexture : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorPluginTexture, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorPluginTexture, EditorInspectorPlugin);
+
public:
virtual bool can_handle(Object *p_object);
virtual void parse_begin(Object *p_object);
diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h
index 1176e1bb92..04e8d65155 100644
--- a/editor/plugins/tile_set_editor_plugin.h
+++ b/editor/plugins/tile_set_editor_plugin.h
@@ -31,7 +31,6 @@
#ifndef TILE_SET_EDITOR_PLUGIN_H
#define TILE_SET_EDITOR_PLUGIN_H
-#include "editor/editor_name_dialog.h"
#include "editor/editor_node.h"
#include "scene/2d/sprite.h"
#include "scene/resources/concave_polygon_shape_2d.h"
@@ -46,7 +45,7 @@ class TileSetEditor : public HSplitContainer {
friend class TileSetEditorPlugin;
friend class TilesetEditorContext;
- GDCLASS(TileSetEditor, HSplitContainer)
+ GDCLASS(TileSetEditor, HSplitContainer);
enum TextureToolButtons {
TOOL_TILESET_ADD_TEXTURE,
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index a1b903576e..bfb005cd0b 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -573,13 +573,11 @@ void VisualShaderEditor::_update_graph() {
name_box->connect("text_entered", this, "_change_input_port_name", varray(name_box, nodes[n_i], i));
name_box->connect("focus_exited", this, "_port_name_focus_out", varray(name_box, nodes[n_i], i, false));
- if (is_group) {
- Button *remove_btn = memnew(Button);
- remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
- remove_btn->set_tooltip(TTR("Remove") + " " + name_left);
- remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED);
- hb->add_child(remove_btn);
- }
+ Button *remove_btn = memnew(Button);
+ remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("Remove", "EditorIcons"));
+ remove_btn->set_tooltip(TTR("Remove") + " " + name_left);
+ remove_btn->connect("pressed", this, "_remove_input_port", varray(nodes[n_i], i), CONNECT_DEFERRED);
+ hb->add_child(remove_btn);
} else {
Label *label = memnew(Label);
@@ -2350,7 +2348,7 @@ VisualShaderEditorPlugin::~VisualShaderEditorPlugin() {
////////////////
class VisualShaderNodePluginInputEditor : public OptionButton {
- GDCLASS(VisualShaderNodePluginInputEditor, OptionButton)
+ GDCLASS(VisualShaderNodePluginInputEditor, OptionButton);
Ref<VisualShaderNodeInput> input;
@@ -2395,7 +2393,8 @@ public:
};
class VisualShaderNodePluginDefaultEditor : public VBoxContainer {
- GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer)
+ GDCLASS(VisualShaderNodePluginDefaultEditor, VBoxContainer);
+
public:
void _property_changed(const String &prop, const Variant &p_value, const String &p_field, bool p_changing = false) {
diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h
index 1b009b61d5..567706b808 100644
--- a/editor/plugins/visual_shader_editor_plugin.h
+++ b/editor/plugins/visual_shader_editor_plugin.h
@@ -42,7 +42,8 @@
class VisualShaderNodePlugin : public Reference {
- GDCLASS(VisualShaderNodePlugin, Reference)
+ GDCLASS(VisualShaderNodePlugin, Reference);
+
protected:
static void _bind_methods();
@@ -245,14 +246,14 @@ public:
class VisualShaderNodePluginDefault : public VisualShaderNodePlugin {
- GDCLASS(VisualShaderNodePluginDefault, VisualShaderNodePlugin)
+ GDCLASS(VisualShaderNodePluginDefault, VisualShaderNodePlugin);
public:
virtual Control *create_editor(const Ref<VisualShaderNode> &p_node);
};
class EditorPropertyShaderMode : public EditorProperty {
- GDCLASS(EditorPropertyShaderMode, EditorProperty)
+ GDCLASS(EditorPropertyShaderMode, EditorProperty);
OptionButton *options;
void _option_selected(int p_which);
@@ -268,7 +269,7 @@ public:
};
class EditorInspectorShaderModePlugin : public EditorInspectorPlugin {
- GDCLASS(EditorInspectorShaderModePlugin, EditorInspectorPlugin)
+ GDCLASS(EditorInspectorShaderModePlugin, EditorInspectorPlugin);
public:
virtual bool can_handle(Object *p_object);
@@ -278,7 +279,7 @@ public:
};
class VisualShaderNodePortPreview : public Control {
- GDCLASS(VisualShaderNodePortPreview, Control)
+ GDCLASS(VisualShaderNodePortPreview, Control);
Ref<VisualShader> shader;
VisualShader::Type type;
int node;
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 9a3991bef1..4b3d468a61 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -919,28 +919,37 @@ public:
struct ProjectItem {
String project;
+ String project_name;
String path;
String conf;
- int config_version;
+ String icon;
+ String main_scene;
uint64_t last_modified;
bool favorite;
bool grayed;
- bool ordered_latest_modification;
+ ProjectListFilter::FilterOption filter_order_option;
ProjectItem() {}
- ProjectItem(const String &p_project, const String &p_path, const String &p_conf, int p_config_version, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false, const bool p_ordered_latest_modification = true) {
+ ProjectItem(const String &p_project, const String &p_name, const String &p_path, const String &p_conf, const String &p_icon, const String &p_main_scene, uint64_t p_last_modified, bool p_favorite = false, bool p_grayed = false, const ProjectListFilter::FilterOption p_filter_order_option = ProjectListFilter::FILTER_NAME) {
project = p_project;
+ project_name = p_name;
path = p_path;
conf = p_conf;
- config_version = p_config_version;
+ icon = p_icon;
+ main_scene = p_main_scene;
last_modified = p_last_modified;
favorite = p_favorite;
grayed = p_grayed;
- ordered_latest_modification = p_ordered_latest_modification;
+ filter_order_option = p_filter_order_option;
}
_FORCE_INLINE_ bool operator<(const ProjectItem &l) const {
- if (ordered_latest_modification)
- return last_modified > l.last_modified;
- return project < l.project;
+ switch (filter_order_option) {
+ case ProjectListFilter::FILTER_PATH:
+ return project < l.project;
+ case ProjectListFilter::FILTER_MODIFIED:
+ return last_modified > l.last_modified;
+ default:
+ return project_name < l.project_name;
+ }
}
_FORCE_INLINE_ bool operator==(const ProjectItem &l) const { return project == l.project; }
};
@@ -1256,13 +1265,7 @@ void ProjectManager::_load_recent_projects() {
Color font_color = gui_base->get_color("font_color", "Tree");
- bool set_ordered_latest_modification;
ProjectListFilter::FilterOption filter_order_option = project_order_filter->get_filter_option();
- if (filter_order_option == ProjectListFilter::FILTER_NAME) {
- set_ordered_latest_modification = false;
- } else {
- set_ordered_latest_modification = true;
- }
EditorSettings::get_singleton()->set("project_manager/sorting_order", (int)filter_order_option);
List<ProjectItem> projects;
@@ -1280,10 +1283,30 @@ void ProjectManager::_load_recent_projects() {
String project = _name.get_slice("/", 1);
String conf = path.plus_file("project.godot");
- int config_version = 0; // Assume 0 until we know better
bool favorite = (_name.begins_with("favorite_projects/")) ? true : false;
bool grayed = false;
+ Ref<ConfigFile> cf = memnew(ConfigFile);
+ Error cf_err = cf->load(conf);
+
+ int config_version = 0;
+ String project_name = TTR("Unnamed Project");
+ if (cf_err == OK) {
+
+ String cf_project_name = static_cast<String>(cf->get_value("application", "config/name", ""));
+ if (cf_project_name != "")
+ project_name = cf_project_name.xml_unescape();
+ config_version = (int)cf->get_value("", "config_version", 0);
+ }
+
+ if (config_version > ProjectSettings::CONFIG_VERSION) {
+ // Comes from an incompatible (more recent) Godot version, grey it out
+ grayed = true;
+ }
+
+ String icon = cf->get_value("application", "config/icon", "");
+ String main_scene = cf->get_value("application", "run/main_scene", "");
+
uint64_t last_modified = 0;
if (FileAccess::exists(conf)) {
last_modified = FileAccess::get_modified_time(conf);
@@ -1298,7 +1321,7 @@ void ProjectManager::_load_recent_projects() {
grayed = true;
}
- ProjectItem item(project, path, conf, config_version, last_modified, favorite, grayed, set_ordered_latest_modification);
+ ProjectItem item(project, project_name, path, conf, icon, main_scene, last_modified, favorite, grayed, filter_order_option);
if (favorite)
favorite_projects.push_back(item);
else
@@ -1326,43 +1349,23 @@ void ProjectManager::_load_recent_projects() {
String path = item.path;
String conf = item.conf;
- Ref<ConfigFile> cf = memnew(ConfigFile);
- Error cf_err = cf->load(conf);
-
- String project_name = TTR("Unnamed Project");
- if (cf_err == OK && cf->has_section_key("application", "config/name")) {
- project_name = static_cast<String>(cf->get_value("application", "config/name")).xml_unescape();
- }
-
- if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && project_name.findn(search_term) == -1)
+ if (filter_option == ProjectListFilter::FILTER_NAME && search_term != "" && item.project_name.findn(search_term) == -1)
continue;
Ref<Texture> icon;
- String main_scene;
-
- if (cf_err == OK) {
- item.config_version = (int)cf->get_value("", "config_version", 0);
- if (item.config_version > ProjectSettings::CONFIG_VERSION) {
- // Comes from an incompatible (more recent) Godot version, grey it out
- item.grayed = true;
- }
- String appicon = cf->get_value("application", "config/icon", "");
- if (appicon != "") {
- Ref<Image> img;
- img.instance();
- Error err = img->load(appicon.replace_first("res://", path + "/"));
- if (err == OK) {
-
- Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons");
- img->resize(default_icon->get_width(), default_icon->get_height());
- Ref<ImageTexture> it = memnew(ImageTexture);
- it->create_from_image(img);
- icon = it;
- }
+ if (item.icon != "") {
+ Ref<Image> img;
+ img.instance();
+ Error err = img->load(item.icon.replace_first("res://", path + "/"));
+ if (err == OK) {
+
+ Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons");
+ img->resize(default_icon->get_width(), default_icon->get_height());
+ Ref<ImageTexture> it = memnew(ImageTexture);
+ it->create_from_image(img);
+ icon = it;
}
-
- main_scene = cf->get_value("application", "run/main_scene", "");
}
if (icon.is_null()) {
@@ -1376,7 +1379,7 @@ void ProjectManager::_load_recent_projects() {
HBoxContainer *hb = memnew(HBoxContainer);
hb->set_meta("name", project);
- hb->set_meta("main_scene", main_scene);
+ hb->set_meta("main_scene", item.main_scene);
hb->set_meta("favorite", is_favorite);
hb->connect("draw", this, "_panel_draw", varray(hb));
hb->connect("gui_input", this, "_panel_input", varray(hb));
@@ -1406,7 +1409,7 @@ void ProjectManager::_load_recent_projects() {
ec->set_custom_minimum_size(Size2(0, 1));
ec->set_mouse_filter(MOUSE_FILTER_PASS);
vb->add_child(ec);
- Label *title = memnew(Label(project_name));
+ Label *title = memnew(Label(item.project_name));
title->add_font_override("font", gui_base->get_font("title", "EditorFonts"));
title->add_color_override("font_color", font_color);
title->set_clip_text(true);
@@ -2020,6 +2023,7 @@ ProjectManager::ProjectManager() {
sort_filters->add_child(sort_label);
Vector<String> sort_filter_titles;
sort_filter_titles.push_back("Name");
+ sort_filter_titles.push_back("Path");
sort_filter_titles.push_back("Last Modified");
project_order_filter = memnew(ProjectListFilter);
project_order_filter->_setup_filters(sort_filter_titles);
diff --git a/editor/project_manager.h b/editor/project_manager.h
index a7cc6549f5..d75d7164cc 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -131,17 +131,19 @@ class ProjectListFilter : public HBoxContainer {
GDCLASS(ProjectListFilter, HBoxContainer);
+public:
+ enum FilterOption {
+ FILTER_NAME,
+ FILTER_PATH,
+ FILTER_MODIFIED,
+ };
+
private:
friend class ProjectManager;
OptionButton *filter_option;
LineEdit *search_box;
bool has_search_box;
-
- enum FilterOption {
- FILTER_NAME,
- FILTER_PATH,
- };
FilterOption _current_filter;
void _search_text_changed(const String &p_newtext);
diff --git a/editor/property_editor.h b/editor/property_editor.h
index 6a709d348b..a8ef1d6fc1 100644
--- a/editor/property_editor.h
+++ b/editor/property_editor.h
@@ -56,7 +56,7 @@ class PropertySelector;
class EditorResourceConversionPlugin : public Reference {
- GDCLASS(EditorResourceConversionPlugin, Reference)
+ GDCLASS(EditorResourceConversionPlugin, Reference);
protected:
static void _bind_methods();
diff --git a/editor/property_selector.h b/editor/property_selector.h
index cc5b1d4884..a6c1ec6498 100644
--- a/editor/property_selector.h
+++ b/editor/property_selector.h
@@ -36,7 +36,7 @@
#include "scene/gui/rich_text_label.h"
class PropertySelector : public ConfirmationDialog {
- GDCLASS(PropertySelector, ConfirmationDialog)
+ GDCLASS(PropertySelector, ConfirmationDialog);
LineEdit *search_box;
Tree *search_options;
diff --git a/editor/quick_open.h b/editor/quick_open.h
index 14d857fa1c..b6a2e50e88 100644
--- a/editor/quick_open.h
+++ b/editor/quick_open.h
@@ -37,7 +37,7 @@
#include "scene/gui/tree.h"
class EditorQuickOpen : public ConfirmationDialog {
- GDCLASS(EditorQuickOpen, ConfirmationDialog)
+ GDCLASS(EditorQuickOpen, ConfirmationDialog);
LineEdit *search_box;
Tree *search_options;
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index e8f5139cd5..a15ae2efda 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -269,7 +269,7 @@ void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base)
bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) {
int childCount = p_desired_node->get_child_count();
- if (p_desired_node->get_filename() == p_target_scene_path) {
+ if (_track_inherit(p_target_scene_path, p_desired_node)) {
return true;
}
@@ -284,6 +284,33 @@ bool SceneTreeDock::_cyclical_dependency_exists(const String &p_target_scene_pat
return false;
}
+bool SceneTreeDock::_track_inherit(const String &p_target_scene_path, Node *p_desired_node) {
+ Node *p = p_desired_node;
+ bool result = false;
+ Vector<Node *> instances;
+ while (true) {
+ if (p->get_filename() == p_target_scene_path) {
+ result = true;
+ break;
+ }
+ Ref<SceneState> ss = p->get_scene_inherited_state();
+ if (ss.is_valid()) {
+ String path = ss->get_path();
+ Ref<PackedScene> data = ResourceLoader::load(path);
+ if (data.is_valid()) {
+ p = data->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
+ instances.push_back(p);
+ } else
+ break;
+ } else
+ break;
+ }
+ for (int i = 0; i < instances.size(); i++) {
+ memdelete(instances[i]);
+ }
+ return result;
+}
+
void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
current_option = p_tool;
diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h
index 9f9e93f2df..b645c22295 100644
--- a/editor/scene_tree_dock.h
+++ b/editor/scene_tree_dock.h
@@ -165,6 +165,7 @@ class SceneTreeDock : public VBoxContainer {
void _script_open_request(const Ref<Script> &p_script);
bool _cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node);
+ bool _track_inherit(const String &p_target_scene_path, Node *p_desired_node);
void _node_selected();
void _node_renamed();
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 3b086c6316..00c8ed6ad3 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -305,49 +305,51 @@ void ScriptEditorDebugger::_scene_tree_rmb_selected(const Vector2 &p_position) {
}
void ScriptEditorDebugger::_file_selected(const String &p_file) {
- if (file_dialog_mode == SAVE_NODE) {
-
- Array msg;
- msg.push_back("save_node");
- msg.push_back(inspected_object_id);
- msg.push_back(p_file);
- ppeer->put_var(msg);
- } else if (file_dialog_mode == SAVE_CSV) {
+ switch (file_dialog_mode) {
+ case SAVE_NODE: {
+ Array msg;
+ msg.push_back("save_node");
+ msg.push_back(inspected_object_id);
+ msg.push_back(p_file);
+ ppeer->put_var(msg);
+ } break;
+ case SAVE_CSV: {
+ Error err;
+ FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
- Error err;
- FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
+ if (err != OK) {
+ ERR_PRINTS("Failed to open " + p_file);
+ return;
+ }
+ Vector<String> line;
+ line.resize(Performance::MONITOR_MAX);
- if (err != OK) {
- ERR_PRINTS("Failed to open " + p_file);
- return;
- }
- Vector<String> line;
- line.resize(Performance::MONITOR_MAX);
+ // signatures
+ for (int i = 0; i < Performance::MONITOR_MAX; i++) {
+ line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
+ }
+ file->store_csv_line(line);
- // signatures
- for (int i = 0; i < Performance::MONITOR_MAX; i++) {
- line.write[i] = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i));
- }
- file->store_csv_line(line);
+ // values
+ List<Vector<float> >::Element *E = perf_history.back();
+ while (E) {
- // values
- List<Vector<float> >::Element *E = perf_history.back();
- while (E) {
+ Vector<float> &perf_data = E->get();
+ for (int i = 0; i < perf_data.size(); i++) {
- Vector<float> &perf_data = E->get();
- for (int i = 0; i < perf_data.size(); i++) {
+ line.write[i] = String::num_real(perf_data[i]);
+ }
+ file->store_csv_line(line);
+ E = E->prev();
+ }
+ file->store_string("\n");
- line.write[i] = String::num_real(perf_data[i]);
+ Vector<Vector<String> > profiler_data = profiler->get_data_as_csv();
+ for (int i = 0; i < profiler_data.size(); i++) {
+ file->store_csv_line(profiler_data[i]);
}
- file->store_csv_line(line);
- E = E->prev();
- }
- file->store_string("\n");
- Vector<Vector<String> > profiler_data = profiler->get_data_as_csv();
- for (int i = 0; i < profiler_data.size(); i++) {
- file->store_csv_line(profiler_data[i]);
- }
+ } break;
}
}
@@ -1121,10 +1123,13 @@ void ScriptEditorDebugger::_notification(int p_what) {
last_warning_count = warning_count;
}
- if (connection.is_null()) {
-
- if (server->is_connection_available()) {
-
+ if (server->is_connection_available()) {
+ if (connection.is_valid()) {
+ // We already have a valid connection. Disconnecting any new connecting client to prevent it from hanging.
+ // (If we don't keep a reference to the connection it will be destroyed and disconnect_from_host will be called internally)
+ server->take_connection();
+ } else {
+ // We just got the first connection.
connection = server->take_connection();
if (connection.is_null())
break;
@@ -1158,12 +1163,11 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (profiler->is_profiling()) {
_profiler_activate(true);
}
-
- } else {
-
- break;
}
- };
+ }
+
+ if (connection.is_null())
+ break;
if (!connection->is_connected_to_host()) {
stop();
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 67cbcf5de4..c4b8999401 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -1835,12 +1835,12 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
JointSpatialGizmoPlugin::CreateConeTwistJointGizmo(
physical_bone->get_joint_offset(),
physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
- pb ? pb->get_global_transform() : Transform(),
- pbp ? pbp->get_global_transform() : Transform(),
+ pb->get_global_transform(),
+ pbp->get_global_transform(),
cjd->swing_span,
cjd->twist_span,
- pb ? &points : NULL,
- pbp ? &points : NULL);
+ &points,
+ &points);
} break;
case PhysicalBone::JOINT_TYPE_HINGE: {
@@ -1848,14 +1848,14 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
JointSpatialGizmoPlugin::CreateHingeJointGizmo(
physical_bone->get_joint_offset(),
physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
- pb ? pb->get_global_transform() : Transform(),
- pbp ? pbp->get_global_transform() : Transform(),
+ pb->get_global_transform(),
+ pbp->get_global_transform(),
hjd->angular_limit_lower,
hjd->angular_limit_upper,
hjd->angular_limit_enabled,
points,
- pb ? &points : NULL,
- pbp ? &points : NULL);
+ &points,
+ &points);
} break;
case PhysicalBone::JOINT_TYPE_SLIDER: {
@@ -1863,15 +1863,15 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
JointSpatialGizmoPlugin::CreateSliderJointGizmo(
physical_bone->get_joint_offset(),
physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
- pb ? pb->get_global_transform() : Transform(),
- pbp ? pbp->get_global_transform() : Transform(),
+ pb->get_global_transform(),
+ pbp->get_global_transform(),
sjd->angular_limit_lower,
sjd->angular_limit_upper,
sjd->linear_limit_lower,
sjd->linear_limit_upper,
points,
- pb ? &points : NULL,
- pbp ? &points : NULL);
+ &points,
+ &points);
} break;
case PhysicalBone::JOINT_TYPE_6DOF: {
@@ -1880,8 +1880,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
physical_bone->get_joint_offset(),
physical_bone->get_global_transform() * physical_bone->get_joint_offset(),
- pb ? pb->get_global_transform() : Transform(),
- pbp ? pbp->get_global_transform() : Transform(),
+ pb->get_global_transform(),
+ pbp->get_global_transform(),
sdofjd->axis_data[0].angular_limit_lower,
sdofjd->axis_data[0].angular_limit_upper,
@@ -1905,8 +1905,8 @@ void PhysicalBoneSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
sdofjd->axis_data[2].linear_limit_enabled,
points,
- pb ? &points : NULL,
- pbp ? &points : NULL);
+ &points,
+ &points);
} break;
default:
return;
diff --git a/main/main.cpp b/main/main.cpp
index 61f54b1b0a..c765ff9700 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1104,6 +1104,8 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
return err;
}
+ print_line(" "); //add a blank line for readability
+
if (init_use_custom_pos) {
OS::get_singleton()->set_window_position(init_custom_pos);
}
@@ -1795,6 +1797,7 @@ bool Main::start() {
pmanager->add_child(progress_dialog);
sml->get_root()->add_child(pmanager);
OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN);
+ project_manager = true;
}
if (project_manager || editor) {
@@ -1804,6 +1807,10 @@ bool Main::start() {
StreamPeerSSL::load_certs_from_file(certs);
else
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
+
+ // Hide console window if requested (Windows-only)
+ bool hide_console = EditorSettings::get_singleton()->get_setting("interface/editor/hide_console_window");
+ OS::get_singleton()->set_console_visible(!hide_console);
}
#endif
}
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index 531887a452..a107fd738f 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -1017,8 +1017,8 @@ bool test_32() {
STRIP_TEST(String("abca").lstrip("a") == "bca");
STRIP_TEST(String("abc").rstrip("a") == "abc");
STRIP_TEST(String("abca").rstrip("a") == "abc");
- // in utf-8 "¿" has the same first byte as "µ"
- // and the same second as "ÿ"
+ // in utf-8 "¿" (\u00bf) has the same first byte as "µ" (\u00b5)
+ // and the same second as "ÿ" (\u00ff)
STRIP_TEST(String::utf8("¿").lstrip(String::utf8("µÿ")) == String::utf8("¿"));
STRIP_TEST(String::utf8("¿").rstrip(String::utf8("µÿ")) == String::utf8("¿"));
STRIP_TEST(String::utf8("µ¿ÿ").lstrip(String::utf8("µÿ")) == String::utf8("¿ÿ"));
@@ -1046,8 +1046,8 @@ bool test_32() {
STRIP_TEST(String("abca").lstrip("qwajkl") == "bca");
STRIP_TEST(String("abc").rstrip("qwajkl") == "abc");
STRIP_TEST(String("abca").rstrip("qwajkl") == "abc");
- // in utf-8 "¿" has the same first byte as "µ"
- // and the same second as "ÿ"
+ // in utf-8 "¿" (\u00bf) has the same first byte as "µ" (\u00b5)
+ // and the same second as "ÿ" (\u00ff)
STRIP_TEST(String::utf8("¿").lstrip(String::utf8("qwaµÿjkl")) == String::utf8("¿"));
STRIP_TEST(String::utf8("¿").rstrip(String::utf8("qwaµÿjkl")) == String::utf8("¿"));
STRIP_TEST(String::utf8("µ¿ÿ").lstrip(String::utf8("qwaµÿjkl")) == String::utf8("¿ÿ"));
@@ -1068,8 +1068,8 @@ bool test_33() {
bool test_34() {
OS::get_singleton()->print("\n\nTest 34: Cyrillic to_lower()\n");
- String upper = L"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ";
- String lower = L"абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
+ String upper = String::utf8("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ");
+ String lower = String::utf8("абвгдеёжзийклмнопрстуфхцчшщъыьэюя");
String test = upper.to_lower();
diff --git a/misc/ide/jetbrains/build.gradle b/misc/ide/jetbrains/build.gradle
index ffcd12cd15..eb2fbc0e69 100644
--- a/misc/ide/jetbrains/build.gradle
+++ b/misc/ide/jetbrains/build.gradle
@@ -23,7 +23,7 @@ dependencies {
def pathToRootDir = "../../../"
// Note: Only keep the abis you support to speed up the gradle 'assemble' task.
-def supportedAbis = ["armv6", "armv7", "arm64v8", "x86", "x86_64"]
+def supportedAbis = ["armv7", "arm64v8", "x86", "x86_64"]
android {
diff --git a/modules/bmp/image_loader_bmp.cpp b/modules/bmp/image_loader_bmp.cpp
index bcc992db24..b4530c2df1 100644
--- a/modules/bmp/image_loader_bmp.cpp
+++ b/modules/bmp/image_loader_bmp.cpp
@@ -261,12 +261,10 @@ Error ImageLoaderBMP::load_image(Ref<Image> p_image, FileAccess *f,
ERR_FAIL_COND_V(color_table_size == 0, ERR_BUG);
PoolVector<uint8_t> bmp_color_table;
- if (color_table_size > 0) {
- // Color table is usually 4 bytes per color -> [B][G][R][0]
- err = bmp_color_table.resize(color_table_size * 4);
- PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write();
- f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4);
- }
+ // Color table is usually 4 bytes per color -> [B][G][R][0]
+ err = bmp_color_table.resize(color_table_size * 4);
+ PoolVector<uint8_t>::Write bmp_color_table_w = bmp_color_table.write();
+ f->get_buffer(bmp_color_table_w.ptr(), color_table_size * 4);
f->seek(bmp_header.bmp_file_header.bmp_file_offset);
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index 0b8ad53658..4c598c84f2 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -45,7 +45,7 @@
*/
class BulletPhysicsServer : public PhysicsServer {
- GDCLASS(BulletPhysicsServer, PhysicsServer)
+ GDCLASS(BulletPhysicsServer, PhysicsServer);
friend class BulletPhysicsDirectSpaceState;
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index 1e1bea846a..2c9bdb8b0b 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -54,7 +54,7 @@ class BulletPhysicsDirectBodyState;
/// created by BulletPhysicsServer and is held by the "singleton" variable of this class
/// Each time something require it, the body must be set again.
class BulletPhysicsDirectBodyState : public PhysicsDirectBodyState {
- GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState)
+ GDCLASS(BulletPhysicsDirectBodyState, PhysicsDirectBodyState);
static BulletPhysicsDirectBodyState *singleton;
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index 6b3d65edf6..eb4a065e54 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -68,7 +68,8 @@ class btGjkEpaPenetrationDepthSolver;
extern ContactAddedCallback gContactAddedCallback;
class BulletPhysicsDirectSpaceState : public PhysicsDirectSpaceState {
- GDCLASS(BulletPhysicsDirectSpaceState, PhysicsDirectSpaceState)
+ GDCLASS(BulletPhysicsDirectSpaceState, PhysicsDirectSpaceState);
+
private:
SpaceBullet *space;
diff --git a/modules/csg/csg.cpp b/modules/csg/csg.cpp
index aa4d7d7d32..fd0d36eddf 100644
--- a/modules/csg/csg.cpp
+++ b/modules/csg/csg.cpp
@@ -1018,15 +1018,15 @@ int CSGBrushOperation::MeshMerge::_create_bvh(BVH *p_bvh, BVH **p_bb, int p_from
max_depth = p_depth;
}
- if (p_size <= BVH_LIMIT) {
+ if (p_size == 0) {
+
+ return -1;
+ } else if (p_size <= BVH_LIMIT) {
for (int i = 0; i < p_size - 1; i++) {
p_bb[p_from + i]->next = p_bb[p_from + i + 1] - p_bvh;
}
return p_bb[p_from] - p_bvh;
- } else if (p_size == 0) {
-
- return -1;
}
AABB aabb;
diff --git a/modules/csg/csg_gizmos.h b/modules/csg/csg_gizmos.h
index 0915d05111..d38dafc936 100644
--- a/modules/csg/csg_gizmos.h
+++ b/modules/csg/csg_gizmos.h
@@ -55,7 +55,8 @@ public:
};
class EditorPluginCSG : public EditorPlugin {
- GDCLASS(EditorPluginCSG, EditorPlugin)
+ GDCLASS(EditorPluginCSG, EditorPlugin);
+
public:
EditorPluginCSG(EditorNode *p_editor);
};
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 1d27b9b6f4..a496a214fd 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -1816,11 +1816,9 @@ CSGBrush *CSGPolygon::_build_brush() {
path_cache = path;
- if (path_cache) {
- path_cache->connect("tree_exited", this, "_path_exited");
- path_cache->connect("curve_changed", this, "_path_changed");
- path_cache = NULL;
- }
+ path_cache->connect("tree_exited", this, "_path_exited");
+ path_cache->connect("curve_changed", this, "_path_changed");
+ path_cache = NULL;
}
curve = path->get_curve();
if (curve.is_null())
diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h
index 2171f27f96..553a7553c6 100644
--- a/modules/csg/csg_shape.h
+++ b/modules/csg/csg_shape.h
@@ -156,7 +156,8 @@ public:
VARIANT_ENUM_CAST(CSGShape::Operation)
class CSGCombiner : public CSGShape {
- GDCLASS(CSGCombiner, CSGShape)
+ GDCLASS(CSGCombiner, CSGShape);
+
private:
virtual CSGBrush *_build_brush();
@@ -165,7 +166,7 @@ public:
};
class CSGPrimitive : public CSGShape {
- GDCLASS(CSGPrimitive, CSGShape)
+ GDCLASS(CSGPrimitive, CSGShape);
private:
bool invert_faces;
@@ -182,7 +183,7 @@ public:
};
class CSGMesh : public CSGPrimitive {
- GDCLASS(CSGMesh, CSGPrimitive)
+ GDCLASS(CSGMesh, CSGPrimitive);
virtual CSGBrush *_build_brush();
@@ -204,7 +205,7 @@ public:
class CSGSphere : public CSGPrimitive {
- GDCLASS(CSGSphere, CSGPrimitive)
+ GDCLASS(CSGSphere, CSGPrimitive);
virtual CSGBrush *_build_brush();
Ref<Material> material;
@@ -237,7 +238,7 @@ public:
class CSGBox : public CSGPrimitive {
- GDCLASS(CSGBox, CSGPrimitive)
+ GDCLASS(CSGBox, CSGPrimitive);
virtual CSGBrush *_build_brush();
Ref<Material> material;
@@ -266,7 +267,7 @@ public:
class CSGCylinder : public CSGPrimitive {
- GDCLASS(CSGCylinder, CSGPrimitive)
+ GDCLASS(CSGCylinder, CSGPrimitive);
virtual CSGBrush *_build_brush();
Ref<Material> material;
@@ -303,7 +304,7 @@ public:
class CSGTorus : public CSGPrimitive {
- GDCLASS(CSGTorus, CSGPrimitive)
+ GDCLASS(CSGTorus, CSGPrimitive);
virtual CSGBrush *_build_brush();
Ref<Material> material;
@@ -340,7 +341,7 @@ public:
class CSGPolygon : public CSGPrimitive {
- GDCLASS(CSGPolygon, CSGPrimitive)
+ GDCLASS(CSGPolygon, CSGPrimitive);
public:
enum Mode {
diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp
index 0a70ff535f..024e9ffc3b 100644
--- a/modules/cvtt/image_compress_cvtt.cpp
+++ b/modules/cvtt/image_compress_cvtt.cpp
@@ -145,7 +145,7 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressS
int h = p_image->get_height();
bool is_ldr = (p_image->get_format() <= Image::FORMAT_RGBA8);
- bool is_hdr = (p_image->get_format() == Image::FORMAT_RGBH);
+ bool is_hdr = (p_image->get_format() >= Image::FORMAT_RH) && (p_image->get_format() <= Image::FORMAT_RGBE9995);
if (!is_ldr && !is_hdr) {
return; // Not a usable source format
@@ -175,6 +175,10 @@ void image_compress_cvtt(Image *p_image, float p_lossy_quality, Image::CompressS
bool is_signed = false;
if (is_hdr) {
+ if (p_image->get_format() != Image::FORMAT_RGBH) {
+ p_image->convert(Image::FORMAT_RGBH);
+ }
+
PoolVector<uint8_t>::Read rb = p_image->get_data().read();
const uint16_t *source_data = reinterpret_cast<const uint16_t *>(&rb[0]);
diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h
index 585f2891bf..6ddef4e770 100644
--- a/modules/dds/texture_loader_dds.h
+++ b/modules/dds/texture_loader_dds.h
@@ -35,7 +35,6 @@
#include "scene/resources/texture.h"
class ResourceFormatDDS : public ResourceFormatLoader {
- GDCLASS(ResourceFormatDDS, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h
index 957d0830cb..8dcb202314 100644
--- a/modules/enet/networked_multiplayer_enet.h
+++ b/modules/enet/networked_multiplayer_enet.h
@@ -38,7 +38,8 @@
class NetworkedMultiplayerENet : public NetworkedMultiplayerPeer {
- GDCLASS(NetworkedMultiplayerENet, NetworkedMultiplayerPeer)
+ GDCLASS(NetworkedMultiplayerENet, NetworkedMultiplayerPeer);
+
public:
enum CompressionMode {
COMPRESS_NONE,
diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h
index 860fe8b5df..79c17953fc 100644
--- a/modules/etc/texture_loader_pkm.h
+++ b/modules/etc/texture_loader_pkm.h
@@ -35,7 +35,6 @@
#include "scene/resources/texture.h"
class ResourceFormatPKM : public ResourceFormatLoader {
- GDCLASS(ResourceFormatPKM, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/gdnative/arvr/arvr_interface_gdnative.h b/modules/gdnative/arvr/arvr_interface_gdnative.h
index e0e5b67849..651e5c8715 100644
--- a/modules/gdnative/arvr/arvr_interface_gdnative.h
+++ b/modules/gdnative/arvr/arvr_interface_gdnative.h
@@ -41,7 +41,7 @@
*/
class ARVRInterfaceGDNative : public ARVRInterface {
- GDCLASS(ARVRInterfaceGDNative, ARVRInterface)
+ GDCLASS(ARVRInterfaceGDNative, ARVRInterface);
void cleanup();
diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py
index 7898de5523..b9e5afcdf3 100644
--- a/modules/gdnative/config.py
+++ b/modules/gdnative/config.py
@@ -6,6 +6,7 @@ def configure(env):
def get_doc_classes():
return [
+ "@NativeScript",
"ARVRInterfaceGDNative",
"GDNative",
"GDNativeLibrary",
@@ -13,7 +14,6 @@ def get_doc_classes():
"NativeScript",
"PacketPeerGDNative",
"PluginScript",
- "ResourceFormatLoaderVideoStreamGDNative",
"StreamPeerGDNative",
"VideoStreamGDNative",
"WebRTCPeerConnectionGDNative",
diff --git a/doc/classes/@NativeScript.xml b/modules/gdnative/doc_classes/@NativeScript.xml
index cb5de198ac..cb5de198ac 100644
--- a/doc/classes/@NativeScript.xml
+++ b/modules/gdnative/doc_classes/@NativeScript.xml
diff --git a/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml b/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml
deleted file mode 100644
index cd8b336778..0000000000
--- a/modules/gdnative/doc_classes/ResourceFormatLoaderVideoStreamGDNative.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceFormatLoaderVideoStreamGDNative" inherits="ResourceFormatLoader" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index ef57387059..005d1d2bff 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -45,7 +45,7 @@ class GDNativeLibraryResourceLoader;
class GDNative;
class GDNativeLibrary : public Resource {
- GDCLASS(GDNativeLibrary, Resource)
+ GDCLASS(GDNativeLibrary, Resource);
static Map<String, Vector<Ref<GDNative> > > *loaded_libraries;
@@ -137,7 +137,7 @@ struct GDNativeCallRegistry {
};
class GDNative : public Reference {
- GDCLASS(GDNative, Reference)
+ GDCLASS(GDNative, Reference);
Ref<GDNativeLibrary> library;
@@ -165,7 +165,6 @@ public:
};
class GDNativeLibraryResourceLoader : public ResourceFormatLoader {
- GDCLASS(GDNativeLibraryResourceLoader, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path, Error *r_error);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -174,7 +173,6 @@ public:
};
class GDNativeLibraryResourceSaver : public ResourceFormatSaver {
- GDCLASS(GDNativeLibraryResourceSaver, ResourceFormatSaver)
public:
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags);
virtual bool recognize(const RES &p_resource) const;
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index be1c499714..79a41df107 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -99,7 +99,7 @@ struct NativeScriptDesc {
};
class NativeScript : public Script {
- GDCLASS(NativeScript, Script)
+ GDCLASS(NativeScript, Script);
#ifdef TOOLS_ENABLED
Set<PlaceHolderScriptInstance *> placeholders;
@@ -370,7 +370,7 @@ inline NativeScriptDesc *NativeScript::get_script_desc() const {
}
class NativeReloadNode : public Node {
- GDCLASS(NativeReloadNode, Node)
+ GDCLASS(NativeReloadNode, Node);
bool unloaded;
public:
@@ -382,7 +382,6 @@ public:
};
class ResourceFormatLoaderNativeScript : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderNativeScript, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -391,7 +390,6 @@ public:
};
class ResourceFormatSaverNativeScript : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverNativeScript, ResourceFormatSaver)
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual bool recognize(const RES &p_resource) const;
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.h b/modules/gdnative/net/multiplayer_peer_gdnative.h
index 7d48dc60d1..6fbc62aaa1 100644
--- a/modules/gdnative/net/multiplayer_peer_gdnative.h
+++ b/modules/gdnative/net/multiplayer_peer_gdnative.h
@@ -36,7 +36,7 @@
#include "modules/gdnative/include/net/godot_net.h"
class MultiplayerPeerGDNative : public NetworkedMultiplayerPeer {
- GDCLASS(MultiplayerPeerGDNative, NetworkedMultiplayerPeer)
+ GDCLASS(MultiplayerPeerGDNative, NetworkedMultiplayerPeer);
protected:
static void _bind_methods();
diff --git a/modules/gdnative/net/packet_peer_gdnative.h b/modules/gdnative/net/packet_peer_gdnative.h
index 742fa4e7d5..8483217210 100644
--- a/modules/gdnative/net/packet_peer_gdnative.h
+++ b/modules/gdnative/net/packet_peer_gdnative.h
@@ -36,7 +36,7 @@
#include "modules/gdnative/include/net/godot_net.h"
class PacketPeerGDNative : public PacketPeer {
- GDCLASS(PacketPeerGDNative, PacketPeer)
+ GDCLASS(PacketPeerGDNative, PacketPeer);
protected:
static void _bind_methods();
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h
index 69a2ac6bfe..6218037a15 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.h
+++ b/modules/gdnative/pluginscript/pluginscript_loader.h
@@ -40,8 +40,6 @@ class PluginScriptLanguage;
class ResourceFormatLoaderPluginScript : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderPluginScript, ResourceFormatLoader)
-
PluginScriptLanguage *_language;
public:
@@ -54,8 +52,6 @@ public:
class ResourceFormatSaverPluginScript : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverPluginScript, ResourceFormatSaver)
-
PluginScriptLanguage *_language;
public:
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h
index aafd02f33d..b9f1c8e4da 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.h
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.h
@@ -197,7 +197,6 @@ public:
};
class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderVideoStreamGDNative, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/gdscript/config.py b/modules/gdscript/config.py
index 95b40d90af..a525eedaaa 100644
--- a/modules/gdscript/config.py
+++ b/modules/gdscript/config.py
@@ -6,6 +6,7 @@ def configure(env):
def get_doc_classes():
return [
+ "@GDScript",
"GDScript",
"GDScriptFunctionState",
"GDScriptNativeClass",
diff --git a/doc/classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index b6de5dbf62..b6de5dbf62 100644
--- a/doc/classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
diff --git a/modules/gdscript/gdscript.h b/modules/gdscript/gdscript.h
index 40b773d99f..1756f6eabc 100644
--- a/modules/gdscript/gdscript.h
+++ b/modules/gdscript/gdscript.h
@@ -509,7 +509,6 @@ public:
};
class ResourceFormatLoaderGDScript : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderGDScript, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -519,7 +518,6 @@ public:
};
class ResourceFormatSaverGDScript : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverGDScript, ResourceFormatSaver)
public:
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp
index cff9ba55b8..bae5eca218 100644
--- a/modules/gdscript/gdscript_function.cpp
+++ b/modules/gdscript/gdscript_function.cpp
@@ -133,35 +133,13 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
return NULL;
}
-String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const {
-
- String err_text;
-
- if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
- int errorarg = p_err.argument;
- err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(p_err.expected) + ".";
- } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
- err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments.";
- } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
- err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments.";
- } else if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) {
- err_text = "Invalid call. Nonexistent " + p_where + ".";
- } else if (p_err.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
- err_text = "Attempt to call " + p_where + " on a null instance.";
- } else {
- err_text = "Bug, call error: #" + itos(p_err.error);
- }
-
- return err_text;
-}
-
#ifdef DEBUG_ENABLED
-static String _get_var_type(const Variant *p_type) {
+static String _get_var_type(const Variant *p_var) {
String basestr;
- if (p_type->get_type() == Variant::OBJECT) {
- Object *bobj = *p_type;
+ if (p_var->get_type() == Variant::OBJECT) {
+ Object *bobj = *p_var;
if (!bobj) {
basestr = "null instance";
} else {
@@ -176,12 +154,42 @@ static String _get_var_type(const Variant *p_type) {
}
} else {
- basestr = Variant::get_type_name(p_type->get_type());
+ basestr = Variant::get_type_name(p_var->get_type());
}
return basestr;
}
-#endif
+#endif // DEBUG_ENABLED
+
+String GDScriptFunction::_get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const {
+
+ String err_text;
+
+ if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
+ int errorarg = p_err.argument;
+ // Handle the Object to Object case separately as we don't have further class details.
+#ifdef DEBUG_ENABLED
+ if (p_err.expected == Variant::OBJECT && argptrs[errorarg]->get_type() == p_err.expected) {
+ err_text = "Invalid type in " + p_where + ". The Object-derived class of argument " + itos(errorarg + 1) + " (" + _get_var_type(argptrs[errorarg]) + ") is not a subclass of the expected argument class.";
+ } else
+#endif // DEBUG_ENABLED
+ {
+ err_text = "Invalid type in " + p_where + ". Cannot convert argument " + itos(errorarg + 1) + " from " + Variant::get_type_name(argptrs[errorarg]->get_type()) + " to " + Variant::get_type_name(p_err.expected) + ".";
+ }
+ } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_MANY_ARGUMENTS) {
+ err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments.";
+ } else if (p_err.error == Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS) {
+ err_text = "Invalid call to " + p_where + ". Expected " + itos(p_err.argument) + " arguments.";
+ } else if (p_err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) {
+ err_text = "Invalid call. Nonexistent " + p_where + ".";
+ } else if (p_err.error == Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL) {
+ err_text = "Attempt to call " + p_where + " on a null instance.";
+ } else {
+ err_text = "Bug, call error: #" + itos(p_err.error);
+ }
+
+ return err_text;
+}
#if defined(__GNUC__)
#define OPCODES_TABLE \
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 3caa7b1d12..994a84fbc4 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -241,6 +241,7 @@ Vector3 GridMap::get_cell_size() const {
void GridMap::set_octant_size(int p_size) {
+ ERR_FAIL_COND(p_size == 0);
octant_size = p_size;
_recreate_octant_data();
}
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index 890bd730f7..6b9a97efb4 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -664,8 +664,10 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu
}
if (mb->is_pressed()) {
-
- if (mb->get_button_index() == BUTTON_LEFT) {
+ SpatialEditorViewport::NavigationScheme nav_scheme = (SpatialEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
+ if ((nav_scheme == SpatialEditorViewport::NAVIGATION_MAYA || nav_scheme == SpatialEditorViewport::NAVIGATION_MODO) && mb->get_alt()) {
+ input_action = INPUT_NONE;
+ } else if (mb->get_button_index() == BUTTON_LEFT) {
if (input_action == INPUT_PASTE) {
_do_paste();
diff --git a/modules/mbedtls/stream_peer_mbed_tls.cpp b/modules/mbedtls/stream_peer_mbed_tls.cpp
index 45d3b86919..3541eff25a 100755
--- a/modules/mbedtls/stream_peer_mbed_tls.cpp
+++ b/modules/mbedtls/stream_peer_mbed_tls.cpp
@@ -122,6 +122,8 @@ Error StreamPeerMbedTLS::_do_handshake() {
Error StreamPeerMbedTLS::connect_to_stream(Ref<StreamPeer> p_base, bool p_validate_certs, const String &p_for_hostname) {
+ ERR_FAIL_COND_V(p_base.is_null(), ERR_INVALID_PARAMETER);
+
base = p_base;
int ret = 0;
int authmode = p_validate_certs ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE;
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index 4a1fb8e5ed..64e3b40063 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -63,7 +63,7 @@ TScriptInstance *cast_script_instance(ScriptInstance *p_inst) {
class CSharpScript : public Script {
- GDCLASS(CSharpScript, Script)
+ GDCLASS(CSharpScript, Script);
friend class CSharpInstance;
friend class CSharpLanguage;
@@ -440,7 +440,6 @@ public:
};
class ResourceFormatLoaderCSharpScript : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderCSharpScript, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -449,7 +448,6 @@ public:
};
class ResourceFormatSaverCSharpScript : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverCSharpScript, ResourceFormatSaver)
public:
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
diff --git a/modules/mono/editor/godotsharp_editor.h b/modules/mono/editor/godotsharp_editor.h
index d9523c384c..4a28492bad 100644
--- a/modules/mono/editor/godotsharp_editor.h
+++ b/modules/mono/editor/godotsharp_editor.h
@@ -35,7 +35,7 @@
#include "monodevelop_instance.h"
class GodotSharpEditor : public Node {
- GDCLASS(GodotSharpEditor, Object)
+ GDCLASS(GodotSharpEditor, Object);
EditorNode *editor;
@@ -109,7 +109,7 @@ public:
};
class MonoReloadNode : public Node {
- GDCLASS(MonoReloadNode, Node)
+ GDCLASS(MonoReloadNode, Node);
Timer *reload_timer;
diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h
index 406e46f7ce..9b362e51df 100644
--- a/modules/mono/editor/mono_bottom_panel.h
+++ b/modules/mono/editor/mono_bottom_panel.h
@@ -40,7 +40,7 @@ class MonoBuildTab;
class MonoBottomPanel : public VBoxContainer {
- GDCLASS(MonoBottomPanel, VBoxContainer)
+ GDCLASS(MonoBottomPanel, VBoxContainer);
EditorNode *editor;
@@ -87,7 +87,7 @@ public:
class MonoBuildTab : public VBoxContainer {
- GDCLASS(MonoBuildTab, VBoxContainer)
+ GDCLASS(MonoBuildTab, VBoxContainer);
public:
enum BuildResult {
diff --git a/modules/mono/mono_gc_handle.h b/modules/mono/mono_gc_handle.h
index 63b61aff18..60a1eed212 100644
--- a/modules/mono/mono_gc_handle.h
+++ b/modules/mono/mono_gc_handle.h
@@ -37,7 +37,7 @@
class MonoGCHandle : public Reference {
- GDCLASS(MonoGCHandle, Reference)
+ GDCLASS(MonoGCHandle, Reference);
bool released;
bool weak;
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
index 216c96a612..95340edcca 100644
--- a/modules/mono/mono_gd/gd_mono.h
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -267,7 +267,7 @@ public:
(void)__gdmono__scope__exit__domain__unload__;
class _GodotSharp : public Object {
- GDCLASS(_GodotSharp, Object)
+ GDCLASS(_GodotSharp, Object);
friend class GDMono;
diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h
index 098008ded7..4fb3cdb56d 100644
--- a/modules/mono/signal_awaiter_utils.h
+++ b/modules/mono/signal_awaiter_utils.h
@@ -41,7 +41,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p
class SignalAwaiterHandle : public MonoGCHandle {
- GDCLASS(SignalAwaiterHandle, MonoGCHandle)
+ GDCLASS(SignalAwaiterHandle, MonoGCHandle);
bool completed;
diff --git a/modules/opensimplex/doc_classes/OpenSimplexNoise.xml b/modules/opensimplex/doc_classes/OpenSimplexNoise.xml
index dc7fc7fe31..894a1b3ced 100644
--- a/modules/opensimplex/doc_classes/OpenSimplexNoise.xml
+++ b/modules/opensimplex/doc_classes/OpenSimplexNoise.xml
@@ -41,6 +41,8 @@
<argument index="0" name="x" type="float">
</argument>
<description>
+ Returns the 1D noise value [code][-1,1][/code] at the given x-coordinate.
+ Note: This method actually returns the 2D noise value [code][-1,1][/code] with fixed y-coordinate value 0.0.
</description>
</method>
<method name="get_noise_2d">
diff --git a/modules/opensimplex/noise_texture.h b/modules/opensimplex/noise_texture.h
index 0d00ee154d..445bf974b8 100644
--- a/modules/opensimplex/noise_texture.h
+++ b/modules/opensimplex/noise_texture.h
@@ -40,7 +40,7 @@
#include "editor/property_editor.h"
class NoiseTexture : public Texture {
- GDCLASS(NoiseTexture, Texture)
+ GDCLASS(NoiseTexture, Texture);
private:
Ref<Image> data;
diff --git a/modules/opensimplex/open_simplex_noise.h b/modules/opensimplex/open_simplex_noise.h
index 96885f5893..c31cbf68c3 100644
--- a/modules/opensimplex/open_simplex_noise.h
+++ b/modules/opensimplex/open_simplex_noise.h
@@ -38,7 +38,7 @@
#include "thirdparty/misc/open-simplex-noise.h"
class OpenSimplexNoise : public Resource {
- GDCLASS(OpenSimplexNoise, Resource)
+ GDCLASS(OpenSimplexNoise, Resource);
OBJ_SAVE_TYPE(OpenSimplexNoise);
osn_context contexts[6];
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index f3c981dd45..a4a431bab7 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -221,7 +221,7 @@ if env['builtin_opus']:
env_opus.Prepend(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
if env["platform"] == "android":
- if ("android_arch" in env and env["android_arch"] in ["armv6", "armv7"]):
+ if ("android_arch" in env and env["android_arch"] == "armv7"):
env_opus.Append(CPPFLAGS=["-DOPUS_ARM_OPT"])
elif ("android_arch" in env and env["android_arch"] == "arm64v8"):
env_opus.Append(CPPFLAGS=["-DOPUS_ARM64_OPT"])
diff --git a/modules/opus/audio_stream_opus.h b/modules/opus/audio_stream_opus.h
index f53bff0288..04c2e9d9f0 100644
--- a/modules/opus/audio_stream_opus.h
+++ b/modules/opus/audio_stream_opus.h
@@ -43,7 +43,7 @@
class AudioStreamPlaybackOpus : public AudioStreamPlayback {
- GDCLASS(AudioStreamPlaybackOpus, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackOpus, AudioStreamPlayback);
enum {
MIN_MIX = 1024
@@ -117,7 +117,7 @@ public:
class AudioStreamOpus : public AudioStream {
- GDCLASS(AudioStreamOpus, AudioStream)
+ GDCLASS(AudioStreamOpus, AudioStream);
String file;
@@ -132,7 +132,6 @@ public:
};
class ResourceFormatLoaderAudioStreamOpus : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderAudioStreamOpus, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/pvr/texture_loader_pvr.h b/modules/pvr/texture_loader_pvr.h
index 2808b4ff03..606268e447 100644
--- a/modules/pvr/texture_loader_pvr.h
+++ b/modules/pvr/texture_loader_pvr.h
@@ -35,7 +35,6 @@
#include "scene/resources/texture.h"
class ResourceFormatPVR : public ResourceFormatLoader {
- GDCLASS(ResourceFormatPVR, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index cbff9d47bb..c8c179554a 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -40,7 +40,7 @@ class AudioStreamOGGVorbis;
class AudioStreamPlaybackOGGVorbis : public AudioStreamPlaybackResampled {
- GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled)
+ GDCLASS(AudioStreamPlaybackOGGVorbis, AudioStreamPlaybackResampled);
stb_vorbis *ogg_stream;
stb_vorbis_alloc ogg_alloc;
@@ -72,7 +72,7 @@ public:
class AudioStreamOGGVorbis : public AudioStream {
- GDCLASS(AudioStreamOGGVorbis, AudioStream)
+ GDCLASS(AudioStreamOGGVorbis, AudioStream);
OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged
RES_BASE_EXTENSION("oggstr");
diff --git a/modules/stb_vorbis/config.py b/modules/stb_vorbis/config.py
index d75e41797a..200b8dfd50 100644
--- a/modules/stb_vorbis/config.py
+++ b/modules/stb_vorbis/config.py
@@ -7,7 +7,6 @@ def configure(env):
def get_doc_classes():
return [
"AudioStreamOGGVorbis",
- "ResourceImporterOGGVorbis",
]
def get_doc_path():
diff --git a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml b/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
deleted file mode 100644
index 4dd77fed34..0000000000
--- a/modules/stb_vorbis/doc_classes/ResourceImporterOGGVorbis.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<class name="ResourceImporterOGGVorbis" inherits="ResourceImporter" category="Core" version="3.2">
- <brief_description>
- </brief_description>
- <description>
- </description>
- <tutorials>
- </tutorials>
- <methods>
- </methods>
- <constants>
- </constants>
-</class>
diff --git a/modules/stb_vorbis/register_types.cpp b/modules/stb_vorbis/register_types.cpp
index 88a1766e47..ce64626e4b 100644
--- a/modules/stb_vorbis/register_types.cpp
+++ b/modules/stb_vorbis/register_types.cpp
@@ -29,15 +29,22 @@
/*************************************************************************/
#include "register_types.h"
+
#include "audio_stream_ogg_vorbis.h"
+
+#ifdef TOOLS_ENABLED
+#include "core/engine.h"
#include "resource_importer_ogg_vorbis.h"
+#endif
void register_stb_vorbis_types() {
#ifdef TOOLS_ENABLED
- Ref<ResourceImporterOGGVorbis> ogg_import;
- ogg_import.instance();
- ResourceFormatImporter::get_singleton()->add_importer(ogg_import);
+ if (Engine::get_singleton()->is_editor_hint()) {
+ Ref<ResourceImporterOGGVorbis> ogg_import;
+ ogg_import.instance();
+ ResourceFormatImporter::get_singleton()->add_importer(ogg_import);
+ }
#endif
ClassDB::register_class<AudioStreamOGGVorbis>();
}
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
index 7254f57672..e10f29e310 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp
@@ -82,9 +82,8 @@ Error ResourceImporterOGGVorbis::import(const String &p_source_file, const Strin
float loop_offset = p_options["loop_offset"];
FileAccess *f = FileAccess::open(p_source_file, FileAccess::READ);
- if (!f) {
- ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
- }
+
+ ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
size_t len = f->get_len();
diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.h b/modules/stb_vorbis/resource_importer_ogg_vorbis.h
index d3d0574d56..8e4fbde916 100644
--- a/modules/stb_vorbis/resource_importer_ogg_vorbis.h
+++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.h
@@ -35,7 +35,8 @@
#include "core/io/resource_importer.h"
class ResourceImporterOGGVorbis : public ResourceImporter {
- GDCLASS(ResourceImporterOGGVorbis, ResourceImporter)
+ GDCLASS(ResourceImporterOGGVorbis, ResourceImporter);
+
public:
virtual String get_importer_name() const;
virtual String get_visible_name() const;
diff --git a/modules/theora/config.py b/modules/theora/config.py
index 7504166237..c7713d7607 100644
--- a/modules/theora/config.py
+++ b/modules/theora/config.py
@@ -6,7 +6,6 @@ def configure(env):
def get_doc_classes():
return [
- "ResourceImporterTheora",
"VideoStreamTheora",
]
diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h
index 85d73d3c0d..0c37d33358 100644
--- a/modules/theora/video_stream_theora.h
+++ b/modules/theora/video_stream_theora.h
@@ -186,7 +186,6 @@ public:
};
class ResourceFormatLoaderTheora : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderTheora, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/visual_script/config.py b/modules/visual_script/config.py
index 07a0450734..04e1a40b81 100644
--- a/modules/visual_script/config.py
+++ b/modules/visual_script/config.py
@@ -6,6 +6,7 @@ def configure(env):
def get_doc_classes():
return [
+ "@VisualScript",
"VisualScriptBasicTypeConstant",
"VisualScriptBuiltinFunc",
"VisualScriptClassConstant",
diff --git a/doc/classes/@VisualScript.xml b/modules/visual_script/doc_classes/@VisualScript.xml
index 8d9408e6d4..8d9408e6d4 100644
--- a/doc/classes/@VisualScript.xml
+++ b/modules/visual_script/doc_classes/@VisualScript.xml
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 85fc867901..df5bb9ca2e 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1692,7 +1692,7 @@ Variant VisualScriptInstance::_call_internal(const StringName &p_method, void *p
if ((ret == output || ret & VisualScriptNodeInstance::STEP_FLAG_PUSH_STACK_BIT) && node->sequence_output_count) {
//if no exit bit was set, and has sequence outputs, guess next node
- if (output < 0 || output >= node->sequence_output_count) {
+ if (output >= node->sequence_output_count) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
error_str = RTR("Node returned an invalid sequence output: ") + itos(output);
error = true;
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index 89f32f54f7..098c28370d 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -39,7 +39,7 @@ class VisualScriptNodeInstance;
class VisualScript;
class VisualScriptNode : public Resource {
- GDCLASS(VisualScriptNode, Resource)
+ GDCLASS(VisualScriptNode, Resource);
friend class VisualScript;
@@ -165,7 +165,7 @@ public:
class VisualScript : public Script {
- GDCLASS(VisualScript, Script)
+ GDCLASS(VisualScript, Script);
RES_BASE_EXTENSION("vs");
diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h
index 3e452cd94f..f009f49b5b 100644
--- a/modules/visual_script/visual_script_builtin_funcs.h
+++ b/modules/visual_script/visual_script_builtin_funcs.h
@@ -35,7 +35,8 @@
class VisualScriptBuiltinFunc : public VisualScriptNode {
- GDCLASS(VisualScriptBuiltinFunc, VisualScriptNode)
+ GDCLASS(VisualScriptBuiltinFunc, VisualScriptNode);
+
public:
enum BuiltinFunc {
MATH_SIN,
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 7c3bad6785..3ac170a935 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -46,7 +46,7 @@
#ifdef TOOLS_ENABLED
class VisualScriptEditorSignalEdit : public Object {
- GDCLASS(VisualScriptEditorSignalEdit, Object)
+ GDCLASS(VisualScriptEditorSignalEdit, Object);
StringName sig;
@@ -186,7 +186,7 @@ public:
class VisualScriptEditorVariableEdit : public Object {
- GDCLASS(VisualScriptEditorVariableEdit, Object)
+ GDCLASS(VisualScriptEditorVariableEdit, Object);
StringName var;
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index b66d10021a..4f302d1d72 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -44,7 +44,7 @@ class VisualScriptEditorVariableEdit;
#ifdef TOOLS_ENABLED
class VisualScriptEditor : public ScriptEditorBase {
- GDCLASS(VisualScriptEditor, ScriptEditorBase)
+ GDCLASS(VisualScriptEditor, ScriptEditorBase);
enum {
TYPE_SEQUENCE = 1000,
diff --git a/modules/visual_script/visual_script_expression.h b/modules/visual_script/visual_script_expression.h
index 3b2e3b9f78..3a045d2cf7 100644
--- a/modules/visual_script/visual_script_expression.h
+++ b/modules/visual_script/visual_script_expression.h
@@ -36,7 +36,7 @@
class VisualScriptExpression : public VisualScriptNode {
- GDCLASS(VisualScriptExpression, VisualScriptNode)
+ GDCLASS(VisualScriptExpression, VisualScriptNode);
friend class VisualScriptNodeInstanceExpression;
struct Input {
diff --git a/modules/visual_script/visual_script_flow_control.h b/modules/visual_script/visual_script_flow_control.h
index a42605a50e..d3c7aa68e3 100644
--- a/modules/visual_script/visual_script_flow_control.h
+++ b/modules/visual_script/visual_script_flow_control.h
@@ -35,7 +35,7 @@
class VisualScriptReturn : public VisualScriptNode {
- GDCLASS(VisualScriptReturn, VisualScriptNode)
+ GDCLASS(VisualScriptReturn, VisualScriptNode);
Variant::Type type;
bool with_value;
@@ -72,7 +72,7 @@ public:
class VisualScriptCondition : public VisualScriptNode {
- GDCLASS(VisualScriptCondition, VisualScriptNode)
+ GDCLASS(VisualScriptCondition, VisualScriptNode);
protected:
static void _bind_methods();
@@ -100,7 +100,7 @@ public:
class VisualScriptWhile : public VisualScriptNode {
- GDCLASS(VisualScriptWhile, VisualScriptNode)
+ GDCLASS(VisualScriptWhile, VisualScriptNode);
protected:
static void _bind_methods();
@@ -128,7 +128,7 @@ public:
class VisualScriptIterator : public VisualScriptNode {
- GDCLASS(VisualScriptIterator, VisualScriptNode)
+ GDCLASS(VisualScriptIterator, VisualScriptNode);
protected:
static void _bind_methods();
@@ -156,7 +156,7 @@ public:
class VisualScriptSequence : public VisualScriptNode {
- GDCLASS(VisualScriptSequence, VisualScriptNode)
+ GDCLASS(VisualScriptSequence, VisualScriptNode);
int steps;
@@ -189,7 +189,7 @@ public:
class VisualScriptSwitch : public VisualScriptNode {
- GDCLASS(VisualScriptSwitch, VisualScriptNode)
+ GDCLASS(VisualScriptSwitch, VisualScriptNode);
struct Case {
Variant::Type type;
@@ -231,7 +231,7 @@ public:
class VisualScriptTypeCast : public VisualScriptNode {
- GDCLASS(VisualScriptTypeCast, VisualScriptNode)
+ GDCLASS(VisualScriptTypeCast, VisualScriptNode);
StringName base_type;
String script;
diff --git a/modules/visual_script/visual_script_func_nodes.h b/modules/visual_script/visual_script_func_nodes.h
index 7b1e7871b6..11eb96293b 100644
--- a/modules/visual_script/visual_script_func_nodes.h
+++ b/modules/visual_script/visual_script_func_nodes.h
@@ -35,7 +35,8 @@
class VisualScriptFunctionCall : public VisualScriptNode {
- GDCLASS(VisualScriptFunctionCall, VisualScriptNode)
+ GDCLASS(VisualScriptFunctionCall, VisualScriptNode);
+
public:
enum CallMode {
CALL_MODE_SELF,
@@ -137,7 +138,8 @@ VARIANT_ENUM_CAST(VisualScriptFunctionCall::RPCCallMode);
class VisualScriptPropertySet : public VisualScriptNode {
- GDCLASS(VisualScriptPropertySet, VisualScriptNode)
+ GDCLASS(VisualScriptPropertySet, VisualScriptNode);
+
public:
enum CallMode {
CALL_MODE_SELF,
@@ -242,7 +244,8 @@ VARIANT_ENUM_CAST(VisualScriptPropertySet::AssignOp);
class VisualScriptPropertyGet : public VisualScriptNode {
- GDCLASS(VisualScriptPropertyGet, VisualScriptNode)
+ GDCLASS(VisualScriptPropertyGet, VisualScriptNode);
+
public:
enum CallMode {
CALL_MODE_SELF,
@@ -323,7 +326,7 @@ VARIANT_ENUM_CAST(VisualScriptPropertyGet::CallMode);
class VisualScriptEmitSignal : public VisualScriptNode {
- GDCLASS(VisualScriptEmitSignal, VisualScriptNode)
+ GDCLASS(VisualScriptEmitSignal, VisualScriptNode);
private:
StringName name;
diff --git a/modules/visual_script/visual_script_nodes.h b/modules/visual_script/visual_script_nodes.h
index b3d199fb38..762a1bdfb6 100644
--- a/modules/visual_script/visual_script_nodes.h
+++ b/modules/visual_script/visual_script_nodes.h
@@ -35,7 +35,7 @@
class VisualScriptFunction : public VisualScriptNode {
- GDCLASS(VisualScriptFunction, VisualScriptNode)
+ GDCLASS(VisualScriptFunction, VisualScriptNode);
struct Argument {
String name;
@@ -105,7 +105,7 @@ public:
class VisualScriptOperator : public VisualScriptNode {
- GDCLASS(VisualScriptOperator, VisualScriptNode)
+ GDCLASS(VisualScriptOperator, VisualScriptNode);
Variant::Type typed;
Variant::Operator op;
@@ -141,7 +141,7 @@ public:
class VisualScriptSelect : public VisualScriptNode {
- GDCLASS(VisualScriptSelect, VisualScriptNode)
+ GDCLASS(VisualScriptSelect, VisualScriptNode);
Variant::Type typed;
@@ -174,7 +174,7 @@ public:
class VisualScriptVariableGet : public VisualScriptNode {
- GDCLASS(VisualScriptVariableGet, VisualScriptNode)
+ GDCLASS(VisualScriptVariableGet, VisualScriptNode);
StringName variable;
@@ -207,7 +207,7 @@ public:
class VisualScriptVariableSet : public VisualScriptNode {
- GDCLASS(VisualScriptVariableSet, VisualScriptNode)
+ GDCLASS(VisualScriptVariableSet, VisualScriptNode);
StringName variable;
@@ -240,7 +240,7 @@ public:
class VisualScriptConstant : public VisualScriptNode {
- GDCLASS(VisualScriptConstant, VisualScriptNode)
+ GDCLASS(VisualScriptConstant, VisualScriptNode);
Variant::Type type;
Variant value;
@@ -277,7 +277,7 @@ public:
class VisualScriptPreload : public VisualScriptNode {
- GDCLASS(VisualScriptPreload, VisualScriptNode)
+ GDCLASS(VisualScriptPreload, VisualScriptNode);
Ref<Resource> preload;
@@ -309,7 +309,7 @@ public:
class VisualScriptIndexGet : public VisualScriptNode {
- GDCLASS(VisualScriptIndexGet, VisualScriptNode)
+ GDCLASS(VisualScriptIndexGet, VisualScriptNode);
public:
virtual int get_output_sequence_port_count() const;
@@ -333,7 +333,7 @@ public:
class VisualScriptIndexSet : public VisualScriptNode {
- GDCLASS(VisualScriptIndexSet, VisualScriptNode)
+ GDCLASS(VisualScriptIndexSet, VisualScriptNode);
public:
virtual int get_output_sequence_port_count() const;
@@ -357,7 +357,7 @@ public:
class VisualScriptGlobalConstant : public VisualScriptNode {
- GDCLASS(VisualScriptGlobalConstant, VisualScriptNode)
+ GDCLASS(VisualScriptGlobalConstant, VisualScriptNode);
int index;
@@ -388,7 +388,7 @@ public:
class VisualScriptClassConstant : public VisualScriptNode {
- GDCLASS(VisualScriptClassConstant, VisualScriptNode)
+ GDCLASS(VisualScriptClassConstant, VisualScriptNode);
StringName base_type;
StringName name;
@@ -425,7 +425,7 @@ public:
class VisualScriptBasicTypeConstant : public VisualScriptNode {
- GDCLASS(VisualScriptBasicTypeConstant, VisualScriptNode)
+ GDCLASS(VisualScriptBasicTypeConstant, VisualScriptNode);
Variant::Type type;
StringName name;
@@ -463,7 +463,8 @@ public:
class VisualScriptMathConstant : public VisualScriptNode {
- GDCLASS(VisualScriptMathConstant, VisualScriptNode)
+ GDCLASS(VisualScriptMathConstant, VisualScriptNode);
+
public:
enum MathConstant {
MATH_CONSTANT_ONE,
@@ -512,7 +513,7 @@ VARIANT_ENUM_CAST(VisualScriptMathConstant::MathConstant)
class VisualScriptEngineSingleton : public VisualScriptNode {
- GDCLASS(VisualScriptEngineSingleton, VisualScriptNode)
+ GDCLASS(VisualScriptEngineSingleton, VisualScriptNode);
String singleton;
@@ -545,7 +546,7 @@ public:
class VisualScriptSceneNode : public VisualScriptNode {
- GDCLASS(VisualScriptSceneNode, VisualScriptNode)
+ GDCLASS(VisualScriptSceneNode, VisualScriptNode);
NodePath path;
@@ -580,7 +581,7 @@ public:
class VisualScriptSceneTree : public VisualScriptNode {
- GDCLASS(VisualScriptSceneTree, VisualScriptNode)
+ GDCLASS(VisualScriptSceneTree, VisualScriptNode);
protected:
virtual void _validate_property(PropertyInfo &property) const;
@@ -610,7 +611,7 @@ public:
class VisualScriptResourcePath : public VisualScriptNode {
- GDCLASS(VisualScriptResourcePath, VisualScriptNode)
+ GDCLASS(VisualScriptResourcePath, VisualScriptNode);
String path;
@@ -642,7 +643,7 @@ public:
class VisualScriptSelf : public VisualScriptNode {
- GDCLASS(VisualScriptSelf, VisualScriptNode)
+ GDCLASS(VisualScriptSelf, VisualScriptNode);
protected:
static void _bind_methods();
@@ -671,7 +672,7 @@ public:
class VisualScriptCustomNode : public VisualScriptNode {
- GDCLASS(VisualScriptCustomNode, VisualScriptNode)
+ GDCLASS(VisualScriptCustomNode, VisualScriptNode);
protected:
static void _bind_methods();
@@ -719,7 +720,7 @@ VARIANT_ENUM_CAST(VisualScriptCustomNode::StartMode);
class VisualScriptSubCall : public VisualScriptNode {
- GDCLASS(VisualScriptSubCall, VisualScriptNode)
+ GDCLASS(VisualScriptSubCall, VisualScriptNode);
protected:
static void _bind_methods();
@@ -747,7 +748,7 @@ public:
class VisualScriptComment : public VisualScriptNode {
- GDCLASS(VisualScriptComment, VisualScriptNode)
+ GDCLASS(VisualScriptComment, VisualScriptNode);
String title;
String description;
@@ -788,7 +789,7 @@ public:
class VisualScriptConstructor : public VisualScriptNode {
- GDCLASS(VisualScriptConstructor, VisualScriptNode)
+ GDCLASS(VisualScriptConstructor, VisualScriptNode);
Variant::Type type;
MethodInfo constructor;
@@ -824,7 +825,7 @@ public:
class VisualScriptLocalVar : public VisualScriptNode {
- GDCLASS(VisualScriptLocalVar, VisualScriptNode)
+ GDCLASS(VisualScriptLocalVar, VisualScriptNode);
StringName name;
Variant::Type type;
@@ -860,7 +861,7 @@ public:
class VisualScriptLocalVarSet : public VisualScriptNode {
- GDCLASS(VisualScriptLocalVarSet, VisualScriptNode)
+ GDCLASS(VisualScriptLocalVarSet, VisualScriptNode);
StringName name;
Variant::Type type;
@@ -897,7 +898,8 @@ public:
class VisualScriptInputAction : public VisualScriptNode {
- GDCLASS(VisualScriptInputAction, VisualScriptNode)
+ GDCLASS(VisualScriptInputAction, VisualScriptNode);
+
public:
enum Mode {
MODE_PRESSED,
@@ -944,7 +946,7 @@ VARIANT_ENUM_CAST(VisualScriptInputAction::Mode)
class VisualScriptDeconstruct : public VisualScriptNode {
- GDCLASS(VisualScriptDeconstruct, VisualScriptNode)
+ GDCLASS(VisualScriptDeconstruct, VisualScriptNode);
struct Element {
StringName name;
diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp
index ceec79c0d5..1e7ed3019c 100644
--- a/modules/visual_script/visual_script_property_selector.cpp
+++ b/modules/visual_script/visual_script_property_selector.cpp
@@ -188,7 +188,6 @@ void VisualScriptPropertySelector::_update_search() {
}
}
}
- bool script_methods = false;
{
if (type != Variant::NIL) {
Variant v;
@@ -211,7 +210,7 @@ void VisualScriptPropertySelector::_update_search() {
for (List<MethodInfo>::Element *M = methods.front(); M; M = M->next()) {
String name = M->get().name.get_slice(":", 0);
- if (!script_methods && name.begins_with("_") && !(M->get().flags & METHOD_FLAG_VIRTUAL))
+ if (name.begins_with("_") && !(M->get().flags & METHOD_FLAG_VIRTUAL))
continue;
if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL))
diff --git a/modules/visual_script/visual_script_property_selector.h b/modules/visual_script/visual_script_property_selector.h
index 1588243bc1..6235e4ba1d 100644
--- a/modules/visual_script/visual_script_property_selector.h
+++ b/modules/visual_script/visual_script_property_selector.h
@@ -36,7 +36,7 @@
#include "scene/gui/rich_text_label.h"
class VisualScriptPropertySelector : public ConfirmationDialog {
- GDCLASS(VisualScriptPropertySelector, ConfirmationDialog)
+ GDCLASS(VisualScriptPropertySelector, ConfirmationDialog);
LineEdit *search_box;
Tree *search_options;
diff --git a/modules/visual_script/visual_script_yield_nodes.h b/modules/visual_script/visual_script_yield_nodes.h
index 851bf6aa74..647f2b1e2e 100644
--- a/modules/visual_script/visual_script_yield_nodes.h
+++ b/modules/visual_script/visual_script_yield_nodes.h
@@ -35,7 +35,8 @@
class VisualScriptYield : public VisualScriptNode {
- GDCLASS(VisualScriptYield, VisualScriptNode)
+ GDCLASS(VisualScriptYield, VisualScriptNode);
+
public:
enum YieldMode {
YIELD_RETURN,
@@ -84,7 +85,8 @@ VARIANT_ENUM_CAST(VisualScriptYield::YieldMode)
class VisualScriptYieldSignal : public VisualScriptNode {
- GDCLASS(VisualScriptYieldSignal, VisualScriptNode)
+ GDCLASS(VisualScriptYieldSignal, VisualScriptNode);
+
public:
enum CallMode {
CALL_MODE_SELF,
diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h
index fa9d5fe664..a37867d9f9 100644
--- a/modules/vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/vorbis/audio_stream_ogg_vorbis.h
@@ -127,7 +127,6 @@ public:
};
class ResourceFormatLoaderAudioStreamOGGVorbis : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderAudioStreamOGGVorbis, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/modules/webm/config.py b/modules/webm/config.py
index 72a4073423..ba4dcce2f5 100644
--- a/modules/webm/config.py
+++ b/modules/webm/config.py
@@ -6,7 +6,6 @@ def configure(env):
def get_doc_classes():
return [
- "ResourceImporterWebm",
"VideoStreamWebm",
]
diff --git a/modules/webm/libvpx/SCsub b/modules/webm/libvpx/SCsub
index a6be1380a6..c76585013c 100644
--- a/modules/webm/libvpx/SCsub
+++ b/modules/webm/libvpx/SCsub
@@ -384,8 +384,6 @@ elif webm_cpu_arm:
env_libvpx.add_source_files(env.modules_sources, [libvpx_dir + "third_party/android/cpu-features.c"])
env_libvpx_neon = env_libvpx.Clone()
- if env["platform"] == 'android' and env["android_arch"] == 'armv6':
- env_libvpx_neon.Append(CCFLAGS=['-mfpu=neon'])
env_libvpx_neon.add_source_files(env.modules_sources, libvpx_sources_arm_neon)
if env["platform"] == 'uwp':
diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h
index 992095ba4c..ddcbb1eb08 100644
--- a/modules/webm/video_stream_webm.h
+++ b/modules/webm/video_stream_webm.h
@@ -41,7 +41,7 @@ class OpusVorbisDecoder;
class VideoStreamPlaybackWebm : public VideoStreamPlayback {
- GDCLASS(VideoStreamPlaybackWebm, VideoStreamPlayback)
+ GDCLASS(VideoStreamPlaybackWebm, VideoStreamPlayback);
String file_name;
int audio_track;
@@ -127,7 +127,6 @@ public:
};
class ResourceFormatLoaderWebm : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderWebm, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/platform/android/SCsub b/platform/android/SCsub
index 22ed476c6f..1562714d76 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -37,9 +37,7 @@ android_objects.append(env_thirdparty.SharedObject('#thirdparty/misc/ifaddrs-and
lib = env_android.add_shared_library("#bin/libgodot", [android_objects], SHLIBSUFFIX=env["SHLIBSUFFIX"])
lib_arch_dir = ''
-if env['android_arch'] == 'armv6':
- lib_arch_dir = 'armeabi'
-elif env['android_arch'] == 'armv7':
+if env['android_arch'] == 'armv7':
lib_arch_dir = 'armeabi-v7a'
elif env['android_arch'] == 'arm64v8':
lib_arch_dir = 'arm64-v8a'
diff --git a/platform/android/detect.py b/platform/android/detect.py
index b7641172e4..eed51c4d30 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -26,7 +26,7 @@ def get_opts():
return [
('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
- EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'armv6', 'arm64v8', 'x86', 'x86_64')),
+ EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'arm64v8', 'x86', 'x86_64')),
BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True),
BoolVariable('android_stl', 'Enable Android STL support (for modules)', True)
]
@@ -93,7 +93,7 @@ def configure(env):
## Architecture
- if env['android_arch'] not in ['armv7', 'armv6', 'arm64v8', 'x86', 'x86_64']:
+ if env['android_arch'] not in ['armv7', 'arm64v8', 'x86', 'x86_64']:
env['android_arch'] = 'armv7'
neon_text = ""
@@ -119,13 +119,6 @@ def configure(env):
abi_subpath = "x86_64-linux-android"
arch_subpath = "x86_64"
env["x86_libtheora_opt_gcc"] = True
- elif env['android_arch'] == 'armv6':
- env['ARCH'] = 'arch-arm'
- env.extra_suffix = ".armv6" + env.extra_suffix
- target_subpath = "arm-linux-androideabi-4.9"
- abi_subpath = "arm-linux-androideabi"
- arch_subpath = "armeabi"
- can_vectorize = False
elif env["android_arch"] == "armv7":
env['ARCH'] = 'arch-arm'
target_subpath = "arm-linux-androideabi-4.9"
@@ -249,11 +242,6 @@ def configure(env):
elif env['android_arch'] == 'x86_64':
target_opts = ['-target', 'x86_64-none-linux-android']
- elif env["android_arch"] == "armv6":
- target_opts = ['-target', 'armv6-none-linux-androideabi']
- env.Append(CCFLAGS='-march=armv6 -mfpu=vfp -mfloat-abi=softfp'.split())
- env.Append(CPPFLAGS=['-D__ARM_ARCH_6__'])
-
elif env["android_arch"] == "armv7":
target_opts = ['-target', 'armv7-none-linux-androideabi']
env.Append(CCFLAGS='-march=armv7-a -mfloat-abi=softfp'.split())
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 30267aa968..0bd82b769f 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -208,7 +208,7 @@ static const LauncherIcon launcher_icons[] = {
class EditorExportPlatformAndroid : public EditorExportPlatform {
- GDCLASS(EditorExportPlatformAndroid, EditorExportPlatform)
+ GDCLASS(EditorExportPlatformAndroid, EditorExportPlatform);
Ref<ImageTexture> logo;
Ref<ImageTexture> run_icon;
@@ -553,9 +553,6 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
static Vector<String> get_abis() {
Vector<String> abis;
- // We can still build armv6 in theory, but it doesn't make much
- // sense for games, so disabling for now.
- //abis.push_back("armeabi");
abis.push_back("armeabi-v7a");
abis.push_back("arm64-v8a");
abis.push_back("x86");
diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java
index d01f958123..a443a0ad90 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java
@@ -65,6 +65,14 @@ public class GodotInputHandler implements InputDeviceListener {
godotView.queueEvent(task);
}
+ private boolean isKeyEvent_GameDevice(int source) {
+ // Note that keyboards are often (SOURCE_KEYBOARD | SOURCE_DPAD)
+ if (source == (InputDevice.SOURCE_KEYBOARD | InputDevice.SOURCE_DPAD))
+ return false;
+
+ return (source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD;
+ }
+
public boolean onKeyUp(final int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
@@ -75,7 +83,7 @@ public class GodotInputHandler implements InputDeviceListener {
};
int source = event.getSource();
- if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
+ if (isKeyEvent_GameDevice(source)) {
final int button = getGodotButton(keyCode);
final int device_id = findJoystickDevice(event.getDeviceId());
@@ -118,7 +126,7 @@ public class GodotInputHandler implements InputDeviceListener {
int source = event.getSource();
//Log.e(TAG, String.format("Key down! source %d, device %d, joystick %d, %d, %d", event.getDeviceId(), source, (source & InputDevice.SOURCE_JOYSTICK), (source & InputDevice.SOURCE_DPAD), (source & InputDevice.SOURCE_GAMEPAD)));
- if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
+ if (isKeyEvent_GameDevice(source)) {
if (event.getRepeatCount() > 0) // ignore key echo
return true;
diff --git a/platform/haiku/detect.py b/platform/haiku/detect.py
index f33c77a407..5a708cdaca 100644
--- a/platform/haiku/detect.py
+++ b/platform/haiku/detect.py
@@ -80,7 +80,7 @@ def configure(env):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
if not env['builtin_libpng']:
- env.ParseConfig('pkg-config libpng --cflags --libs')
+ env.ParseConfig('pkg-config libpng16 --cflags --libs')
if not env['builtin_bullet']:
# We need at least version 2.88
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 487da77b10..c68b420c61 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -40,7 +40,7 @@
class EditorExportPlatformJavaScript : public EditorExportPlatform {
- GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform)
+ GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform);
Ref<ImageTexture> logo;
Ref<ImageTexture> run_icon;
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 0ca94e3a63..1e996608af 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -188,6 +188,7 @@ public:
virtual void warp_mouse_position(const Point2 &p_to);
virtual Point2 get_mouse_position() const;
virtual int get_mouse_button_state() const;
+ void update_real_mouse_position();
virtual void set_window_title(const String &p_title);
virtual Size2 get_window_size() const;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index dade07ffda..4f84ae9c50 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1569,6 +1569,9 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (p_desired.layered) {
set_window_per_pixel_transparency_enabled(true);
}
+
+ update_real_mouse_position();
+
return OK;
}
@@ -1907,6 +1910,12 @@ void OS_OSX::warp_mouse_position(const Point2 &p_to) {
}
}
+void OS_OSX::update_real_mouse_position() {
+
+ get_mouse_pos([window_object mouseLocationOutsideOfEventStream], [window_view backingScaleFactor]);
+ input->set_mouse_position(Point2(mouse_x, mouse_y));
+}
+
Point2 OS_OSX::get_mouse_position() const {
return Vector2(mouse_x, mouse_y);
@@ -2357,6 +2366,8 @@ void OS_OSX::set_window_position(const Point2 &p_position) {
// Godot passes a positive value
position.y *= -1;
set_native_window_position(get_screens_origin() + position);
+
+ update_real_mouse_position();
};
Size2 OS_OSX::get_window_size() const {
diff --git a/platform/server/detect.py b/platform/server/detect.py
index a5648d8d9d..a325395d6d 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -142,7 +142,7 @@ def configure(env):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
if not env['builtin_libpng']:
- env.ParseConfig('pkg-config libpng --cflags --libs')
+ env.ParseConfig('pkg-config libpng16 --cflags --libs')
if not env['builtin_bullet']:
# We need at least version 2.89
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 6e6df08f02..5876a385c6 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1979,6 +1979,17 @@ bool OS_Windows::is_window_always_on_top() const {
return video_mode.always_on_top;
}
+void OS_Windows::set_console_visible(bool p_enabled) {
+ if (console_visible == p_enabled)
+ return;
+ ShowWindow(GetConsoleWindow(), p_enabled ? SW_SHOW : SW_HIDE);
+ console_visible = p_enabled;
+}
+
+bool OS_Windows::is_console_visible() const {
+ return console_visible;
+}
+
bool OS_Windows::get_window_per_pixel_transparency_enabled() const {
if (!is_layered_allowed()) return false;
@@ -3231,6 +3242,7 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
control_mem = false;
meta_mem = false;
minimized = false;
+ console_visible = IsWindowVisible(GetConsoleWindow());
hInstance = _hInstance;
pressrc = 0;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 4660c16b97..fc8ad1b188 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -210,6 +210,7 @@ protected:
bool maximized;
bool minimized;
bool borderless;
+ bool console_visible;
public:
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -256,6 +257,8 @@ public:
virtual bool is_window_maximized() const;
virtual void set_window_always_on_top(bool p_enabled);
virtual bool is_window_always_on_top() const;
+ virtual void set_console_visible(bool p_enabled);
+ virtual bool is_console_visible() const;
virtual void request_attention();
virtual void set_borderless_window(bool p_borderless);
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index a502308eee..9614104750 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -75,11 +75,7 @@ def get_opts():
def get_flags():
- return [
- ('builtin_freetype', False),
- ('builtin_libpng', False),
- ('builtin_zlib', False),
- ]
+ return []
def configure(env):
@@ -216,7 +212,7 @@ def configure(env):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
if not env['builtin_libpng']:
- env.ParseConfig('pkg-config libpng --cflags --libs')
+ env.ParseConfig('pkg-config libpng16 --cflags --libs')
if not env['builtin_bullet']:
# We need at least version 2.89
diff --git a/platform/x11/detect_prime.cpp b/platform/x11/detect_prime.cpp
index 0fde2a0c04..26008feade 100644
--- a/platform/x11/detect_prime.cpp
+++ b/platform/x11/detect_prime.cpp
@@ -159,10 +159,11 @@ int detect_prime() {
if (!stat_loc) {
// No need to do anything complicated here. Anything less than
// PIPE_BUF will be delivered in one read() call.
- read(fdset[0], string, sizeof(string) - 1);
-
- vendors[i] = string;
- renderers[i] = string + strlen(string) + 1;
+ // Leave it 'Unknown' otherwise.
+ if (read(fdset[0], string, sizeof(string) - 1) > 0) {
+ vendors[i] = string;
+ renderers[i] = string + strlen(string) + 1;
+ }
}
close(fdset[0]);
@@ -190,8 +191,9 @@ int detect_prime() {
memcpy(&string, vendor, vendor_len);
memcpy(&string[vendor_len], renderer, renderer_len);
- write(fdset[1], string, vendor_len + renderer_len);
-
+ if (write(fdset[1], string, vendor_len + renderer_len) == -1) {
+ print_verbose("Couldn't write vendor/renderer string.");
+ }
close(fdset[1]);
exit(0);
}
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 3e9e8033e8..21c3b0ac91 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -414,7 +414,9 @@ void JoypadLinux::joypad_vibration_start(int p_id, float p_weak_magnitude, float
play.type = EV_FF;
play.code = effect.id;
play.value = 1;
- write(joy.fd, (const void *)&play, sizeof(play));
+ if (write(joy.fd, (const void *)&play, sizeof(play)) == -1) {
+ print_verbose("Couldn't write to Joypad device.");
+ }
joy.ff_effect_id = effect.id;
joy.ff_effect_timestamp = p_timestamp;
diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp
index b322cfe8f1..b701e84a9c 100644
--- a/scene/2d/area_2d.cpp
+++ b/scene/2d/area_2d.cpp
@@ -657,10 +657,10 @@ void Area2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("_body_inout"), &Area2D::_body_inout);
ClassDB::bind_method(D_METHOD("_area_inout"), &Area2D::_area_inout);
- ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsBody2D"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
- ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsBody2D"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
- ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsBody2D")));
- ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsBody2D")));
+ ADD_SIGNAL(MethodInfo("body_shape_entered", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
+ ADD_SIGNAL(MethodInfo("body_shape_exited", PropertyInfo(Variant::INT, "body_id"), PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::INT, "body_shape"), PropertyInfo(Variant::INT, "area_shape")));
+ ADD_SIGNAL(MethodInfo("body_entered", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
+ ADD_SIGNAL(MethodInfo("body_exited", PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
ADD_SIGNAL(MethodInfo("area_shape_entered", PropertyInfo(Variant::INT, "area_id"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"), PropertyInfo(Variant::INT, "area_shape"), PropertyInfo(Variant::INT, "self_shape")));
ADD_SIGNAL(MethodInfo("area_shape_exited", PropertyInfo(Variant::INT, "area_id"), PropertyInfo(Variant::OBJECT, "area", PROPERTY_HINT_RESOURCE_TYPE, "Area2D"), PropertyInfo(Variant::INT, "area_shape"), PropertyInfo(Variant::INT, "self_shape")));
diff --git a/scene/2d/audio_stream_player_2d.h b/scene/2d/audio_stream_player_2d.h
index e9cdfa2303..ffa3d4edb4 100644
--- a/scene/2d/audio_stream_player_2d.h
+++ b/scene/2d/audio_stream_player_2d.h
@@ -37,7 +37,7 @@
class AudioStreamPlayer2D : public Node2D {
- GDCLASS(AudioStreamPlayer2D, Node2D)
+ GDCLASS(AudioStreamPlayer2D, Node2D);
private:
enum {
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index a020ab5029..1f585d84ce 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -46,7 +46,7 @@ class StyleBox;
class CanvasItemMaterial : public Material {
- GDCLASS(CanvasItemMaterial, Material)
+ GDCLASS(CanvasItemMaterial, Material);
public:
enum BlendMode {
diff --git a/scene/2d/collision_object_2d.h b/scene/2d/collision_object_2d.h
index 8aa3330f37..4e7d01c8e6 100644
--- a/scene/2d/collision_object_2d.h
+++ b/scene/2d/collision_object_2d.h
@@ -36,7 +36,7 @@
class CollisionObject2D : public Node2D {
- GDCLASS(CollisionObject2D, Node2D)
+ GDCLASS(CollisionObject2D, Node2D);
bool area;
RID rid;
diff --git a/scene/2d/collision_shape_2d.h b/scene/2d/collision_shape_2d.h
index e913b4a866..26c61f47bd 100644
--- a/scene/2d/collision_shape_2d.h
+++ b/scene/2d/collision_shape_2d.h
@@ -38,7 +38,7 @@ class CollisionObject2D;
class CollisionShape2D : public Node2D {
- GDCLASS(CollisionShape2D, Node2D)
+ GDCLASS(CollisionShape2D, Node2D);
Ref<Shape2D> shape;
Rect2 rect;
uint32_t owner_id;
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index a8d72bb774..fba1c26d1c 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -250,6 +250,8 @@ void CPUParticles2D::restart() {
frame_remainder = 0;
cycle = 0;
+ set_emitting(true);
+
{
int pc = particles.size();
PoolVector<Particle>::Write w = particles.write();
@@ -1391,10 +1393,10 @@ CPUParticles2D::CPUParticles2D() {
set_spread(45);
set_flatness(0);
- set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1);
+ set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
+ set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
set_param(PARAM_LINEAR_ACCEL, 0);
- set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_RADIAL_ACCEL, 0);
set_param(PARAM_TANGENTIAL_ACCEL, 0);
set_param(PARAM_DAMPING, 0);
diff --git a/scene/2d/joints_2d.cpp b/scene/2d/joints_2d.cpp
index 5b14b3e8e1..d8156a0afe 100644
--- a/scene/2d/joints_2d.cpp
+++ b/scene/2d/joints_2d.cpp
@@ -61,9 +61,7 @@ void Joint2D::_update_joint(bool p_only_free) {
if (!body_a || !body_b)
return;
- if (!body_a) {
- SWAP(body_a, body_b);
- }
+ SWAP(body_a, body_b);
joint = _configure_joint(body_a, body_b);
diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h
index 8a6f7b2dc5..11be5055d4 100644
--- a/scene/2d/line_2d.h
+++ b/scene/2d/line_2d.h
@@ -35,7 +35,7 @@
class Line2D : public Node2D {
- GDCLASS(Line2D, Node2D)
+ GDCLASS(Line2D, Node2D);
public:
enum LineJointMode {
diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h
index 4d81c8088a..af552415ca 100644
--- a/scene/2d/mesh_instance_2d.h
+++ b/scene/2d/mesh_instance_2d.h
@@ -34,7 +34,7 @@
#include "scene/2d/node_2d.h"
class MeshInstance2D : public Node2D {
- GDCLASS(MeshInstance2D, Node2D)
+ GDCLASS(MeshInstance2D, Node2D);
Ref<Mesh> mesh;
diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp
index 9701998f5d..823794c3ba 100644
--- a/scene/2d/particles_2d.cpp
+++ b/scene/2d/particles_2d.cpp
@@ -278,6 +278,7 @@ void Particles2D::_validate_property(PropertyInfo &property) const {
void Particles2D::restart() {
VS::get_singleton()->particles_restart(particles);
+ VS::get_singleton()->particles_set_emitting(particles, true);
}
void Particles2D::_notification(int p_what) {
diff --git a/scene/2d/particles_2d.h b/scene/2d/particles_2d.h
index a0104b4b16..0276978f83 100644
--- a/scene/2d/particles_2d.h
+++ b/scene/2d/particles_2d.h
@@ -37,7 +37,7 @@
class Particles2D : public Node2D {
private:
- GDCLASS(Particles2D, Node2D)
+ GDCLASS(Particles2D, Node2D);
public:
enum DrawOrder {
diff --git a/scene/2d/position_2d.h b/scene/2d/position_2d.h
index ec73c02d2b..f5ec3ef01a 100644
--- a/scene/2d/position_2d.h
+++ b/scene/2d/position_2d.h
@@ -35,7 +35,7 @@
class Position2D : public Node2D {
- GDCLASS(Position2D, Node2D)
+ GDCLASS(Position2D, Node2D);
void _draw_cross();
diff --git a/scene/2d/skeleton_2d.h b/scene/2d/skeleton_2d.h
index d24c0a1561..0f48b44387 100644
--- a/scene/2d/skeleton_2d.h
+++ b/scene/2d/skeleton_2d.h
@@ -36,7 +36,7 @@
class Skeleton2D;
class Bone2D : public Node2D {
- GDCLASS(Bone2D, Node2D)
+ GDCLASS(Bone2D, Node2D);
friend class Skeleton2D;
#ifdef TOOLS_ENABLED
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index 3557f0425c..4247266e3d 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -752,7 +752,7 @@ Area::Area() :
gravity_is_point = false;
gravity_distance_scale = 0;
linear_damp = 0.1;
- angular_damp = 1;
+ angular_damp = 0.1;
priority = 0;
monitoring = false;
monitorable = false;
diff --git a/scene/3d/audio_stream_player_3d.h b/scene/3d/audio_stream_player_3d.h
index 98bc74b2e4..7a652ed65f 100644
--- a/scene/3d/audio_stream_player_3d.h
+++ b/scene/3d/audio_stream_player_3d.h
@@ -40,7 +40,8 @@
class Camera;
class AudioStreamPlayer3D : public Spatial {
- GDCLASS(AudioStreamPlayer3D, Spatial)
+ GDCLASS(AudioStreamPlayer3D, Spatial);
+
public:
enum AttenuationModel {
ATTENUATION_INVERSE_DISTANCE,
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index cff147ba74..ee5d416930 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -225,6 +225,8 @@ void CPUParticles::restart() {
frame_remainder = 0;
cycle = 0;
+ set_emitting(true);
+
{
int pc = particles.size();
PoolVector<Particle>::Write w = particles.write();
@@ -1459,7 +1461,8 @@ CPUParticles::CPUParticles() {
set_spread(45);
set_flatness(0);
- set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1);
+ set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
+ set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
set_param(PARAM_LINEAR_ACCEL, 0);
set_param(PARAM_RADIAL_ACCEL, 0);
diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp
index 156560f802..949de110f5 100644
--- a/scene/3d/particles.cpp
+++ b/scene/3d/particles.cpp
@@ -278,6 +278,7 @@ String Particles::get_configuration_warning() const {
void Particles::restart() {
VisualServer::get_singleton()->particles_restart(particles);
+ VisualServer::get_singleton()->particles_set_emitting(particles, true);
}
AABB Particles::capture_aabb() const {
diff --git a/scene/3d/spatial_velocity_tracker.h b/scene/3d/spatial_velocity_tracker.h
index 795f56091f..8260cf3f06 100644
--- a/scene/3d/spatial_velocity_tracker.h
+++ b/scene/3d/spatial_velocity_tracker.h
@@ -34,7 +34,7 @@
#include "scene/3d/spatial.h"
class SpatialVelocityTracker : public Reference {
- GDCLASS(SpatialVelocityTracker, Reference)
+ GDCLASS(SpatialVelocityTracker, Reference);
struct PositionHistory {
uint64_t frame;
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index 6b70eef662..9f73484b6a 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -163,6 +163,7 @@ float SpriteBase3D::get_opacity() const {
void SpriteBase3D::set_axis(Vector3::Axis p_axis) {
+ ERR_FAIL_INDEX(p_axis, 3);
axis = p_axis;
_queue_update();
}
diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h
index dfac88b712..2e2d848450 100644
--- a/scene/animation/animation_blend_space_1d.h
+++ b/scene/animation/animation_blend_space_1d.h
@@ -34,7 +34,7 @@
#include "scene/animation/animation_tree.h"
class AnimationNodeBlendSpace1D : public AnimationRootNode {
- GDCLASS(AnimationNodeBlendSpace1D, AnimationRootNode)
+ GDCLASS(AnimationNodeBlendSpace1D, AnimationRootNode);
enum {
MAX_BLEND_POINTS = 64
diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h
index c21360beb9..66ba9b0db7 100644
--- a/scene/animation/animation_blend_space_2d.h
+++ b/scene/animation/animation_blend_space_2d.h
@@ -34,7 +34,8 @@
#include "scene/animation/animation_tree.h"
class AnimationNodeBlendSpace2D : public AnimationRootNode {
- GDCLASS(AnimationNodeBlendSpace2D, AnimationRootNode)
+ GDCLASS(AnimationNodeBlendSpace2D, AnimationRootNode);
+
public:
enum BlendMode {
BLEND_MODE_INTERPOLATED,
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index c16dcb1b8c..a6ef78d82e 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -322,7 +322,8 @@ public:
};
class AnimationNodeOutput : public AnimationNode {
- GDCLASS(AnimationNodeOutput, AnimationNode)
+ GDCLASS(AnimationNodeOutput, AnimationNode);
+
public:
virtual String get_caption() const;
virtual float process(float p_time, bool p_seek);
@@ -332,7 +333,7 @@ public:
/////
class AnimationNodeBlendTree : public AnimationRootNode {
- GDCLASS(AnimationNodeBlendTree, AnimationRootNode)
+ GDCLASS(AnimationNodeBlendTree, AnimationRootNode);
struct Node {
Ref<AnimationNode> node;
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 60f8806b25..a2411743d4 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -599,6 +599,9 @@ void AnimationNodeStateMachine::remove_node(const StringName &p_name) {
{
Ref<AnimationNode> node = states[p_name].node;
+
+ ERR_FAIL_COND(node.is_null());
+
node->disconnect("tree_changed", this, "_tree_changed");
}
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
index e47b940c35..26909a326e 100644
--- a/scene/animation/animation_node_state_machine.h
+++ b/scene/animation/animation_node_state_machine.h
@@ -34,7 +34,8 @@
#include "scene/animation/animation_tree.h"
class AnimationNodeStateMachineTransition : public Resource {
- GDCLASS(AnimationNodeStateMachineTransition, Resource)
+ GDCLASS(AnimationNodeStateMachineTransition, Resource);
+
public:
enum SwitchMode {
SWITCH_MODE_IMMEDIATE,
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index 75088c79fe..54df346374 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -561,14 +561,24 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float
#endif
if (can_call) {
- MessageQueue::get_singleton()->push_call(
- nc->node,
- method,
- s >= 1 ? params[0] : Variant(),
- s >= 2 ? params[1] : Variant(),
- s >= 3 ? params[2] : Variant(),
- s >= 4 ? params[3] : Variant(),
- s >= 5 ? params[4] : Variant());
+ if (method_call_mode == ANIMATION_METHOD_CALL_DEFERRED) {
+ MessageQueue::get_singleton()->push_call(
+ nc->node,
+ method,
+ s >= 1 ? params[0] : Variant(),
+ s >= 2 ? params[1] : Variant(),
+ s >= 3 ? params[2] : Variant(),
+ s >= 4 ? params[3] : Variant(),
+ s >= 5 ? params[4] : Variant());
+ } else {
+ nc->node->call(
+ method,
+ s >= 1 ? params[0] : Variant(),
+ s >= 2 ? params[1] : Variant(),
+ s >= 3 ? params[2] : Variant(),
+ s >= 4 ? params[3] : Variant(),
+ s >= 5 ? params[4] : Variant());
+ }
}
}
@@ -1470,6 +1480,16 @@ AnimationPlayer::AnimationProcessMode AnimationPlayer::get_animation_process_mod
return animation_process_mode;
}
+void AnimationPlayer::set_method_call_mode(AnimationMethodCallMode p_mode) {
+
+ method_call_mode = p_mode;
+}
+
+AnimationPlayer::AnimationMethodCallMode AnimationPlayer::get_method_call_mode() const {
+
+ return method_call_mode;
+}
+
void AnimationPlayer::_set_process(bool p_process, bool p_force) {
if (processing == p_process && !p_force)
@@ -1657,6 +1677,9 @@ void AnimationPlayer::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_animation_process_mode", "mode"), &AnimationPlayer::set_animation_process_mode);
ClassDB::bind_method(D_METHOD("get_animation_process_mode"), &AnimationPlayer::get_animation_process_mode);
+ ClassDB::bind_method(D_METHOD("set_method_call_mode", "mode"), &AnimationPlayer::set_method_call_mode);
+ ClassDB::bind_method(D_METHOD("get_method_call_mode"), &AnimationPlayer::get_method_call_mode);
+
ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
ClassDB::bind_method(D_METHOD("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
@@ -1675,6 +1698,7 @@ void AnimationPlayer::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01"), "set_default_blend_time", "get_default_blend_time");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playback_active", PROPERTY_HINT_NONE, "", 0), "set_active", "is_active");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "playback_speed", PROPERTY_HINT_RANGE, "-64,64,0.01"), "set_speed_scale", "get_speed_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "method_call_mode", PROPERTY_HINT_ENUM, "Deferred,Immediate"), "set_method_call_mode", "get_method_call_mode");
ADD_SIGNAL(MethodInfo("animation_finished", PropertyInfo(Variant::STRING, "anim_name")));
ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING, "old_name"), PropertyInfo(Variant::STRING, "new_name")));
@@ -1684,6 +1708,9 @@ void AnimationPlayer::_bind_methods() {
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_IDLE);
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_MANUAL);
+
+ BIND_ENUM_CONSTANT(ANIMATION_METHOD_CALL_DEFERRED);
+ BIND_ENUM_CONSTANT(ANIMATION_METHOD_CALL_IMMEDIATE);
}
AnimationPlayer::AnimationPlayer() {
@@ -1696,6 +1723,7 @@ AnimationPlayer::AnimationPlayer() {
end_reached = false;
end_notify = false;
animation_process_mode = ANIMATION_PROCESS_IDLE;
+ method_call_mode = ANIMATION_METHOD_CALL_DEFERRED;
processing = false;
default_blend_time = 0;
root = SceneStringNames::get_singleton()->path_pp;
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index fea4819821..f3d38110c6 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -68,6 +68,11 @@ public:
ANIMATION_PROCESS_MANUAL,
};
+ enum AnimationMethodCallMode {
+ ANIMATION_METHOD_CALL_DEFERRED,
+ ANIMATION_METHOD_CALL_IMMEDIATE,
+ };
+
private:
enum {
@@ -246,6 +251,7 @@ private:
String autoplay;
AnimationProcessMode animation_process_mode;
+ AnimationMethodCallMode method_call_mode;
bool processing;
bool active;
@@ -338,6 +344,9 @@ public:
void set_animation_process_mode(AnimationProcessMode p_mode);
AnimationProcessMode get_animation_process_mode() const;
+ void set_method_call_mode(AnimationMethodCallMode p_mode);
+ AnimationMethodCallMode get_method_call_mode() const;
+
void seek(float p_time, bool p_update = false);
void seek_delta(float p_time, float p_delta);
float get_current_animation_position() const;
@@ -363,5 +372,6 @@ public:
};
VARIANT_ENUM_CAST(AnimationPlayer::AnimationProcessMode);
+VARIANT_ENUM_CAST(AnimationPlayer::AnimationMethodCallMode);
#endif
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index 4c65b2a92c..e22d6e4c2d 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -41,7 +41,8 @@ class AnimationPlayer;
class AnimationTree;
class AnimationNode : public Resource {
- GDCLASS(AnimationNode, Resource)
+ GDCLASS(AnimationNode, Resource);
+
public:
enum FilterAction {
FILTER_IGNORE,
@@ -155,13 +156,15 @@ VARIANT_ENUM_CAST(AnimationNode::FilterAction)
//root node does not allow inputs
class AnimationRootNode : public AnimationNode {
- GDCLASS(AnimationRootNode, AnimationNode)
+ GDCLASS(AnimationRootNode, AnimationNode);
+
public:
AnimationRootNode() {}
};
class AnimationTree : public Node {
- GDCLASS(AnimationTree, Node)
+ GDCLASS(AnimationTree, Node);
+
public:
enum AnimationProcessMode {
ANIMATION_PROCESS_PHYSICS,
diff --git a/scene/animation/root_motion_view.h b/scene/animation/root_motion_view.h
index bca265b1f0..07f51165a7 100644
--- a/scene/animation/root_motion_view.h
+++ b/scene/animation/root_motion_view.h
@@ -34,7 +34,8 @@
#include "scene/3d/visual_instance.h"
class RootMotionView : public VisualInstance {
- GDCLASS(RootMotionView, VisualInstance)
+ GDCLASS(RootMotionView, VisualInstance);
+
public:
RID immediate;
NodePath path;
diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h
index 7987bd7e7d..ab9161c798 100644
--- a/scene/audio/audio_stream_player.h
+++ b/scene/audio/audio_stream_player.h
@@ -36,7 +36,7 @@
class AudioStreamPlayer : public Node {
- GDCLASS(AudioStreamPlayer, Node)
+ GDCLASS(AudioStreamPlayer, Node);
public:
enum MixTarget {
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp
index fadf5e432c..52fcea2a71 100644
--- a/scene/gui/base_button.cpp
+++ b/scene/gui/base_button.cpp
@@ -61,37 +61,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) {
bool button_masked = mouse_button.is_valid() && ((1 << (mouse_button->get_button_index() - 1)) & button_mask) > 0;
if (button_masked || ui_accept) {
- if (p_event->is_pressed()) {
- status.press_attempt = true;
- status.pressing_inside = true;
- emit_signal("button_down");
- }
-
- if (status.press_attempt && status.pressing_inside) {
- if (toggle_mode) {
- if ((p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_PRESS) || (!p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_RELEASE)) {
- if (action_mode == ACTION_MODE_BUTTON_PRESS) {
- status.press_attempt = false;
- status.pressing_inside = false;
- }
- status.pressed = !status.pressed;
- _unpress_group();
- _toggled(status.pressed);
- _pressed();
- }
- } else {
- if (!p_event->is_pressed()) {
- _pressed();
- }
- }
- }
-
- if (!p_event->is_pressed()) { // pressed state should be correct with button_up signal
- emit_signal("button_up");
- status.press_attempt = false;
- }
-
- update();
+ on_action_event(p_event);
return;
}
@@ -177,6 +147,41 @@ void BaseButton::_toggled(bool p_pressed) {
emit_signal("toggled", p_pressed);
}
+void BaseButton::on_action_event(Ref<InputEvent> p_event) {
+
+ if (p_event->is_pressed()) {
+ status.press_attempt = true;
+ status.pressing_inside = true;
+ emit_signal("button_down");
+ }
+
+ if (status.press_attempt && status.pressing_inside) {
+ if (toggle_mode) {
+ if ((p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_PRESS) || (!p_event->is_pressed() && action_mode == ACTION_MODE_BUTTON_RELEASE)) {
+ if (action_mode == ACTION_MODE_BUTTON_PRESS) {
+ status.press_attempt = false;
+ status.pressing_inside = false;
+ }
+ status.pressed = !status.pressed;
+ _unpress_group();
+ _toggled(status.pressed);
+ _pressed();
+ }
+ } else {
+ if (!p_event->is_pressed()) {
+ _pressed();
+ }
+ }
+ }
+
+ if (!p_event->is_pressed()) { // pressed state should be correct with button_up signal
+ emit_signal("button_up");
+ status.press_attempt = false;
+ }
+
+ update();
+}
+
void BaseButton::pressed() {
}
@@ -345,16 +350,12 @@ Ref<ShortCut> BaseButton::get_shortcut() const {
void BaseButton::_unhandled_input(Ref<InputEvent> p_event) {
- if (!is_disabled() && is_visible_in_tree() && p_event->is_pressed() && !p_event->is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) {
+ if (!is_disabled() && is_visible_in_tree() && !p_event->is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) {
if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this))
return; //ignore because of modal window
- if (is_toggle_mode()) {
- set_pressed(!is_pressed()); // Also calls _toggled() internally.
- }
-
- _pressed();
+ on_action_event(p_event);
}
}
diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h
index abb3f58d6b..ffccdd69d6 100644
--- a/scene/gui/base_button.h
+++ b/scene/gui/base_button.h
@@ -74,6 +74,8 @@ private:
void _pressed();
void _toggled(bool p_pressed);
+ void on_action_event(Ref<InputEvent> p_event);
+
protected:
virtual void pressed();
virtual void toggled(bool p_pressed);
@@ -138,7 +140,7 @@ VARIANT_ENUM_CAST(BaseButton::ActionMode)
class ButtonGroup : public Resource {
- GDCLASS(ButtonGroup, Resource)
+ GDCLASS(ButtonGroup, Resource);
friend class BaseButton;
Set<BaseButton *> buttons;
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index bca3471091..58a0762469 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -93,6 +93,28 @@ void ColorPicker::set_focus_on_line_edit() {
void ColorPicker::_update_controls() {
+ const char *rgb[3] = { "R", "G", "B" };
+ const char *hsv[3] = { "H", "S", "V" };
+
+ if (hsv_mode_enabled) {
+ for (int i = 0; i < 3; i++)
+ labels[i]->set_text(hsv[i]);
+ } else {
+ for (int i = 0; i < 3; i++)
+ labels[i]->set_text(rgb[i]);
+ }
+
+ if (hsv_mode_enabled) {
+ set_raw_mode(false);
+ btn_raw->set_disabled(true);
+ } else if (raw_mode_enabled) {
+ set_hsv_mode(false);
+ btn_hsv->set_disabled(true);
+ } else {
+ btn_raw->set_disabled(false);
+ btn_hsv->set_disabled(false);
+ }
+
if (edit_alpha) {
values[3]->show();
scroll[3]->show();
@@ -104,7 +126,7 @@ void ColorPicker::_update_controls() {
}
}
-void ColorPicker::set_pick_color(const Color &p_color) {
+void ColorPicker::_set_pick_color(const Color &p_color, bool p_update_sliders) {
color = p_color;
if (color != last_hsv) {
@@ -117,7 +139,12 @@ void ColorPicker::set_pick_color(const Color &p_color) {
if (!is_inside_tree())
return;
- _update_color();
+ _update_color(p_update_sliders);
+}
+
+void ColorPicker::set_pick_color(const Color &p_color) {
+
+ _set_pick_color(p_color, true); //because setters can't have more arguments
}
void ColorPicker::set_edit_alpha(bool p_show) {
@@ -142,11 +169,18 @@ void ColorPicker::_value_changed(double) {
if (updating)
return;
- for (int i = 0; i < 4; i++) {
- color.components[i] = scroll[i]->get_value() / (raw_mode_enabled ? 1.0 : 255.0);
+ if (hsv_mode_enabled) {
+ color.set_hsv(scroll[0]->get_value() / 360.0,
+ scroll[1]->get_value() / 100.0,
+ scroll[2]->get_value() / 100.0,
+ scroll[3]->get_value() / 100.0);
+ } else {
+ for (int i = 0; i < 4; i++) {
+ color.components[i] = scroll[i]->get_value() / (raw_mode_enabled ? 1.0 : 255.0);
+ }
}
- set_pick_color(color);
+ _set_pick_color(color, false);
emit_signal("color_changed", color);
}
@@ -167,22 +201,40 @@ void ColorPicker::_html_entered(const String &p_html) {
emit_signal("color_changed", color);
}
-void ColorPicker::_update_color() {
+void ColorPicker::_update_color(bool p_update_sliders) {
updating = true;
- for (int i = 0; i < 4; i++) {
- if (raw_mode_enabled) {
- scroll[i]->set_step(0.01);
- scroll[i]->set_max(100);
- if (i == 3)
- scroll[i]->set_max(1);
- scroll[i]->set_value(color.components[i]);
+ if (p_update_sliders) {
+
+ if (hsv_mode_enabled) {
+ for (int i = 0; i < 4; i++) {
+ scroll[i]->set_step(0.1);
+ }
+
+ scroll[0]->set_max(360);
+ scroll[0]->set_value(h * 360.0);
+ scroll[1]->set_max(100);
+ scroll[1]->set_value(s * 100.0);
+ scroll[2]->set_max(100);
+ scroll[2]->set_value(v * 100.0);
+ scroll[3]->set_max(100);
+ scroll[3]->set_value(color.components[3] * 100.0);
} else {
- scroll[i]->set_step(1);
- const float byte_value = color.components[i] * 255.0;
- scroll[i]->set_max(next_power_of_2(MAX(255, byte_value)) - 1);
- scroll[i]->set_value(byte_value);
+ for (int i = 0; i < 4; i++) {
+ if (raw_mode_enabled) {
+ scroll[i]->set_step(0.01);
+ scroll[i]->set_max(100);
+ if (i == 3)
+ scroll[i]->set_max(1);
+ scroll[i]->set_value(color.components[i]);
+ } else {
+ scroll[i]->set_step(1);
+ const float byte_value = color.components[i] * 255.0;
+ scroll[i]->set_max(next_power_of_2(MAX(255, byte_value)) - 1);
+ scroll[i]->set_value(byte_value);
+ }
+ }
}
}
@@ -272,13 +324,33 @@ PoolColorArray ColorPicker::get_presets() const {
return arr;
}
+void ColorPicker::set_hsv_mode(bool p_enabled) {
+
+ if (hsv_mode_enabled == p_enabled || raw_mode_enabled)
+ return;
+ hsv_mode_enabled = p_enabled;
+ if (btn_hsv->is_pressed() != p_enabled)
+ btn_hsv->set_pressed(p_enabled);
+
+ if (!is_inside_tree())
+ return;
+
+ _update_controls();
+ _update_color();
+}
+
+bool ColorPicker::is_hsv_mode() const {
+
+ return hsv_mode_enabled;
+}
+
void ColorPicker::set_raw_mode(bool p_enabled) {
- if (raw_mode_enabled == p_enabled)
+ if (raw_mode_enabled == p_enabled || hsv_mode_enabled)
return;
raw_mode_enabled = p_enabled;
- if (btn_mode->is_pressed() != p_enabled)
- btn_mode->set_pressed(p_enabled);
+ if (btn_raw->is_pressed() != p_enabled)
+ btn_raw->set_pressed(p_enabled);
if (!is_inside_tree())
return;
@@ -592,6 +664,8 @@ void ColorPicker::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pick_color", "color"), &ColorPicker::set_pick_color);
ClassDB::bind_method(D_METHOD("get_pick_color"), &ColorPicker::get_pick_color);
+ ClassDB::bind_method(D_METHOD("set_hsv_mode", "mode"), &ColorPicker::set_hsv_mode);
+ ClassDB::bind_method(D_METHOD("is_hsv_mode"), &ColorPicker::is_hsv_mode);
ClassDB::bind_method(D_METHOD("set_raw_mode", "mode"), &ColorPicker::set_raw_mode);
ClassDB::bind_method(D_METHOD("is_raw_mode"), &ColorPicker::is_raw_mode);
ClassDB::bind_method(D_METHOD("set_deferred_mode", "mode"), &ColorPicker::set_deferred_mode);
@@ -623,6 +697,7 @@ void ColorPicker::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "color"), "set_pick_color", "get_pick_color");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "edit_alpha"), "set_edit_alpha", "is_editing_alpha");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "hsv_mode"), "set_hsv_mode", "is_hsv_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "raw_mode"), "set_raw_mode", "is_raw_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "deferred_mode"), "set_deferred_mode", "is_deferred_mode");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "presets_enabled"), "set_presets_enabled", "are_presets_enabled");
@@ -639,6 +714,7 @@ ColorPicker::ColorPicker() :
updating = true;
edit_alpha = true;
text_is_constructor = false;
+ hsv_mode_enabled = false;
raw_mode_enabled = false;
deferred_mode_enabled = false;
changing_color = false;
@@ -689,13 +765,12 @@ ColorPicker::ColorPicker() :
VBoxContainer *vbr = memnew(VBoxContainer);
add_child(vbr);
vbr->set_h_size_flags(SIZE_EXPAND_FILL);
- const char *lt[4] = { "R", "G", "B", "A" };
for (int i = 0; i < 4; i++) {
HBoxContainer *hbc = memnew(HBoxContainer);
- labels[i] = memnew(Label(lt[i]));
+ labels[i] = memnew(Label());
labels[i]->set_custom_minimum_size(Size2(get_constant("label_width"), 0));
labels[i]->set_v_size_flags(SIZE_SHRINK_CENTER);
hbc->add_child(labels[i]);
@@ -719,14 +794,20 @@ ColorPicker::ColorPicker() :
vbr->add_child(hbc);
}
+ labels[3]->set_text("A");
HBoxContainer *hhb = memnew(HBoxContainer);
vbr->add_child(hhb);
- btn_mode = memnew(CheckButton);
- hhb->add_child(btn_mode);
- btn_mode->set_text(TTR("Raw Mode"));
- btn_mode->connect("toggled", this, "set_raw_mode");
+ btn_hsv = memnew(CheckButton);
+ hhb->add_child(btn_hsv);
+ btn_hsv->set_text(TTR("HSV"));
+ btn_hsv->connect("toggled", this, "set_hsv_mode");
+
+ btn_raw = memnew(CheckButton);
+ hhb->add_child(btn_raw);
+ btn_raw->set_text(TTR("Raw"));
+ btn_raw->connect("toggled", this, "set_raw_mode");
text_type = memnew(Button);
hhb->add_child(text_type);
diff --git a/scene/gui/color_picker.h b/scene/gui/color_picker.h
index b5ddf2d0c2..3af27a9856 100644
--- a/scene/gui/color_picker.h
+++ b/scene/gui/color_picker.h
@@ -58,7 +58,8 @@ private:
Button *bt_add_preset;
List<Color> presets;
ToolButton *btn_pick;
- CheckButton *btn_mode;
+ CheckButton *btn_hsv;
+ CheckButton *btn_raw;
HSlider *scroll[4];
SpinBox *values[4];
Label *labels[4];
@@ -70,6 +71,7 @@ private:
Color color;
bool raw_mode_enabled;
+ bool hsv_mode_enabled;
bool deferred_mode_enabled;
bool updating;
bool changing_color;
@@ -81,7 +83,7 @@ private:
void _html_entered(const String &p_html);
void _value_changed(double);
void _update_controls();
- void _update_color();
+ void _update_color(bool p_update_sliders = true);
void _update_presets();
void _update_text_value();
void _text_type_toggled();
@@ -106,6 +108,7 @@ public:
void set_edit_alpha(bool p_show);
bool is_editing_alpha() const;
+ void _set_pick_color(const Color &p_color, bool p_update_sliders);
void set_pick_color(const Color &p_color);
Color get_pick_color() const;
@@ -113,6 +116,9 @@ public:
void erase_preset(const Color &p_color);
PoolColorArray get_presets() const;
+ void set_hsv_mode(bool p_enabled);
+ bool is_hsv_mode() const;
+
void set_raw_mode(bool p_enabled);
bool is_raw_mode() const;
diff --git a/scene/gui/color_rect.h b/scene/gui/color_rect.h
index d7f9ef275d..7a7bbe1029 100644
--- a/scene/gui/color_rect.h
+++ b/scene/gui/color_rect.h
@@ -34,7 +34,7 @@
#include "scene/gui/control.h"
class ColorRect : public Control {
- GDCLASS(ColorRect, Control)
+ GDCLASS(ColorRect, Control);
Color color;
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 9d7c08d3f3..0845b56828 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1749,6 +1749,9 @@ Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margi
void Control::_compute_anchors(Rect2 p_rect, const float p_margins[4], float (&r_anchors)[4]) {
Size2 parent_rect_size = get_parent_anchorable_rect().size;
+ ERR_FAIL_COND(parent_rect_size.x == 0.0);
+ ERR_FAIL_COND(parent_rect_size.y == 0.0);
+
r_anchors[0] = (p_rect.position.x - p_margins[0]) / parent_rect_size.x;
r_anchors[1] = (p_rect.position.y - p_margins[1]) / parent_rect_size.y;
r_anchors[2] = (p_rect.position.x + p_rect.size.x - p_margins[2]) / parent_rect_size.x;
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 89f3d509d0..4da11b671e 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -406,12 +406,20 @@ void AcceptDialog::set_hide_on_ok(bool p_hide) {
hide_on_ok = p_hide;
}
-
bool AcceptDialog::get_hide_on_ok() const {
return hide_on_ok;
}
+void AcceptDialog::set_autowrap(bool p_autowrap) {
+
+ label->set_autowrap(p_autowrap);
+}
+bool AcceptDialog::has_autowrap() {
+
+ return label->has_autowrap();
+}
+
void AcceptDialog::register_text_enter(Node *p_line_edit) {
ERR_FAIL_NULL(p_line_edit);
@@ -530,6 +538,8 @@ void AcceptDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("_custom_action"), &AcceptDialog::_custom_action);
ClassDB::bind_method(D_METHOD("set_text", "text"), &AcceptDialog::set_text);
ClassDB::bind_method(D_METHOD("get_text"), &AcceptDialog::get_text);
+ ClassDB::bind_method(D_METHOD("set_autowrap", "autowrap"), &AcceptDialog::set_autowrap);
+ ClassDB::bind_method(D_METHOD("has_autowrap"), &AcceptDialog::has_autowrap);
ADD_SIGNAL(MethodInfo("confirmed"));
ADD_SIGNAL(MethodInfo("custom_action", PropertyInfo(Variant::STRING, "action")));
@@ -537,6 +547,7 @@ void AcceptDialog::_bind_methods() {
ADD_GROUP("Dialog", "dialog");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "dialog_text", PROPERTY_HINT_MULTILINE_TEXT, "", PROPERTY_USAGE_DEFAULT_INTL), "set_text", "get_text");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dialog_hide_on_ok"), "set_hide_on_ok", "get_hide_on_ok");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "dialog_autowrap"), "set_autowrap", "has_autowrap");
}
bool AcceptDialog::swap_ok_cancel = false;
@@ -555,7 +566,6 @@ AcceptDialog::AcceptDialog() {
label->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
label->set_begin(Point2(margin, margin));
label->set_end(Point2(-margin, -button_margin - 10));
- //label->set_autowrap(true);
add_child(label);
hbc = memnew(HBoxContainer);
diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h
index 4b89ac54c5..c1a7f26a85 100644
--- a/scene/gui/dialogs.h
+++ b/scene/gui/dialogs.h
@@ -145,6 +145,9 @@ public:
void set_text(String p_text);
String get_text() const;
+ void set_autowrap(bool p_autowrap);
+ bool has_autowrap();
+
AcceptDialog();
~AcceptDialog();
};
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp
index 686d1c96cc..a7c15151ae 100644
--- a/scene/gui/scroll_bar.cpp
+++ b/scene/gui/scroll_bar.cpp
@@ -439,27 +439,26 @@ double ScrollBar::get_grabber_size() const {
}
double ScrollBar::get_area_size() const {
-
- if (orientation == VERTICAL) {
-
- double area = get_size().height;
- area -= get_stylebox("scroll")->get_minimum_size().height;
- area -= get_icon("increment")->get_height();
- area -= get_icon("decrement")->get_height();
- area -= get_grabber_min_size();
- return area;
-
- } else if (orientation == HORIZONTAL) {
-
- double area = get_size().width;
- area -= get_stylebox("scroll")->get_minimum_size().width;
- area -= get_icon("increment")->get_width();
- area -= get_icon("decrement")->get_width();
- area -= get_grabber_min_size();
- return area;
- } else {
-
- return 0;
+ switch (orientation) {
+ case VERTICAL: {
+ double area = get_size().height;
+ area -= get_stylebox("scroll")->get_minimum_size().height;
+ area -= get_icon("increment")->get_height();
+ area -= get_icon("decrement")->get_height();
+ area -= get_grabber_min_size();
+ return area;
+ } break;
+ case HORIZONTAL: {
+ double area = get_size().width;
+ area -= get_stylebox("scroll")->get_minimum_size().width;
+ area -= get_icon("increment")->get_width();
+ area -= get_icon("decrement")->get_width();
+ area -= get_grabber_min_size();
+ return area;
+ } break;
+ default: {
+ return 0.0;
+ }
}
}
diff --git a/scene/gui/split_container.h b/scene/gui/split_container.h
index 3c1ca09a9f..97838e19a3 100644
--- a/scene/gui/split_container.h
+++ b/scene/gui/split_container.h
@@ -35,7 +35,7 @@
class SplitContainer : public Container {
- GDCLASS(SplitContainer, Container)
+ GDCLASS(SplitContainer, Container);
public:
enum DraggerVisibility {
diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp
index 36571cc878..7b0836cd28 100644
--- a/scene/gui/tabs.cpp
+++ b/scene/gui/tabs.cpp
@@ -892,6 +892,8 @@ void Tabs::ensure_tab_visible(int p_idx) {
}
Rect2 Tabs::get_tab_rect(int p_tab) const {
+
+ ERR_FAIL_INDEX_V(p_tab, tabs.size(), Rect2());
return Rect2(tabs[p_tab].ofs_cache, 0, tabs[p_tab].size_cache, get_size().height);
}
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 36d7dad1d3..4e86e4bb1e 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -1178,7 +1178,7 @@ void TextEdit::_notification(int p_what) {
if (brace_open_mismatch)
color = cache.brace_mismatch_color;
- drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
if ((brace_close_match_line == line && brace_close_match_column == last_wrap_column + j) ||
@@ -1186,7 +1186,7 @@ void TextEdit::_notification(int p_what) {
if (brace_close_mismatch)
color = cache.brace_mismatch_color;
- drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), '_', str[j + 1], in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
}
@@ -1258,23 +1258,23 @@ void TextEdit::_notification(int p_what) {
if (str[j] >= 32) {
int yofs = ofs_y + (get_row_height() - cache.font->get_height()) / 2;
- int w = drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), str[j], str[j + 1], in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ int w = drawer.draw_char(ci, Point2i(char_ofs + char_margin + ofs_x, yofs + ascent), str[j], str[j + 1], in_selection && override_selected_font_color ? cache.font_color_selected : color);
if (underlined) {
float line_width = 1.0;
#ifdef TOOLS_ENABLED
line_width *= EDSCALE;
#endif
- draw_rect(Rect2(char_ofs + char_margin + ofs_x, yofs + ascent + 2, w, line_width), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ draw_rect(Rect2(char_ofs + char_margin + ofs_x, yofs + ascent + 2, w, line_width), in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
} else if (draw_tabs && str[j] == '\t') {
int yofs = (get_row_height() - cache.tab_icon->get_height()) / 2;
- cache.tab_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ cache.tab_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
if (draw_spaces && str[j] == ' ') {
int yofs = (get_row_height() - cache.space_icon->get_height()) / 2;
- cache.space_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_selected_color : color);
+ cache.space_icon->draw(ci, Point2(char_ofs + char_margin + ofs_x, ofs_y + yofs), in_selection && override_selected_font_color ? cache.font_color_selected : color);
}
char_ofs += char_w;
@@ -4554,7 +4554,7 @@ void TextEdit::_update_caches() {
cache.line_number_color = get_color("line_number_color");
cache.safe_line_number_color = get_color("safe_line_number_color");
cache.font_color = get_color("font_color");
- cache.font_selected_color = get_color("font_selected_color");
+ cache.font_color_selected = get_color("font_color_selected");
cache.keyword_color = get_color("keyword_color");
cache.function_color = get_color("function_color");
cache.member_variable_color = get_color("member_variable_color");
@@ -6452,6 +6452,7 @@ void TextEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_text"), &TextEdit::get_text);
ClassDB::bind_method(D_METHOD("get_line", "line"), &TextEdit::get_line);
+ ClassDB::bind_method(D_METHOD("center_viewport_to_cursor"), &TextEdit::center_viewport_to_cursor);
ClassDB::bind_method(D_METHOD("cursor_set_column", "column", "adjust_viewport"), &TextEdit::cursor_set_column, DEFVAL(true));
ClassDB::bind_method(D_METHOD("cursor_set_line", "line", "adjust_viewport", "can_be_hidden", "wrap_index"), &TextEdit::cursor_set_line, DEFVAL(true), DEFVAL(true), DEFVAL(0));
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 0c26602d2b..c721cf992e 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -40,7 +40,7 @@ class SyntaxHighlighter;
class TextEdit : public Control {
- GDCLASS(TextEdit, Control)
+ GDCLASS(TextEdit, Control);
public:
struct HighlighterInfo {
@@ -184,7 +184,7 @@ private:
Color line_number_color;
Color safe_line_number_color;
Color font_color;
- Color font_selected_color;
+ Color font_color_selected;
Color keyword_color;
Color number_color;
Color function_color;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 522c1ecb6a..5493879e55 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1128,6 +1128,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
for (int j = p_item->cells[i].buttons.size() - 1; j >= 0; j--) {
Ref<Texture> b = p_item->cells[i].buttons[j].texture;
Size2 s = b->get_size() + cache.button_pressed->get_minimum_size();
+ if (s.height < label_h)
+ s.height = label_h;
Point2i o = Point2i(ofs + w - s.width, p_pos.y) - cache.offset + p_draw_ofs;
@@ -3163,10 +3165,7 @@ bool Tree::is_anything_selected() {
void Tree::clear() {
- if (blocked > 0) {
-
- ERR_FAIL_COND(blocked > 0);
- }
+ ERR_FAIL_COND(blocked > 0);
if (pressing_for_editor) {
if (range_drag_enabled) {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index c02873cdeb..10e5ad78e2 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -172,14 +172,16 @@ ViewportTexture::~ViewportTexture() {
class TooltipPanel : public PanelContainer {
- GDCLASS(TooltipPanel, PanelContainer)
+ GDCLASS(TooltipPanel, PanelContainer);
+
public:
TooltipPanel(){};
};
class TooltipLabel : public Label {
- GDCLASS(TooltipLabel, Label)
+ GDCLASS(TooltipLabel, Label);
+
public:
TooltipLabel(){};
};
@@ -1442,9 +1444,7 @@ void Viewport::_gui_show_tooltip() {
return;
}
- Control *rp = which; //->get_root_parent_control();
- if (!rp)
- return;
+ Control *rp = which;
gui.tooltip_popup = which->make_custom_tooltip(tooltip);
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index e4da659b0d..1ca643cd7a 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -1425,7 +1425,9 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
TransformTrack *tt = static_cast<TransformTrack *>(t);
ERR_FAIL_INDEX(p_key_idx, tt->transforms.size());
+
Dictionary d = p_value;
+
if (d.has("location"))
tt->transforms.write[p_key_idx].value.loc = d["location"];
if (d.has("rotation"))
@@ -1438,6 +1440,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
ValueTrack *vt = static_cast<ValueTrack *>(t);
ERR_FAIL_INDEX(p_key_idx, vt->values.size());
+
vt->values.write[p_key_idx].value = p_value;
} break;
@@ -1445,11 +1448,14 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
MethodTrack *mt = static_cast<MethodTrack *>(t);
ERR_FAIL_INDEX(p_key_idx, mt->methods.size());
+
Dictionary d = p_value;
+
if (d.has("method"))
mt->methods.write[p_key_idx].method = d["method"];
if (d.has("args"))
mt->methods.write[p_key_idx].params = d["args"];
+
} break;
case TYPE_BEZIER: {
@@ -1469,6 +1475,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
case TYPE_AUDIO: {
AudioTrack *at = static_cast<AudioTrack *>(t);
+ ERR_FAIL_INDEX(p_key_idx, at->values.size());
Dictionary k = p_value;
ERR_FAIL_COND(!k.has("start_offset"));
@@ -1483,6 +1490,7 @@ void Animation::track_set_key_value(int p_track, int p_key_idx, const Variant &p
case TYPE_ANIMATION: {
AnimationTrack *at = static_cast<AnimationTrack *>(t);
+ ERR_FAIL_INDEX(p_key_idx, at->values.size());
at->values.write[p_key_idx].value = p_value;
diff --git a/scene/resources/audio_stream_sample.h b/scene/resources/audio_stream_sample.h
index d4c5511f34..bb25b60835 100644
--- a/scene/resources/audio_stream_sample.h
+++ b/scene/resources/audio_stream_sample.h
@@ -37,7 +37,7 @@ class AudioStreamSample;
class AudioStreamPlaybackSample : public AudioStreamPlayback {
- GDCLASS(AudioStreamPlaybackSample, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackSample, AudioStreamPlayback);
enum {
MIX_FRAC_BITS = 13,
MIX_FRAC_LEN = (1 << MIX_FRAC_BITS),
@@ -81,7 +81,7 @@ public:
};
class AudioStreamSample : public AudioStream {
- GDCLASS(AudioStreamSample, AudioStream)
+ GDCLASS(AudioStreamSample, AudioStream);
RES_BASE_EXTENSION("sample")
public:
diff --git a/scene/resources/curve.cpp b/scene/resources/curve.cpp
index 950518aa6e..cb710dde43 100644
--- a/scene/resources/curve.cpp
+++ b/scene/resources/curve.cpp
@@ -51,6 +51,7 @@ Curve::Curve() {
_baked_cache_dirty = false;
_min_value = 0;
_max_value = 1;
+ _minmax_set_once = 0b00;
}
int Curve::add_point(Vector2 p_pos, real_t left_tangent, real_t right_tangent, TangentMode left_mode, TangentMode right_mode) {
@@ -282,20 +283,24 @@ void Curve::update_auto_tangents(int i) {
#define MIN_Y_RANGE 0.01
void Curve::set_min_value(float p_min) {
- if (p_min > _max_value - MIN_Y_RANGE)
+ if (_minmax_set_once & 0b11 && p_min > _max_value - MIN_Y_RANGE) {
_min_value = _max_value - MIN_Y_RANGE;
- else
+ } else {
+ _minmax_set_once |= 0b10; // first bit is "min set"
_min_value = p_min;
+ }
// Note: min and max are indicative values,
// it's still possible that existing points are out of range at this point.
emit_signal(SIGNAL_RANGE_CHANGED);
}
void Curve::set_max_value(float p_max) {
- if (p_max < _min_value + MIN_Y_RANGE)
+ if (_minmax_set_once & 0b11 && p_max < _min_value + MIN_Y_RANGE) {
_max_value = _min_value + MIN_Y_RANGE;
- else
+ } else {
+ _minmax_set_once |= 0b01; // second bit is "max set"
_max_value = p_max;
+ }
emit_signal(SIGNAL_RANGE_CHANGED);
}
diff --git a/scene/resources/curve.h b/scene/resources/curve.h
index 911a440567..b677097e86 100644
--- a/scene/resources/curve.h
+++ b/scene/resources/curve.h
@@ -35,7 +35,8 @@
// y(x) curve
class Curve : public Resource {
- GDCLASS(Curve, Resource)
+ GDCLASS(Curve, Resource);
+
public:
static const int MIN_X = 0.f;
static const int MAX_X = 1.f;
@@ -142,6 +143,7 @@ private:
int _bake_resolution;
float _min_value;
float _max_value;
+ int _minmax_set_once; // Encodes whether min and max have been set a first time, first bit for min and second for max.
};
VARIANT_ENUM_CAST(Curve::TangentMode)
diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h
index 887c7b42c8..d0a709a2d3 100644
--- a/scene/resources/dynamic_font.h
+++ b/scene/resources/dynamic_font.h
@@ -110,7 +110,7 @@ VARIANT_ENUM_CAST(DynamicFontData::Hinting);
class DynamicFontAtSize : public Reference {
- GDCLASS(DynamicFontAtSize, Reference)
+ GDCLASS(DynamicFontAtSize, Reference);
_THREAD_SAFE_CLASS_
@@ -303,7 +303,6 @@ VARIANT_ENUM_CAST(DynamicFont::SpacingType);
/////////////
class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderDynamicFont, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/scene/resources/dynamic_font_stb.h b/scene/resources/dynamic_font_stb.h
index 4c98487600..caee6e7e32 100644
--- a/scene/resources/dynamic_font_stb.h
+++ b/scene/resources/dynamic_font_stb.h
@@ -180,7 +180,6 @@ public:
/////////////
class ResourceFormatLoaderDynamicFont : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderDynamicFont, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/scene/resources/font.h b/scene/resources/font.h
index def2c2285a..436ed43c42 100644
--- a/scene/resources/font.h
+++ b/scene/resources/font.h
@@ -202,7 +202,6 @@ public:
};
class ResourceFormatLoaderBMFont : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderBMFont, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
diff --git a/scene/resources/gradient.cpp b/scene/resources/gradient.cpp
index 99ce8ef821..1ff02c2f82 100644
--- a/scene/resources/gradient.cpp
+++ b/scene/resources/gradient.cpp
@@ -143,6 +143,8 @@ void Gradient::set_points(Vector<Gradient::Point> &p_points) {
}
void Gradient::set_offset(int pos, const float offset) {
+
+ ERR_FAIL_COND(pos < 0);
if (points.size() <= pos)
points.resize(pos + 1);
points.write[pos].offset = offset;
@@ -151,12 +153,12 @@ void Gradient::set_offset(int pos, const float offset) {
}
float Gradient::get_offset(int pos) const {
- if (points.size() && points.size() > pos)
- return points[pos].offset;
- return 0; //TODO: Maybe throw some error instead?
+ ERR_FAIL_INDEX_V(pos, points.size(), 0.0);
+ return points[pos].offset;
}
void Gradient::set_color(int pos, const Color &color) {
+ ERR_FAIL_COND(pos < 0);
if (points.size() <= pos) {
points.resize(pos + 1);
is_sorted = false;
@@ -166,9 +168,8 @@ void Gradient::set_color(int pos, const Color &color) {
}
Color Gradient::get_color(int pos) const {
- if (points.size() && points.size() > pos)
- return points[pos].color;
- return Color(0, 0, 0, 1); //TODO: Maybe throw some error instead?
+ ERR_FAIL_INDEX_V(pos, points.size(), Color());
+ return points[pos].color;
}
int Gradient::get_points_count() const {
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 6dec4a0c49..197ff14b38 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -2353,8 +2353,8 @@ SpatialMaterial::SpatialMaterial() :
set_ao_light_affect(0.0);
- set_metallic_texture_channel(TEXTURE_CHANNEL_RED);
- set_roughness_texture_channel(TEXTURE_CHANNEL_RED);
+ set_metallic_texture_channel(TEXTURE_CHANNEL_BLUE);
+ set_roughness_texture_channel(TEXTURE_CHANNEL_GREEN);
set_ao_texture_channel(TEXTURE_CHANNEL_RED);
set_refraction_texture_channel(TEXTURE_CHANNEL_RED);
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 29b45f769b..17e52527b3 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -43,7 +43,7 @@
class Material : public Resource {
- GDCLASS(Material, Resource)
+ GDCLASS(Material, Resource);
RES_BASE_EXTENSION("material")
OBJ_SAVE_TYPE(Material)
@@ -111,7 +111,7 @@ public:
class SpatialMaterial : public Material {
- GDCLASS(SpatialMaterial, Material)
+ GDCLASS(SpatialMaterial, Material);
public:
enum TextureParam {
diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp
index 758475b75e..a80a57a09c 100644
--- a/scene/resources/particles_material.cpp
+++ b/scene/resources/particles_material.cpp
@@ -1202,6 +1202,7 @@ ParticlesMaterial::ParticlesMaterial() :
set_spread(45);
set_flatness(0);
set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
+ set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
set_param(PARAM_LINEAR_ACCEL, 0);
set_param(PARAM_RADIAL_ACCEL, 0);
diff --git a/scene/resources/particles_material.h b/scene/resources/particles_material.h
index 8b3248a9cb..42bf60ff48 100644
--- a/scene/resources/particles_material.h
+++ b/scene/resources/particles_material.h
@@ -36,7 +36,7 @@
class ParticlesMaterial : public Material {
- GDCLASS(ParticlesMaterial, Material)
+ GDCLASS(ParticlesMaterial, Material);
public:
enum Parameter {
diff --git a/scene/resources/primitive_meshes.h b/scene/resources/primitive_meshes.h
index 0045a48736..312899c028 100644
--- a/scene/resources/primitive_meshes.h
+++ b/scene/resources/primitive_meshes.h
@@ -269,7 +269,7 @@ public:
class QuadMesh : public PrimitiveMesh {
- GDCLASS(QuadMesh, PrimitiveMesh)
+ GDCLASS(QuadMesh, PrimitiveMesh);
private:
Size2 size;
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 0921c0dae9..efc1082a6b 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -1225,10 +1225,7 @@ Ref<ResourceInteractiveLoader> ResourceFormatLoaderText::load_interactive(const
Error err;
FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err);
- if (err != OK) {
-
- ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
- }
+ ERR_FAIL_COND_V(err != OK, Ref<ResourceInteractiveLoader>());
Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
String path = p_original_path != "" ? p_original_path : p_path;
@@ -1324,10 +1321,7 @@ Error ResourceFormatLoaderText::convert_file_to_binary(const String &p_src_path,
Error err;
FileAccess *f = FileAccess::open(p_src_path, FileAccess::READ, &err);
- if (err != OK) {
-
- ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN);
- }
+ ERR_FAIL_COND_V(err != OK, ERR_CANT_OPEN);
Ref<ResourceInteractiveLoaderText> ria = memnew(ResourceInteractiveLoaderText);
String path = p_src_path;
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index 06c841229b..0041989f09 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -128,7 +128,6 @@ public:
};
class ResourceFormatLoaderText : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderText, ResourceFormatLoader)
public:
static ResourceFormatLoaderText *singleton;
virtual Ref<ResourceInteractiveLoader> load_interactive(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
@@ -187,7 +186,6 @@ public:
};
class ResourceFormatSaverText : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverText, ResourceFormatSaver)
public:
static ResourceFormatSaverText *singleton;
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
diff --git a/scene/resources/shader.h b/scene/resources/shader.h
index fb493046fc..6e7447839f 100644
--- a/scene/resources/shader.h
+++ b/scene/resources/shader.h
@@ -100,7 +100,6 @@ public:
VARIANT_ENUM_CAST(Shader::Mode);
class ResourceFormatLoaderShader : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderShader, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -109,7 +108,6 @@ public:
};
class ResourceFormatSaverShader : public ResourceFormatSaver {
- GDCLASS(ResourceFormatSaverShader, ResourceFormatSaver)
public:
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
diff --git a/scene/resources/text_file.h b/scene/resources/text_file.h
index 91bb98a3b1..7127eaeb93 100644
--- a/scene/resources/text_file.h
+++ b/scene/resources/text_file.h
@@ -36,7 +36,7 @@
class TextFile : public Resource {
- GDCLASS(TextFile, Resource)
+ GDCLASS(TextFile, Resource);
private:
String text;
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index 6e0bc43296..3a0144849a 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -1502,6 +1502,7 @@ void CubeMap::set_side(Side p_side, const Ref<Image> &p_image) {
Ref<Image> CubeMap::get_side(Side p_side) const {
+ ERR_FAIL_INDEX_V(p_side, 6, Ref<Image>());
if (!valid[p_side])
return Ref<Image>();
return VS::get_singleton()->texture_get_data(cubemap, VS::CubeMapSide(p_side));
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 021673f072..eb7a9ff25c 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -239,7 +239,6 @@ public:
};
class ResourceFormatLoaderStreamTexture : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderStreamTexture, ResourceFormatLoader)
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -470,7 +469,7 @@ VARIANT_ENUM_CAST(CubeMap::Storage)
class TextureLayered : public Resource {
- GDCLASS(TextureLayered, Resource)
+ GDCLASS(TextureLayered, Resource);
public:
enum Flags {
@@ -522,7 +521,8 @@ VARIANT_ENUM_CAST(TextureLayered::Flags)
class Texture3D : public TextureLayered {
- GDCLASS(Texture3D, TextureLayered)
+ GDCLASS(Texture3D, TextureLayered);
+
public:
Texture3D() :
TextureLayered(true) {}
@@ -530,14 +530,14 @@ public:
class TextureArray : public TextureLayered {
- GDCLASS(TextureArray, TextureLayered)
+ GDCLASS(TextureArray, TextureLayered);
+
public:
TextureArray() :
TextureLayered(false) {}
};
class ResourceFormatLoaderTextureLayered : public ResourceFormatLoader {
- GDCLASS(ResourceFormatLoaderTextureLayered, ResourceFormatLoader)
public:
enum Compression {
COMPRESSION_LOSSLESS,
@@ -553,7 +553,7 @@ public:
class CurveTexture : public Texture {
- GDCLASS(CurveTexture, Texture)
+ GDCLASS(CurveTexture, Texture);
RES_BASE_EXTENSION("curvetex")
private:
@@ -601,7 +601,7 @@ public:
//VARIANT_ENUM_CAST( Texture::CubeMapSide );
class GradientTexture : public Texture {
- GDCLASS(GradientTexture, Texture)
+ GDCLASS(GradientTexture, Texture);
public:
struct Point {
@@ -646,7 +646,7 @@ public:
};
class ProxyTexture : public Texture {
- GDCLASS(ProxyTexture, Texture)
+ GDCLASS(ProxyTexture, Texture);
private:
RID proxy;
@@ -673,7 +673,7 @@ public:
};
class AnimatedTexture : public Texture {
- GDCLASS(AnimatedTexture, Texture)
+ GDCLASS(AnimatedTexture, Texture);
//use readers writers lock for this, since its far more times read than written to
RWLock *rw_lock;
@@ -742,7 +742,7 @@ public:
};
class CameraTexture : public Texture {
- GDCLASS(CameraTexture, Texture)
+ GDCLASS(CameraTexture, Texture);
private:
int camera_feed_id;
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index d09fac47f0..899abfc9f9 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -692,6 +692,8 @@ String TileSet::tile_get_name(int p_id) const {
}
void TileSet::tile_clear_shapes(int p_id) {
+
+ ERR_FAIL_COND(!tile_map.has(p_id));
tile_map[p_id].shapes_data.clear();
}
@@ -711,14 +713,15 @@ void TileSet::tile_add_shape(int p_id, const Ref<Shape2D> &p_shape, const Transf
int TileSet::tile_get_shape_count(int p_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
-
return tile_map[p_id].shapes_data.size();
}
void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_shape) {
ERR_FAIL_COND(!tile_map.has(p_id));
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ ERR_FAIL_COND(p_shape_id < 0);
+
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].shape = p_shape;
_decompose_convex_shape(p_shape);
@@ -728,7 +731,7 @@ void TileSet::tile_set_shape(int p_id, int p_shape_id, const Ref<Shape2D> &p_sha
Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<Shape2D>());
- if (tile_map[p_id].shapes_data.size() > p_shape_id)
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
return tile_map[p_id].shapes_data[p_shape_id].shape;
return Ref<Shape2D>();
@@ -737,7 +740,8 @@ Ref<Shape2D> TileSet::tile_get_shape(int p_id, int p_shape_id) const {
void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform2D &p_offset) {
ERR_FAIL_COND(!tile_map.has(p_id));
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].shape_transform = p_offset;
emit_changed();
@@ -746,7 +750,7 @@ void TileSet::tile_set_shape_transform(int p_id, int p_shape_id, const Transform
Transform2D TileSet::tile_get_shape_transform(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), Transform2D());
- if (tile_map[p_id].shapes_data.size() > p_shape_id)
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
return tile_map[p_id].shapes_data[p_shape_id].shape_transform;
return Transform2D();
@@ -765,7 +769,9 @@ Vector2 TileSet::tile_get_shape_offset(int p_id, int p_shape_id) const {
void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_way) {
ERR_FAIL_COND(!tile_map.has(p_id));
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ ERR_FAIL_COND(p_shape_id < 0);
+
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].one_way_collision = p_one_way;
emit_changed();
@@ -774,23 +780,27 @@ void TileSet::tile_set_shape_one_way(int p_id, int p_shape_id, const bool p_one_
bool TileSet::tile_get_shape_one_way(int p_id, int p_shape_id) const {
ERR_FAIL_COND_V(!tile_map.has(p_id), false);
- if (tile_map[p_id].shapes_data.size() > p_shape_id)
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
return tile_map[p_id].shapes_data[p_shape_id].one_way_collision;
return false;
}
void TileSet::tile_set_shape_one_way_margin(int p_id, int p_shape_id, float p_margin) {
+
ERR_FAIL_COND(!tile_map.has(p_id));
- if (tile_map[p_id].shapes_data.size() <= p_shape_id)
+ ERR_FAIL_COND(p_shape_id < 0);
+
+ if (p_shape_id >= tile_map[p_id].shapes_data.size())
tile_map[p_id].shapes_data.resize(p_shape_id + 1);
tile_map[p_id].shapes_data.write[p_shape_id].one_way_collision_margin = p_margin;
emit_changed();
}
float TileSet::tile_get_shape_one_way_margin(int p_id, int p_shape_id) const {
+
ERR_FAIL_COND_V(!tile_map.has(p_id), 0);
- if (tile_map[p_id].shapes_data.size() > p_shape_id)
+ if (p_shape_id < tile_map[p_id].shapes_data.size())
return tile_map[p_id].shapes_data[p_shape_id].one_way_collision_margin;
return 0;
@@ -820,7 +830,9 @@ void TileSet::autotile_set_light_occluder(int p_id, const Ref<OccluderPolygon2D>
}
Ref<OccluderPolygon2D> TileSet::autotile_get_light_occluder(int p_id, const Vector2 &p_coord) const {
+
ERR_FAIL_COND_V(!tile_map.has(p_id), Ref<OccluderPolygon2D>());
+
if (!tile_map[p_id].autotile_data.occluder_map.has(p_coord)) {
return Ref<OccluderPolygon2D>();
} else {
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index dd595d9ff8..a3813f8fc6 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -1762,6 +1762,7 @@ void VisualShaderNodeGroupBase::set_inputs(const String &p_inputs) {
for (int i = 0; i < input_port_count; i++) {
Vector<String> arr = input_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
int port_idx = arr[0].to_int();
int port_type = arr[1].to_int();
@@ -1794,6 +1795,7 @@ void VisualShaderNodeGroupBase::set_outputs(const String &p_outputs) {
for (int i = 0; i < output_port_count; i++) {
Vector<String> arr = output_strings[i].split(",");
+ ERR_FAIL_COND(arr.size() != 3);
int port_idx = arr[0].to_int();
int port_type = arr[1].to_int();
@@ -1810,6 +1812,23 @@ String VisualShaderNodeGroupBase::get_outputs() const {
return outputs;
}
+bool VisualShaderNodeGroupBase::is_valid_port_name(const String &p_name) const {
+ if (!p_name.is_valid_identifier()) {
+ return false;
+ }
+ for (int i = 0; i < get_input_port_count(); i++) {
+ if (get_input_port_name(i) == p_name) {
+ return false;
+ }
+ }
+ for (int i = 0; i < get_output_port_count(); i++) {
+ if (get_output_port_name(i) == p_name) {
+ return false;
+ }
+ }
+ return true;
+}
+
void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const String &p_name) {
String str = itos(p_id) + "," + itos(p_type) + "," + p_name + ";";
@@ -1849,6 +1868,8 @@ void VisualShaderNodeGroupBase::add_input_port(int p_id, int p_type, const Strin
void VisualShaderNodeGroupBase::remove_input_port(int p_id) {
+ ERR_FAIL_COND(!has_input_port(p_id));
+
Vector<String> inputs_strings = inputs.split(";", false);
int count = 0;
int index = 0;
@@ -1917,6 +1938,8 @@ void VisualShaderNodeGroupBase::add_output_port(int p_id, int p_type, const Stri
void VisualShaderNodeGroupBase::remove_output_port(int p_id) {
+ ERR_FAIL_COND(!has_output_port(p_id));
+
Vector<String> outputs_strings = outputs.split(";", false);
int count = 0;
int index = 0;
@@ -1956,6 +1979,9 @@ void VisualShaderNodeGroupBase::clear_output_ports() {
void VisualShaderNodeGroupBase::set_input_port_type(int p_id, int p_type) {
+ ERR_FAIL_COND(!has_input_port(p_id));
+ ERR_FAIL_COND(p_type < 0 || p_type > PORT_TYPE_TRANSFORM);
+
if (input_ports[p_id].type == p_type)
return;
@@ -1986,6 +2012,9 @@ VisualShaderNodeGroupBase::PortType VisualShaderNodeGroupBase::get_input_port_ty
void VisualShaderNodeGroupBase::set_input_port_name(int p_id, const String &p_name) {
+ ERR_FAIL_COND(!has_input_port(p_id));
+ ERR_FAIL_COND(!is_valid_port_name(p_name));
+
if (input_ports[p_id].name == p_name)
return;
@@ -2016,6 +2045,9 @@ String VisualShaderNodeGroupBase::get_input_port_name(int p_id) const {
void VisualShaderNodeGroupBase::set_output_port_type(int p_id, int p_type) {
+ ERR_FAIL_COND(!has_output_port(p_id));
+ ERR_FAIL_COND(p_type < 0 || p_type > PORT_TYPE_TRANSFORM);
+
if (output_ports[p_id].type == p_type)
return;
@@ -2045,6 +2077,10 @@ VisualShaderNodeGroupBase::PortType VisualShaderNodeGroupBase::get_output_port_t
}
void VisualShaderNodeGroupBase::set_output_port_name(int p_id, const String &p_name) {
+
+ ERR_FAIL_COND(!has_output_port(p_id));
+ ERR_FAIL_COND(!is_valid_port_name(p_name));
+
if (output_ports[p_id].name == p_name)
return;
@@ -2125,6 +2161,8 @@ void VisualShaderNodeGroupBase::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_outputs", "outputs"), &VisualShaderNodeGroupBase::set_outputs);
ClassDB::bind_method(D_METHOD("get_outputs"), &VisualShaderNodeGroupBase::get_outputs);
+ ClassDB::bind_method(D_METHOD("is_valid_port_name", "name"), &VisualShaderNodeGroupBase::is_valid_port_name);
+
ClassDB::bind_method(D_METHOD("add_input_port", "id", "type", "name"), &VisualShaderNodeGroupBase::add_input_port);
ClassDB::bind_method(D_METHOD("remove_input_port", "id"), &VisualShaderNodeGroupBase::remove_input_port);
ClassDB::bind_method(D_METHOD("get_input_port_count"), &VisualShaderNodeGroupBase::get_input_port_count);
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index 838c2c618d..a36776e701 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -39,7 +39,8 @@ class VisualShaderNodeUniform;
class VisualShaderNode;
class VisualShader : public Shader {
- GDCLASS(VisualShader, Shader)
+ GDCLASS(VisualShader, Shader);
+
public:
enum Type {
TYPE_VERTEX,
@@ -163,7 +164,7 @@ VARIANT_ENUM_CAST(VisualShader::Type)
///
class VisualShaderNode : public Resource {
- GDCLASS(VisualShaderNode, Resource)
+ GDCLASS(VisualShaderNode, Resource);
int port_preview;
@@ -215,7 +216,7 @@ public:
/////
class VisualShaderNodeInput : public VisualShaderNode {
- GDCLASS(VisualShaderNodeInput, VisualShaderNode)
+ GDCLASS(VisualShaderNodeInput, VisualShaderNode);
friend class VisualShader;
VisualShader::Type shader_type;
@@ -268,7 +269,8 @@ public:
///
class VisualShaderNodeOutput : public VisualShaderNode {
- GDCLASS(VisualShaderNodeOutput, VisualShaderNode)
+ GDCLASS(VisualShaderNodeOutput, VisualShaderNode);
+
public:
friend class VisualShader;
VisualShader::Type shader_type;
@@ -304,7 +306,7 @@ public:
};
class VisualShaderNodeUniform : public VisualShaderNode {
- GDCLASS(VisualShaderNodeUniform, VisualShaderNode)
+ GDCLASS(VisualShaderNodeUniform, VisualShaderNode);
String uniform_name;
@@ -319,7 +321,8 @@ public:
};
class VisualShaderNodeGroupBase : public VisualShaderNode {
- GDCLASS(VisualShaderNodeGroupBase, VisualShaderNode)
+ GDCLASS(VisualShaderNodeGroupBase, VisualShaderNode);
+
private:
void _apply_port_changes();
@@ -352,6 +355,8 @@ public:
void set_outputs(const String &p_outputs);
String get_outputs() const;
+ bool is_valid_port_name(const String &p_name) const;
+
void add_input_port(int p_id, int p_type, const String &p_name);
void remove_input_port(int p_id);
virtual int get_input_port_count() const;
@@ -386,7 +391,7 @@ public:
};
class VisualShaderNodeExpression : public VisualShaderNodeGroupBase {
- GDCLASS(VisualShaderNodeExpression, VisualShaderNodeGroupBase)
+ GDCLASS(VisualShaderNodeExpression, VisualShaderNodeGroupBase);
private:
String expression;
diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h
index 852248b9b4..df753276e4 100644
--- a/scene/resources/visual_shader_nodes.h
+++ b/scene/resources/visual_shader_nodes.h
@@ -38,7 +38,7 @@
///////////////////////////////////////
class VisualShaderNodeScalarConstant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarConstant, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarConstant, VisualShaderNode);
float constant;
protected:
@@ -68,7 +68,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeBooleanConstant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeBooleanConstant, VisualShaderNode)
+ GDCLASS(VisualShaderNodeBooleanConstant, VisualShaderNode);
bool constant;
protected:
@@ -98,7 +98,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeColorConstant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeColorConstant, VisualShaderNode)
+ GDCLASS(VisualShaderNodeColorConstant, VisualShaderNode);
Color constant;
protected:
@@ -128,7 +128,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVec3Constant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVec3Constant, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVec3Constant, VisualShaderNode);
Vector3 constant;
protected:
@@ -158,7 +158,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeTransformConstant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTransformConstant, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTransformConstant, VisualShaderNode);
Transform constant;
protected:
@@ -190,7 +190,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeTexture : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTexture, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTexture, VisualShaderNode);
Ref<Texture> texture;
public:
@@ -251,7 +251,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeTexture::Source)
///////////////////////////////////////
class VisualShaderNodeCubeMap : public VisualShaderNode {
- GDCLASS(VisualShaderNodeCubeMap, VisualShaderNode)
+ GDCLASS(VisualShaderNodeCubeMap, VisualShaderNode);
Ref<CubeMap> cube_map;
public:
@@ -300,7 +300,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeCubeMap::TextureType)
///////////////////////////////////////
class VisualShaderNodeScalarOp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarOp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarOp, VisualShaderNode);
public:
enum Operator {
@@ -345,7 +345,7 @@ public:
VARIANT_ENUM_CAST(VisualShaderNodeScalarOp::Operator)
class VisualShaderNodeVectorOp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorOp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorOp, VisualShaderNode);
public:
enum Operator {
@@ -394,7 +394,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeVectorOp::Operator)
///////////////////////////////////////
class VisualShaderNodeColorOp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeColorOp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeColorOp, VisualShaderNode);
public:
enum Operator {
@@ -442,7 +442,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeColorOp::Operator)
///////////////////////////////////////
class VisualShaderNodeTransformMult : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTransformMult, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTransformMult, VisualShaderNode);
public:
enum Operator {
@@ -485,7 +485,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeTransformMult::Operator)
///////////////////////////////////////
class VisualShaderNodeTransformVecMult : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTransformVecMult, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTransformVecMult, VisualShaderNode);
public:
enum Operator {
@@ -528,7 +528,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeTransformVecMult::Operator)
///////////////////////////////////////
class VisualShaderNodeScalarFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarFunc, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarFunc, VisualShaderNode);
public:
enum Function {
@@ -599,7 +599,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeScalarFunc::Function)
///////////////////////////////////////
class VisualShaderNodeVectorFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorFunc, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorFunc, VisualShaderNode);
public:
enum Function {
@@ -673,7 +673,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeVectorFunc::Function)
///////////////////////////////////////
class VisualShaderNodeColorFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeColorFunc, VisualShaderNode)
+ GDCLASS(VisualShaderNodeColorFunc, VisualShaderNode);
public:
enum Function {
@@ -714,7 +714,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeColorFunc::Function)
///////////////////////////////////////
class VisualShaderNodeTransformFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTransformFunc, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTransformFunc, VisualShaderNode);
public:
enum Function {
@@ -755,7 +755,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeTransformFunc::Function)
///////////////////////////////////////
class VisualShaderNodeDotProduct : public VisualShaderNode {
- GDCLASS(VisualShaderNodeDotProduct, VisualShaderNode)
+ GDCLASS(VisualShaderNodeDotProduct, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -778,7 +778,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorLen : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorLen, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorLen, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -801,7 +801,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeDeterminant : public VisualShaderNode {
- GDCLASS(VisualShaderNodeDeterminant, VisualShaderNode)
+ GDCLASS(VisualShaderNodeDeterminant, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -824,7 +824,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeScalarClamp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarClamp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarClamp, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -845,7 +845,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorClamp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorClamp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorClamp, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -868,7 +868,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeScalarDerivativeFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarDerivativeFunc, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarDerivativeFunc, VisualShaderNode);
public:
enum Function {
@@ -908,7 +908,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeScalarDerivativeFunc::Function)
///////////////////////////////////////
class VisualShaderNodeVectorDerivativeFunc : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorDerivativeFunc, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorDerivativeFunc, VisualShaderNode);
public:
enum Function {
@@ -950,7 +950,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeVectorDerivativeFunc::Function)
///////////////////////////////////////
class VisualShaderNodeFaceForward : public VisualShaderNode {
- GDCLASS(VisualShaderNodeFaceForward, VisualShaderNode)
+ GDCLASS(VisualShaderNodeFaceForward, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -973,7 +973,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeOuterProduct : public VisualShaderNode {
- GDCLASS(VisualShaderNodeOuterProduct, VisualShaderNode)
+ GDCLASS(VisualShaderNodeOuterProduct, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -996,7 +996,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorScalarStep : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorScalarStep, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorScalarStep, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1019,7 +1019,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeScalarSmoothStep : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarSmoothStep, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarSmoothStep, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1040,7 +1040,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorSmoothStep : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorSmoothStep, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorSmoothStep, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1061,7 +1061,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorScalarSmoothStep : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorScalarSmoothStep, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorScalarSmoothStep, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1084,7 +1084,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorDistance : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorDistance, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorDistance, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1107,7 +1107,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorRefract : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorRefract, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorRefract, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1130,7 +1130,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeScalarInterp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeScalarInterp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeScalarInterp, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1151,7 +1151,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorInterp : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorInterp, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorInterp, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1174,7 +1174,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorCompose : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorCompose, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorCompose, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1195,7 +1195,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeTransformCompose : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTransformCompose, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTransformCompose, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1218,7 +1218,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVectorDecompose : public VisualShaderNode {
- GDCLASS(VisualShaderNodeVectorDecompose, VisualShaderNode)
+ GDCLASS(VisualShaderNodeVectorDecompose, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1239,7 +1239,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeTransformDecompose : public VisualShaderNode {
- GDCLASS(VisualShaderNodeTransformDecompose, VisualShaderNode)
+ GDCLASS(VisualShaderNodeTransformDecompose, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1262,7 +1262,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeScalarUniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeScalarUniform, VisualShaderNodeUniform)
+ GDCLASS(VisualShaderNodeScalarUniform, VisualShaderNodeUniform);
public:
virtual String get_caption() const;
@@ -1284,7 +1284,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeBooleanUniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeBooleanUniform, VisualShaderNodeUniform)
+ GDCLASS(VisualShaderNodeBooleanUniform, VisualShaderNodeUniform);
public:
virtual String get_caption() const;
@@ -1306,7 +1306,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeColorUniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeColorUniform, VisualShaderNodeUniform)
+ GDCLASS(VisualShaderNodeColorUniform, VisualShaderNodeUniform);
public:
virtual String get_caption() const;
@@ -1328,7 +1328,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeVec3Uniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeVec3Uniform, VisualShaderNodeUniform)
+ GDCLASS(VisualShaderNodeVec3Uniform, VisualShaderNodeUniform);
public:
virtual String get_caption() const;
@@ -1350,7 +1350,7 @@ public:
///////////////////////////////////////
class VisualShaderNodeTransformUniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeTransformUniform, VisualShaderNodeUniform)
+ GDCLASS(VisualShaderNodeTransformUniform, VisualShaderNodeUniform);
public:
virtual String get_caption() const;
@@ -1372,7 +1372,8 @@ public:
///////////////////////////////////////
class VisualShaderNodeTextureUniform : public VisualShaderNodeUniform {
- GDCLASS(VisualShaderNodeTextureUniform, VisualShaderNodeUniform)
+ GDCLASS(VisualShaderNodeTextureUniform, VisualShaderNodeUniform);
+
public:
enum TextureType {
TYPE_DATA,
@@ -1424,7 +1425,7 @@ VARIANT_ENUM_CAST(VisualShaderNodeTextureUniform::ColorDefault)
///////////////////////////////////////
class VisualShaderNodeCubeMapUniform : public VisualShaderNode {
- GDCLASS(VisualShaderNodeCubeMapUniform, VisualShaderNode)
+ GDCLASS(VisualShaderNodeCubeMapUniform, VisualShaderNode);
public:
virtual String get_caption() const;
@@ -1447,7 +1448,8 @@ public:
///////////////////////////////////////
class VisualShaderNodeIf : public VisualShaderNode {
- GDCLASS(VisualShaderNodeIf, VisualShaderNode)
+ GDCLASS(VisualShaderNodeIf, VisualShaderNode);
+
public:
virtual String get_caption() const;
@@ -1469,7 +1471,8 @@ public:
///////////////////////////////////////
class VisualShaderNodeSwitch : public VisualShaderNode {
- GDCLASS(VisualShaderNodeSwitch, VisualShaderNode)
+ GDCLASS(VisualShaderNodeSwitch, VisualShaderNode);
+
public:
virtual String get_caption() const;
@@ -1491,7 +1494,8 @@ public:
///////////////////////////////////////
class VisualShaderNodeFresnel : public VisualShaderNode {
- GDCLASS(VisualShaderNodeFresnel, VisualShaderNode)
+ GDCLASS(VisualShaderNodeFresnel, VisualShaderNode);
+
public:
virtual String get_caption() const;
diff --git a/servers/audio/audio_effect.h b/servers/audio/audio_effect.h
index 1274e06740..8ae716db20 100644
--- a/servers/audio/audio_effect.h
+++ b/servers/audio/audio_effect.h
@@ -35,7 +35,7 @@
#include "core/resource.h"
class AudioEffectInstance : public Reference {
- GDCLASS(AudioEffectInstance, Reference)
+ GDCLASS(AudioEffectInstance, Reference);
public:
virtual void process(const AudioFrame *p_src_frames, AudioFrame *p_dst_frames, int p_frame_count) = 0;
@@ -43,7 +43,8 @@ public:
};
class AudioEffect : public Resource {
- GDCLASS(AudioEffect, Resource)
+ GDCLASS(AudioEffect, Resource);
+
public:
virtual Ref<AudioEffectInstance> instance() = 0;
AudioEffect();
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index ab4ef5f91b..8f023c0401 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -38,7 +38,7 @@
class AudioStreamPlayback : public Reference {
- GDCLASS(AudioStreamPlayback, Reference)
+ GDCLASS(AudioStreamPlayback, Reference);
public:
virtual void start(float p_from_pos = 0.0) = 0;
@@ -55,7 +55,7 @@ public:
class AudioStreamPlaybackResampled : public AudioStreamPlayback {
- GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackResampled, AudioStreamPlayback);
enum {
FP_BITS = 16, //fixed point used for resampling
@@ -81,7 +81,7 @@ public:
class AudioStream : public Resource {
- GDCLASS(AudioStream, Resource)
+ GDCLASS(AudioStream, Resource);
OBJ_SAVE_TYPE(AudioStream) //children are all saved as AudioStream, so they can be exchanged
protected:
@@ -100,7 +100,7 @@ class AudioStreamPlaybackMicrophone;
class AudioStreamMicrophone : public AudioStream {
- GDCLASS(AudioStreamMicrophone, AudioStream)
+ GDCLASS(AudioStreamMicrophone, AudioStream);
friend class AudioStreamPlaybackMicrophone;
Set<AudioStreamPlaybackMicrophone *> playbacks;
@@ -119,7 +119,7 @@ public:
class AudioStreamPlaybackMicrophone : public AudioStreamPlaybackResampled {
- GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackMicrophone, AudioStreamPlayback);
friend class AudioStreamMicrophone;
bool active;
@@ -153,7 +153,7 @@ class AudioStreamPlaybackRandomPitch;
class AudioStreamRandomPitch : public AudioStream {
- GDCLASS(AudioStreamRandomPitch, AudioStream)
+ GDCLASS(AudioStreamRandomPitch, AudioStream);
friend class AudioStreamPlaybackRandomPitch;
Set<AudioStreamPlaybackRandomPitch *> playbacks;
@@ -180,7 +180,7 @@ public:
class AudioStreamPlaybackRandomPitch : public AudioStreamPlayback {
- GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback)
+ GDCLASS(AudioStreamPlaybackRandomPitch, AudioStreamPlayback);
friend class AudioStreamRandomPitch;
Ref<AudioStreamRandomPitch> random_pitch;
diff --git a/servers/audio/effects/audio_effect_amplify.h b/servers/audio/effects/audio_effect_amplify.h
index b6e2a1d4d8..4a98196d94 100644
--- a/servers/audio/effects/audio_effect_amplify.h
+++ b/servers/audio/effects/audio_effect_amplify.h
@@ -36,7 +36,7 @@
class AudioEffectAmplify;
class AudioEffectAmplifyInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectAmplifyInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectAmplifyInstance, AudioEffectInstance);
friend class AudioEffectAmplify;
Ref<AudioEffectAmplify> base;
@@ -47,7 +47,7 @@ public:
};
class AudioEffectAmplify : public AudioEffect {
- GDCLASS(AudioEffectAmplify, AudioEffect)
+ GDCLASS(AudioEffectAmplify, AudioEffect);
friend class AudioEffectAmplifyInstance;
float volume_db;
diff --git a/servers/audio/effects/audio_effect_chorus.h b/servers/audio/effects/audio_effect_chorus.h
index 9cad2906ff..417cc0c035 100644
--- a/servers/audio/effects/audio_effect_chorus.h
+++ b/servers/audio/effects/audio_effect_chorus.h
@@ -36,7 +36,7 @@
class AudioEffectChorus;
class AudioEffectChorusInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectChorusInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectChorusInstance, AudioEffectInstance);
friend class AudioEffectChorus;
Ref<AudioEffectChorus> base;
@@ -54,7 +54,7 @@ public:
};
class AudioEffectChorus : public AudioEffect {
- GDCLASS(AudioEffectChorus, AudioEffect)
+ GDCLASS(AudioEffectChorus, AudioEffect);
friend class AudioEffectChorusInstance;
diff --git a/servers/audio/effects/audio_effect_compressor.h b/servers/audio/effects/audio_effect_compressor.h
index 3ea3a58cb2..0fe956f60b 100644
--- a/servers/audio/effects/audio_effect_compressor.h
+++ b/servers/audio/effects/audio_effect_compressor.h
@@ -36,7 +36,7 @@
class AudioEffectCompressor;
class AudioEffectCompressorInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectCompressorInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectCompressorInstance, AudioEffectInstance);
friend class AudioEffectCompressor;
Ref<AudioEffectCompressor> base;
@@ -49,7 +49,7 @@ public:
};
class AudioEffectCompressor : public AudioEffect {
- GDCLASS(AudioEffectCompressor, AudioEffect)
+ GDCLASS(AudioEffectCompressor, AudioEffect);
friend class AudioEffectCompressorInstance;
float threshold;
diff --git a/servers/audio/effects/audio_effect_delay.h b/servers/audio/effects/audio_effect_delay.h
index 131b8714a0..ee778c70dc 100644
--- a/servers/audio/effects/audio_effect_delay.h
+++ b/servers/audio/effects/audio_effect_delay.h
@@ -36,7 +36,7 @@
class AudioEffectDelay;
class AudioEffectDelayInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectDelayInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectDelayInstance, AudioEffectInstance);
friend class AudioEffectDelay;
Ref<AudioEffectDelay> base;
@@ -58,7 +58,7 @@ public:
};
class AudioEffectDelay : public AudioEffect {
- GDCLASS(AudioEffectDelay, AudioEffect)
+ GDCLASS(AudioEffectDelay, AudioEffect);
friend class AudioEffectDelayInstance;
enum {
diff --git a/servers/audio/effects/audio_effect_distortion.h b/servers/audio/effects/audio_effect_distortion.h
index 2cbffc81a1..0b5ad0ec9e 100644
--- a/servers/audio/effects/audio_effect_distortion.h
+++ b/servers/audio/effects/audio_effect_distortion.h
@@ -36,7 +36,7 @@
class AudioEffectDistortion;
class AudioEffectDistortionInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectDistortionInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectDistortionInstance, AudioEffectInstance);
friend class AudioEffectDistortion;
Ref<AudioEffectDistortion> base;
float h[2];
@@ -46,7 +46,8 @@ public:
};
class AudioEffectDistortion : public AudioEffect {
- GDCLASS(AudioEffectDistortion, AudioEffect)
+ GDCLASS(AudioEffectDistortion, AudioEffect);
+
public:
enum Mode {
MODE_CLIP,
diff --git a/servers/audio/effects/audio_effect_eq.h b/servers/audio/effects/audio_effect_eq.h
index c9735b9073..dc75e566e7 100644
--- a/servers/audio/effects/audio_effect_eq.h
+++ b/servers/audio/effects/audio_effect_eq.h
@@ -37,7 +37,7 @@
class AudioEffectEQ;
class AudioEffectEQInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectEQInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectEQInstance, AudioEffectInstance);
friend class AudioEffectEQ;
Ref<AudioEffectEQ> base;
@@ -49,7 +49,7 @@ public:
};
class AudioEffectEQ : public AudioEffect {
- GDCLASS(AudioEffectEQ, AudioEffect)
+ GDCLASS(AudioEffectEQ, AudioEffect);
friend class AudioEffectEQInstance;
@@ -75,21 +75,24 @@ public:
};
class AudioEffectEQ6 : public AudioEffectEQ {
- GDCLASS(AudioEffectEQ6, AudioEffectEQ)
+ GDCLASS(AudioEffectEQ6, AudioEffectEQ);
+
public:
AudioEffectEQ6() :
AudioEffectEQ(EQ::PRESET_6_BANDS) {}
};
class AudioEffectEQ10 : public AudioEffectEQ {
- GDCLASS(AudioEffectEQ10, AudioEffectEQ)
+ GDCLASS(AudioEffectEQ10, AudioEffectEQ);
+
public:
AudioEffectEQ10() :
AudioEffectEQ(EQ::PRESET_10_BANDS) {}
};
class AudioEffectEQ21 : public AudioEffectEQ {
- GDCLASS(AudioEffectEQ21, AudioEffectEQ)
+ GDCLASS(AudioEffectEQ21, AudioEffectEQ);
+
public:
AudioEffectEQ21() :
AudioEffectEQ(EQ::PRESET_21_BANDS) {}
diff --git a/servers/audio/effects/audio_effect_filter.h b/servers/audio/effects/audio_effect_filter.h
index fd9a4bcf07..bb0d451522 100644
--- a/servers/audio/effects/audio_effect_filter.h
+++ b/servers/audio/effects/audio_effect_filter.h
@@ -37,7 +37,7 @@
class AudioEffectFilter;
class AudioEffectFilterInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectFilterInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectFilterInstance, AudioEffectInstance);
friend class AudioEffectFilter;
Ref<AudioEffectFilter> base;
@@ -55,7 +55,8 @@ public:
};
class AudioEffectFilter : public AudioEffect {
- GDCLASS(AudioEffectFilter, AudioEffect)
+ GDCLASS(AudioEffectFilter, AudioEffect);
+
public:
enum FilterDB {
FILTER_6DB,
@@ -95,7 +96,7 @@ public:
VARIANT_ENUM_CAST(AudioEffectFilter::FilterDB)
class AudioEffectLowPassFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectLowPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const {
if (property.name == "gain") property.usage = 0;
@@ -107,7 +108,7 @@ public:
};
class AudioEffectHighPassFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectHighPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const {
if (property.name == "gain") property.usage = 0;
}
@@ -118,7 +119,7 @@ public:
};
class AudioEffectBandPassFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectBandPassFilter, AudioEffectFilter);
void _validate_property(PropertyInfo &property) const {
if (property.name == "gain") property.usage = 0;
}
@@ -129,28 +130,32 @@ public:
};
class AudioEffectNotchFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectNotchFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectNotchFilter, AudioEffectFilter);
+
public:
AudioEffectNotchFilter() :
AudioEffectFilter(AudioFilterSW::NOTCH) {}
};
class AudioEffectBandLimitFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectBandLimitFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectBandLimitFilter, AudioEffectFilter);
+
public:
AudioEffectBandLimitFilter() :
AudioEffectFilter(AudioFilterSW::BANDLIMIT) {}
};
class AudioEffectLowShelfFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectLowShelfFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectLowShelfFilter, AudioEffectFilter);
+
public:
AudioEffectLowShelfFilter() :
AudioEffectFilter(AudioFilterSW::LOWSHELF) {}
};
class AudioEffectHighShelfFilter : public AudioEffectFilter {
- GDCLASS(AudioEffectHighShelfFilter, AudioEffectFilter)
+ GDCLASS(AudioEffectHighShelfFilter, AudioEffectFilter);
+
public:
AudioEffectHighShelfFilter() :
AudioEffectFilter(AudioFilterSW::HIGHSHELF) {}
diff --git a/servers/audio/effects/audio_effect_limiter.h b/servers/audio/effects/audio_effect_limiter.h
index d629166f42..bf7167e3f4 100644
--- a/servers/audio/effects/audio_effect_limiter.h
+++ b/servers/audio/effects/audio_effect_limiter.h
@@ -36,7 +36,7 @@
class AudioEffectLimiter;
class AudioEffectLimiterInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectLimiterInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectLimiterInstance, AudioEffectInstance);
friend class AudioEffectLimiter;
Ref<AudioEffectLimiter> base;
@@ -47,7 +47,7 @@ public:
};
class AudioEffectLimiter : public AudioEffect {
- GDCLASS(AudioEffectLimiter, AudioEffect)
+ GDCLASS(AudioEffectLimiter, AudioEffect);
friend class AudioEffectLimiterInstance;
float threshold;
diff --git a/servers/audio/effects/audio_effect_panner.h b/servers/audio/effects/audio_effect_panner.h
index 4256d05a2f..7bd5a09fc6 100644
--- a/servers/audio/effects/audio_effect_panner.h
+++ b/servers/audio/effects/audio_effect_panner.h
@@ -36,7 +36,7 @@
class AudioEffectPanner;
class AudioEffectPannerInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectPannerInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectPannerInstance, AudioEffectInstance);
friend class AudioEffectPanner;
Ref<AudioEffectPanner> base;
@@ -45,7 +45,7 @@ public:
};
class AudioEffectPanner : public AudioEffect {
- GDCLASS(AudioEffectPanner, AudioEffect)
+ GDCLASS(AudioEffectPanner, AudioEffect);
friend class AudioEffectPannerInstance;
float pan;
diff --git a/servers/audio/effects/audio_effect_phaser.h b/servers/audio/effects/audio_effect_phaser.h
index 264e792be5..b76d6bb29c 100644
--- a/servers/audio/effects/audio_effect_phaser.h
+++ b/servers/audio/effects/audio_effect_phaser.h
@@ -36,7 +36,7 @@
class AudioEffectPhaser;
class AudioEffectPhaserInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectPhaserInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectPhaserInstance, AudioEffectInstance);
friend class AudioEffectPhaser;
Ref<AudioEffectPhaser> base;
@@ -70,7 +70,7 @@ public:
};
class AudioEffectPhaser : public AudioEffect {
- GDCLASS(AudioEffectPhaser, AudioEffect)
+ GDCLASS(AudioEffectPhaser, AudioEffect);
friend class AudioEffectPhaserInstance;
float range_min;
diff --git a/servers/audio/effects/audio_effect_pitch_shift.cpp b/servers/audio/effects/audio_effect_pitch_shift.cpp
index ca2a88f858..c250f2e2bd 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.cpp
+++ b/servers/audio/effects/audio_effect_pitch_shift.cpp
@@ -293,14 +293,16 @@ void AudioEffectPitchShiftInstance::process(const AudioFrame *p_src_frames, Audi
float *out_l = (float *)p_dst_frames;
float *out_r = out_l + 1;
- shift_l.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_l, out_l, 2);
- shift_r.PitchShift(base->pitch_scale, p_frame_count, 2048, 4, sample_rate, in_r, out_r, 2);
+ shift_l.PitchShift(base->pitch_scale, p_frame_count, fft_size, base->oversampling, sample_rate, in_l, out_l, 2);
+ shift_r.PitchShift(base->pitch_scale, p_frame_count, fft_size, base->oversampling, sample_rate, in_r, out_r, 2);
}
Ref<AudioEffectInstance> AudioEffectPitchShift::instance() {
Ref<AudioEffectPitchShiftInstance> ins;
ins.instance();
ins->base = Ref<AudioEffectPitchShift>(this);
+ static const int fft_sizes[FFT_SIZE_MAX] = { 256, 512, 1024, 2048, 4096 };
+ ins->fft_size = fft_sizes[fft_size];
return ins;
}
@@ -315,14 +317,50 @@ float AudioEffectPitchShift::get_pitch_scale() const {
return pitch_scale;
}
+void AudioEffectPitchShift::set_oversampling(int p_oversampling) {
+ ERR_FAIL_COND(p_oversampling < 4);
+ oversampling = p_oversampling;
+}
+
+int AudioEffectPitchShift::get_oversampling() const {
+
+ return oversampling;
+}
+
+void AudioEffectPitchShift::set_fft_size(FFT_Size p_fft_size) {
+ ERR_FAIL_INDEX(p_fft_size, FFT_SIZE_MAX);
+ fft_size = p_fft_size;
+}
+
+AudioEffectPitchShift::FFT_Size AudioEffectPitchShift::get_fft_size() const {
+ return fft_size;
+}
+
void AudioEffectPitchShift::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pitch_scale", "rate"), &AudioEffectPitchShift::set_pitch_scale);
ClassDB::bind_method(D_METHOD("get_pitch_scale"), &AudioEffectPitchShift::get_pitch_scale);
+ ClassDB::bind_method(D_METHOD("set_oversampling", "amount"), &AudioEffectPitchShift::set_oversampling);
+ ClassDB::bind_method(D_METHOD("get_oversampling"), &AudioEffectPitchShift::get_oversampling);
+
+ ClassDB::bind_method(D_METHOD("set_fft_size", "size"), &AudioEffectPitchShift::set_fft_size);
+ ClassDB::bind_method(D_METHOD("get_fft_size"), &AudioEffectPitchShift::get_fft_size);
+
ADD_PROPERTY(PropertyInfo(Variant::REAL, "pitch_scale", PROPERTY_HINT_RANGE, "0.01,16,0.01"), "set_pitch_scale", "get_pitch_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "oversampling", PROPERTY_HINT_RANGE, "4,32,1"), "set_oversampling", "get_oversampling");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "fft_size", PROPERTY_HINT_ENUM, "256,512,1024,2048,4096"), "set_fft_size", "get_fft_size");
+
+ BIND_ENUM_CONSTANT(FFT_SIZE_256);
+ BIND_ENUM_CONSTANT(FFT_SIZE_512);
+ BIND_ENUM_CONSTANT(FFT_SIZE_1024);
+ BIND_ENUM_CONSTANT(FFT_SIZE_2048);
+ BIND_ENUM_CONSTANT(FFT_SIZE_4096);
+ BIND_ENUM_CONSTANT(FFT_SIZE_MAX);
}
AudioEffectPitchShift::AudioEffectPitchShift() {
pitch_scale = 1.0;
+ oversampling = 4;
+ fft_size = FFT_SIZE_2048;
}
diff --git a/servers/audio/effects/audio_effect_pitch_shift.h b/servers/audio/effects/audio_effect_pitch_shift.h
index febc20e9d5..2028496ebf 100644
--- a/servers/audio/effects/audio_effect_pitch_shift.h
+++ b/servers/audio/effects/audio_effect_pitch_shift.h
@@ -72,10 +72,11 @@ public:
class AudioEffectPitchShift;
class AudioEffectPitchShiftInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectPitchShiftInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectPitchShiftInstance, AudioEffectInstance);
friend class AudioEffectPitchShift;
Ref<AudioEffectPitchShift> base;
+ int fft_size;
SMBPitchShift shift_l;
SMBPitchShift shift_r;
@@ -84,12 +85,23 @@ public:
};
class AudioEffectPitchShift : public AudioEffect {
- GDCLASS(AudioEffectPitchShift, AudioEffect)
+ GDCLASS(AudioEffectPitchShift, AudioEffect);
+public:
friend class AudioEffectPitchShiftInstance;
+ enum FFT_Size {
+ FFT_SIZE_256,
+ FFT_SIZE_512,
+ FFT_SIZE_1024,
+ FFT_SIZE_2048,
+ FFT_SIZE_4096,
+ FFT_SIZE_MAX
+ };
+
float pitch_scale;
- int window_size;
+ int oversampling;
+ FFT_Size fft_size;
float wet;
float dry;
bool filter;
@@ -103,7 +115,15 @@ public:
void set_pitch_scale(float p_pitch_scale);
float get_pitch_scale() const;
+ void set_oversampling(int p_oversampling);
+ int get_oversampling() const;
+
+ void set_fft_size(FFT_Size);
+ FFT_Size get_fft_size() const;
+
AudioEffectPitchShift();
};
+VARIANT_ENUM_CAST(AudioEffectPitchShift::FFT_Size);
+
#endif // AUDIO_EFFECT_PITCH_SHIFT_H
diff --git a/servers/audio/effects/audio_effect_record.h b/servers/audio/effects/audio_effect_record.h
index 528c7dbd7c..d9bf39eb5f 100644
--- a/servers/audio/effects/audio_effect_record.h
+++ b/servers/audio/effects/audio_effect_record.h
@@ -43,7 +43,7 @@
class AudioEffectRecord;
class AudioEffectRecordInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectRecordInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectRecordInstance, AudioEffectInstance);
friend class AudioEffectRecord;
Ref<AudioEffectRecord> base;
@@ -77,7 +77,7 @@ public:
};
class AudioEffectRecord : public AudioEffect {
- GDCLASS(AudioEffectRecord, AudioEffect)
+ GDCLASS(AudioEffectRecord, AudioEffect);
friend class AudioEffectRecordInstance;
diff --git a/servers/audio/effects/audio_effect_reverb.h b/servers/audio/effects/audio_effect_reverb.h
index ed76050f24..31a796bf98 100644
--- a/servers/audio/effects/audio_effect_reverb.h
+++ b/servers/audio/effects/audio_effect_reverb.h
@@ -37,7 +37,7 @@
class AudioEffectReverb;
class AudioEffectReverbInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectReverbInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectReverbInstance, AudioEffectInstance);
Ref<AudioEffectReverb> base;
@@ -54,7 +54,7 @@ public:
};
class AudioEffectReverb : public AudioEffect {
- GDCLASS(AudioEffectReverb, AudioEffect)
+ GDCLASS(AudioEffectReverb, AudioEffect);
friend class AudioEffectReverbInstance;
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
index f5ac0afefa..305f9046c3 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.cpp
@@ -111,9 +111,10 @@ void AudioEffectSpectrumAnalyzerInstance::process(const AudioFrame *p_src_frames
float *fftw = temporal_fft.ptrw();
for (int i = 0; i < to_fill; i++) { //left and right buffers
- fftw[(i + temporal_fft_pos) * 2] = p_src_frames[i].l;
+ float window = -0.5 * Math::cos(2.0 * Math_PI * (double)i / (double)to_fill) + 0.5;
+ fftw[(i + temporal_fft_pos) * 2] = window * p_src_frames[i].l;
fftw[(i + temporal_fft_pos) * 2 + 1] = 0;
- fftw[(i + temporal_fft_pos + fft_size * 2) * 2] = p_src_frames[i].r;
+ fftw[(i + temporal_fft_pos + fft_size * 2) * 2] = window * p_src_frames[i].r;
fftw[(i + temporal_fft_pos + fft_size * 2) * 2 + 1] = 0;
}
diff --git a/servers/audio/effects/audio_effect_spectrum_analyzer.h b/servers/audio/effects/audio_effect_spectrum_analyzer.h
index 4f4c3c8a58..27eb88d29f 100644
--- a/servers/audio/effects/audio_effect_spectrum_analyzer.h
+++ b/servers/audio/effects/audio_effect_spectrum_analyzer.h
@@ -36,7 +36,7 @@
class AudioEffectSpectrumAnalyzer;
class AudioEffectSpectrumAnalyzerInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectSpectrumAnalyzerInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectSpectrumAnalyzerInstance, AudioEffectInstance);
public:
enum MagnitudeMode {
@@ -68,7 +68,8 @@ public:
VARIANT_ENUM_CAST(AudioEffectSpectrumAnalyzerInstance::MagnitudeMode)
class AudioEffectSpectrumAnalyzer : public AudioEffect {
- GDCLASS(AudioEffectSpectrumAnalyzer, AudioEffect)
+ GDCLASS(AudioEffectSpectrumAnalyzer, AudioEffect);
+
public:
enum FFT_Size {
FFT_SIZE_256,
diff --git a/servers/audio/effects/audio_effect_stereo_enhance.h b/servers/audio/effects/audio_effect_stereo_enhance.h
index 787c351a03..44b7d3eb5c 100644
--- a/servers/audio/effects/audio_effect_stereo_enhance.h
+++ b/servers/audio/effects/audio_effect_stereo_enhance.h
@@ -36,7 +36,7 @@
class AudioEffectStereoEnhance;
class AudioEffectStereoEnhanceInstance : public AudioEffectInstance {
- GDCLASS(AudioEffectStereoEnhanceInstance, AudioEffectInstance)
+ GDCLASS(AudioEffectStereoEnhanceInstance, AudioEffectInstance);
friend class AudioEffectStereoEnhance;
Ref<AudioEffectStereoEnhance> base;
@@ -56,7 +56,7 @@ public:
};
class AudioEffectStereoEnhance : public AudioEffect {
- GDCLASS(AudioEffectStereoEnhance, AudioEffect)
+ GDCLASS(AudioEffectStereoEnhance, AudioEffect);
friend class AudioEffectStereoEnhanceInstance;
float volume_db;
diff --git a/servers/audio/effects/audio_stream_generator.h b/servers/audio/effects/audio_stream_generator.h
index c3490ddaa5..33839d3db8 100644
--- a/servers/audio/effects/audio_stream_generator.h
+++ b/servers/audio/effects/audio_stream_generator.h
@@ -35,7 +35,7 @@
#include "servers/audio/audio_stream.h"
class AudioStreamGenerator : public AudioStream {
- GDCLASS(AudioStreamGenerator, AudioStream)
+ GDCLASS(AudioStreamGenerator, AudioStream);
float mix_rate;
float buffer_len;
@@ -59,7 +59,7 @@ public:
class AudioStreamGeneratorPlayback : public AudioStreamPlaybackResampled {
- GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled)
+ GDCLASS(AudioStreamGeneratorPlayback, AudioStreamPlaybackResampled);
friend class AudioStreamGenerator;
RingBuffer<AudioFrame> buffer;
int skips;
diff --git a/servers/audio_server.h b/servers/audio_server.h
index 8c0ffd5a6b..942fe7bc87 100644
--- a/servers/audio_server.h
+++ b/servers/audio_server.h
@@ -147,7 +147,8 @@ class AudioBusLayout;
class AudioServer : public Object {
- GDCLASS(AudioServer, Object)
+ GDCLASS(AudioServer, Object);
+
public:
//re-expose this here, as AudioDriver is not exposed to script
enum SpeakerMode {
@@ -390,7 +391,7 @@ VARIANT_ENUM_CAST(AudioServer::SpeakerMode)
class AudioBusLayout : public Resource {
- GDCLASS(AudioBusLayout, Resource)
+ GDCLASS(AudioBusLayout, Resource);
friend class AudioServer;
diff --git a/servers/camera/camera_feed.cpp b/servers/camera/camera_feed.cpp
index 31b8b2874f..094c83cd7c 100644
--- a/servers/camera/camera_feed.cpp
+++ b/servers/camera/camera_feed.cpp
@@ -60,8 +60,8 @@ void CameraFeed::_bind_methods() {
BIND_ENUM_CONSTANT(FEED_NOIMAGE);
BIND_ENUM_CONSTANT(FEED_RGB);
- BIND_ENUM_CONSTANT(FEED_YCbCr);
- BIND_ENUM_CONSTANT(FEED_YCbCr_Sep);
+ BIND_ENUM_CONSTANT(FEED_YCBCR);
+ BIND_ENUM_CONSTANT(FEED_YCBCR_SEP);
BIND_ENUM_CONSTANT(FEED_UNSPECIFIED);
BIND_ENUM_CONSTANT(FEED_FRONT);
@@ -145,7 +145,7 @@ CameraFeed::CameraFeed() {
// create a texture object
VisualServer *vs = VisualServer::get_singleton();
texture[CameraServer::FEED_Y_IMAGE] = vs->texture_create(); // also used for RGBA
- texture[CameraServer::FEED_CbCr_IMAGE] = vs->texture_create();
+ texture[CameraServer::FEED_CBCR_IMAGE] = vs->texture_create();
}
CameraFeed::CameraFeed(String p_name, FeedPosition p_position) {
@@ -162,14 +162,14 @@ CameraFeed::CameraFeed(String p_name, FeedPosition p_position) {
// create a texture object
VisualServer *vs = VisualServer::get_singleton();
texture[CameraServer::FEED_Y_IMAGE] = vs->texture_create(); // also used for RGBA
- texture[CameraServer::FEED_CbCr_IMAGE] = vs->texture_create();
+ texture[CameraServer::FEED_CBCR_IMAGE] = vs->texture_create();
}
CameraFeed::~CameraFeed() {
// Free our textures
VisualServer *vs = VisualServer::get_singleton();
vs->free(texture[CameraServer::FEED_Y_IMAGE]);
- vs->free(texture[CameraServer::FEED_CbCr_IMAGE]);
+ vs->free(texture[CameraServer::FEED_CBCR_IMAGE]);
}
void CameraFeed::set_RGB_img(Ref<Image> p_rgb_img) {
@@ -208,7 +208,7 @@ void CameraFeed::set_YCbCr_img(Ref<Image> p_ycbcr_img) {
}
vs->texture_set_data(texture[CameraServer::FEED_RGBA_IMAGE], p_ycbcr_img);
- datatype = CameraFeed::FEED_YCbCr;
+ datatype = CameraFeed::FEED_YCBCR;
}
}
@@ -233,12 +233,12 @@ void CameraFeed::set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img) {
vs->texture_allocate(texture[CameraServer::FEED_Y_IMAGE], new_y_width, new_y_height, 0, Image::FORMAT_R8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING);
///@TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion
- vs->texture_allocate(texture[CameraServer::FEED_CbCr_IMAGE], new_cbcr_width, new_cbcr_height, 0, Image::FORMAT_RG8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING);
+ vs->texture_allocate(texture[CameraServer::FEED_CBCR_IMAGE], new_cbcr_width, new_cbcr_height, 0, Image::FORMAT_RG8, VS::TEXTURE_TYPE_2D, VS::TEXTURE_FLAG_USED_FOR_STREAMING);
}
vs->texture_set_data(texture[CameraServer::FEED_Y_IMAGE], p_y_img);
- vs->texture_set_data(texture[CameraServer::FEED_CbCr_IMAGE], p_cbcr_img);
- datatype = CameraFeed::FEED_YCbCr_Sep;
+ vs->texture_set_data(texture[CameraServer::FEED_CBCR_IMAGE], p_cbcr_img);
+ datatype = CameraFeed::FEED_YCBCR_SEP;
}
}
diff --git a/servers/camera/camera_feed.h b/servers/camera/camera_feed.h
index 90c076071c..0c53ff9309 100644
--- a/servers/camera/camera_feed.h
+++ b/servers/camera/camera_feed.h
@@ -50,8 +50,8 @@ public:
enum FeedDataType {
FEED_NOIMAGE, // we don't have an image yet
FEED_RGB, // our texture will contain a normal RGB texture that can be used directly
- FEED_YCbCr, // our texture will contain a YCbCr texture that needs to be converted to RGB before output
- FEED_YCbCr_Sep // our camera is split into two textures, first plane contains Y data, second plane contains CbCr data
+ FEED_YCBCR, // our texture will contain a YCbCr texture that needs to be converted to RGB before output
+ FEED_YCBCR_SEP // our camera is split into two textures, first plane contains Y data, second plane contains CbCr data
};
enum FeedPosition {
diff --git a/servers/camera_server.cpp b/servers/camera_server.cpp
index 8d2ae37001..0f93221072 100644
--- a/servers/camera_server.cpp
+++ b/servers/camera_server.cpp
@@ -47,9 +47,9 @@ void CameraServer::_bind_methods() {
ADD_SIGNAL(MethodInfo("camera_feed_removed", PropertyInfo(Variant::INT, "id")));
BIND_ENUM_CONSTANT(FEED_RGBA_IMAGE);
- BIND_ENUM_CONSTANT(FEED_YCbCr_IMAGE);
+ BIND_ENUM_CONSTANT(FEED_YCBCR_IMAGE);
BIND_ENUM_CONSTANT(FEED_Y_IMAGE);
- BIND_ENUM_CONSTANT(FEED_CbCr_IMAGE);
+ BIND_ENUM_CONSTANT(FEED_CBCR_IMAGE);
};
CameraServer *CameraServer::singleton = NULL;
diff --git a/servers/camera_server.h b/servers/camera_server.h
index d204142c7d..5a62af3d60 100644
--- a/servers/camera_server.h
+++ b/servers/camera_server.h
@@ -53,9 +53,9 @@ class CameraServer : public Object {
public:
enum FeedImage {
FEED_RGBA_IMAGE = 0,
- FEED_YCbCr_IMAGE = 0,
+ FEED_YCBCR_IMAGE = 0,
FEED_Y_IMAGE = 0,
- FEED_CbCr_IMAGE = 1,
+ FEED_CBCR_IMAGE = 1,
FEED_IMAGES = 2
};
diff --git a/servers/physics/area_sw.cpp b/servers/physics/area_sw.cpp
index 9d68869bc2..ad3e40916d 100644
--- a/servers/physics/area_sw.cpp
+++ b/servers/physics/area_sw.cpp
@@ -250,7 +250,7 @@ AreaSW::AreaSW() :
gravity_is_point = false;
gravity_distance_scale = 0;
point_attenuation = 1;
- angular_damp = 1.0;
+ angular_damp = 0.1;
linear_damp = 0.1;
priority = 0;
set_ray_pickable(false);
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index b4c3670a7b..172a2a3429 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -346,8 +346,7 @@ void BodySW::set_state(PhysicsServer::BodyState p_state, const Variant &p_varian
//biased_angular_velocity=Vector3();
set_active(false);
} else {
- if (mode != PhysicsServer::BODY_MODE_STATIC)
- set_active(true);
+ set_active(true);
}
} break;
case PhysicsServer::BODY_STATE_CAN_SLEEP: {
diff --git a/servers/physics/gjk_epa.cpp b/servers/physics/gjk_epa.cpp
index ae512183fd..1d5ca42838 100644
--- a/servers/physics/gjk_epa.cpp
+++ b/servers/physics/gjk_epa.cpp
@@ -722,7 +722,10 @@ struct GJK
append(m_stock,face);
return(0);
}
- m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces;
+ // -- GODOT start --
+ //m_status=m_stock.root?eStatus::OutOfVertices:eStatus::OutOfFaces;
+ m_status=eStatus::OutOfFaces;
+ // -- GODOT end --
return(0);
}
sFace* findbest()
diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp
index bc6010117c..75910ff1c0 100644
--- a/servers/visual/shader_types.cpp
+++ b/servers/visual/shader_types.cpp
@@ -137,6 +137,8 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["FRAGCOORD"] = constt(ShaderLanguage::TYPE_VEC4);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["NORMAL"] = constt(ShaderLanguage::TYPE_VEC3);
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["UV"] = constt(ShaderLanguage::TYPE_VEC2);
+ shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["UV2"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["VIEW"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT"] = constt(ShaderLanguage::TYPE_VEC3);
shader_modes[VS::SHADER_SPATIAL].functions["light"].built_ins["LIGHT_COLOR"] = constt(ShaderLanguage::TYPE_VEC3);